Class: AWS::S3::ACL::Policy::Builder

Inherits:
XmlGenerator
  • Object
show all
Defined in:
lib/aws-matt/s3/acl.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, grants) ⇒ Builder

Returns a new instance of Builder.



182
183
184
185
186
# File 'lib/aws-matt/s3/acl.rb', line 182

def initialize(owner, grants)
  @owner  = owner
  @grants = grants.uniq # There could be some duplicate grants
  super()
end

Instance Attribute Details

#grantsObject (readonly)

Returns the value of attribute grants.



181
182
183
# File 'lib/aws-matt/s3/acl.rb', line 181

def grants
  @grants
end

#ownerObject (readonly)

Returns the value of attribute owner.



181
182
183
# File 'lib/aws-matt/s3/acl.rb', line 181

def owner
  @owner
end

Instance Method Details

#buildObject



188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/aws-matt/s3/acl.rb', line 188

def build
  xml.tag!('AccessControlPolicy', 'xmlns' => 'http://s3.amazonaws.com/doc/2006-03-01/') do
    xml.Owner do
      xml.ID owner.id
      xml.DisplayName owner.display_name
    end
    
    xml.AccessControlList do
      xml << grants.map {|grant| grant.to_xml}.join("\n")
    end
  end
end