# File lib/rudy/aws/ec2/group.rb, line 211
211:       def self.from_hash(ghash)
212:         newg = Rudy::AWS::EC2::Group.new
213:         newg.name = ghash['groupName']
214:         newg.description = ghash['groupDescription']
215:         newg.owner_id = ghash['ownerId']
216:         newg.addresses = {}
217:         newg.groups = {}
218:         
219:         return newg unless ghash['ipPermissions'].is_a?(Hash)
220:         
221:         ghash['ipPermissions']['item'].each do |oldp|
222:           newp = Rudy::AWS::EC2::Group::Rule.new
223:           newp.ports = Range.new(oldp['fromPort'], oldp['toPort'])
224:           newp.protocol = oldp['ipProtocol']
225:           if oldp['groups'].is_a?(Hash)
226:             oldp['groups']['item'].each do |oldpg|
227:               name = [oldpg['userId'], oldpg['groupName']].join(':')   # account_num:name
228:               newg.add_group(name, newp)
229:             end
230:           end
231:           if oldp['ipRanges'].is_a?(Hash)
232:             oldp['ipRanges']['item'].each do |olda|
233:               name = "#{olda['cidrIp']}"
234:               newg.add_address(name, newp)   # ipaddress/mask/protocol
235:             end
236:           end
237:         end
238:         newg
239:       end