Class | S33r::S3ACL::Grantee |
In: |
lib/s33r/s3_acl.rb
|
Parent: | Object |
Abstract representation of an S3 Grantee.
grantee_type | [R] |
# File lib/s33r/s3_acl.rb, line 265 265: def self.from_xml(grantee_xml) 266: grantee_type = grantee_xml['type'] 267: 268: case grantee_type 269: when GRANTEE_TYPES[:amazon_customer] 270: AmazonCustomer.new(grantee_xml.xget('EmailAddress')) 271: when GRANTEE_TYPES[:canonical_user] 272: CanonicalUser.from_xml(grantee_xml) 273: when GRANTEE_TYPES[:group] 274: uri = grantee_xml.xget('URI') 275: # last part of the path is the group type 276: path = uri.gsub(/#{GROUP_ACL_URI_BASE}/, '') 277: 278: group_type = :all_users 279: S3_GROUP_TYPES.each { |k,v| group_type = k if v == path } 280: Group.new(group_type) 281: end 282: end
# File lib/s33r/s3_acl.rb, line 248 248: def ==(obj) 249: if !obj.is_a?(Grantee) 250: return false 251: end 252: instance_variables.each do |var| 253: method_name = var.gsub(/^@/, '') 254: if self.send(method_name) != obj.send(method_name) 255: return false 256: end 257: end 258: return true 259: end