Class: RAWS::S3::ACL::Grants
- Inherits:
-
Array
- Object
- Array
- RAWS::S3::ACL::Grants
- Defined in:
- lib/raws/s3/acl.rb
Instance Method Summary collapse
-
#initialize(grants) ⇒ Grants
constructor
A new instance of Grants.
- #to_xml ⇒ Object
Constructor Details
#initialize(grants) ⇒ Grants
Returns a new instance of Grants.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/raws/s3/acl.rb', line 92 def initialize(grants) super() grants.each do |grant| grantee, = grant['Grantee'], grant['Permission'] if id = grantee['ID'] push ID.new(id, , grantee['DisplayName']) elsif email = grantee['EmailAddress'] push Email.new(email, ) else case grantee['URI'] when 'http://acs.amazonaws.com/groups/global/AuthenticatedUsers' push AuthenticatedUsers.new() when 'http://acs.amazonaws.com/groups/global/AllUsers' push AllUsers.new() end end end end |
Instance Method Details
#to_xml ⇒ Object
111 112 113 114 115 116 117 |
# File 'lib/raws/s3/acl.rb', line 111 def to_xml '<AccessControlList>' << map do |grant| grant.to_xml end.join << '</AccessControlList>' end |