Class: RAWS::S3::ACL
- Inherits:
-
Object
- Object
- RAWS::S3::ACL
- Defined in:
- lib/raws/s3/acl.rb
Defined Under Namespace
Classes: AllUsers, AuthenticatedUsers, Email, Grant, Grants, Group, ID, Owner
Instance Attribute Summary collapse
-
#bucket_name ⇒ Object
readonly
Returns the value of attribute bucket_name.
-
#grants ⇒ Object
readonly
Returns the value of attribute grants.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
Instance Method Summary collapse
-
#initialize(bucket_name, key = nil) ⇒ ACL
constructor
A new instance of ACL.
- #reload ⇒ Object
- #save ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(bucket_name, key = nil) ⇒ ACL
Returns a new instance of ACL.
122 123 124 125 |
# File 'lib/raws/s3/acl.rb', line 122 def initialize(bucket_name, key=nil) @bucket_name, @key = bucket_name, key reload end |
Instance Attribute Details
#bucket_name ⇒ Object (readonly)
Returns the value of attribute bucket_name.
120 121 122 |
# File 'lib/raws/s3/acl.rb', line 120 def bucket_name @bucket_name end |
#grants ⇒ Object (readonly)
Returns the value of attribute grants.
120 121 122 |
# File 'lib/raws/s3/acl.rb', line 120 def grants @grants end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
120 121 122 |
# File 'lib/raws/s3/acl.rb', line 120 def key @key end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
120 121 122 |
# File 'lib/raws/s3/acl.rb', line 120 def owner @owner end |
Instance Method Details
#reload ⇒ Object
131 132 133 134 135 136 |
# File 'lib/raws/s3/acl.rb', line 131 def reload doc = RAWS::S3::Adapter.get_acl(@bucket_name, @key).doc acp = doc['AccessControlPolicy'] @owner = Owner.new(acp['Owner']) @grants = Grants.new(acp['AccessControlList']['Grant']) end |
#save ⇒ Object
127 128 129 |
# File 'lib/raws/s3/acl.rb', line 127 def save RAWS::S3::Adapter.put_acl(@bucket_name, @key, to_xml) end |
#to_xml ⇒ Object
138 139 140 141 142 143 |
# File 'lib/raws/s3/acl.rb', line 138 def to_xml '<AccessControlPolicy>' << owner.to_xml << grants.to_xml << '</AccessControlPolicy>' end |