Class: AWS::S3::Owner

Inherits:
Object
  • Object
show all
Includes:
SelectiveAttributeProxy
Defined in:
lib/aws/s3/owner.rb

Overview

Entities in S3 have an associated owner (the person who created them). The owner is a canonical representation of an entity in the S3 system. It has an id and a display_name.

These attributes can be used when specifying a ACL::Grantee for an ACL::Grant.

You can retrieve the owner of the current account by calling Owner.current.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Owner

:nodoc:



24
25
26
# File 'lib/aws/s3/owner.rb', line 24

def initialize(attributes = {}) #:nodoc:
  @attributes = attributes
end

Class Method Details

.currentObject

The owner of the current account.



15
16
17
18
19
20
# File 'lib/aws/s3/owner.rb', line 15

def current
  response = Service.get('/')
  # new(response.parsed['owner']) if response.parsed['owner']
  #TODO: This is a pretty hackish way to get the current account owner.
  response.parsed['contents'][0]['owner'] if (response.parsed['contents'] && response.parsed['contents'][0])
end

Instance Method Details

#==(other_owner) ⇒ Object

:nodoc:



28
29
30
# File 'lib/aws/s3/owner.rb', line 28

def ==(other_owner) #:nodoc:
  hash == other_owner.hash
end

#hashObject

:nodoc



32
33
34
# File 'lib/aws/s3/owner.rb', line 32

def hash #:nodoc
  [id, display_name].join.hash
end