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

Inherits:
XmlGenerator show all
Defined in:
lib/aws/s3/acl.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from XmlGenerator

#xml

Instance Method Summary collapse

Methods inherited from String

#previous, #previous!, #remove_extended, #remove_extended!, #tap, #to_header, #underscore, #valid_utf8?

Constructor Details

#initialize(owner, grants) ⇒ Builder

Returns a new instance of Builder



182
183
184
185
186
# File 'lib/aws/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/s3/acl.rb', line 181

def grants
  @grants
end

#ownerObject (readonly)

Returns the value of attribute owner



181
182
183
# File 'lib/aws/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/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