Class: S33r::S3ACL::Grantee
- Inherits:
-
Object
- Object
- S33r::S3ACL::Grantee
- Defined in:
- lib/s33r/s3_acl.rb
Overview
Abstract representation of an S3 Grantee.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#grantee_type ⇒ Object
readonly
Returns the value of attribute grantee_type.
Class Method Summary collapse
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
223 224 225 |
# File 'lib/s33r/s3_acl.rb', line 223 def method_missing(*args) nil end |
Instance Attribute Details
#grantee_type ⇒ Object (readonly)
Returns the value of attribute grantee_type.
208 209 210 |
# File 'lib/s33r/s3_acl.rb', line 208 def grantee_type @grantee_type end |
Class Method Details
.from_xml(grantee_xml) ⇒ Object
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/s33r/s3_acl.rb', line 227 def self.from_xml(grantee_xml) grantee_type = grantee_xml['type'] case grantee_type when GRANTEE_TYPES[:amazon_customer] AmazonCustomer.new(grantee_xml.xget('EmailAddress')) when GRANTEE_TYPES[:canonical_user] CanonicalUser.from_xml(grantee_xml) when GRANTEE_TYPES[:group] uri = grantee_xml.xget('URI') # last part of the path is the group type path = uri.gsub(/#{GROUP_ACL_URI_BASE}/, '') group_type = :all_users S3_GROUP_TYPES.each { |k,v| group_type = k if v == path } Group.new(group_type) end end |
Instance Method Details
#==(obj) ⇒ Object
210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/s33r/s3_acl.rb', line 210 def ==(obj) if !obj.is_a?(Grantee) return false end instance_variables.each do |var| method_name = var.gsub(/^@/, '') if self.send(method_name) != obj.send(method_name) return false end end return true end |