Class: Aliyun::OSS::Owner

Inherits:
Object show all
Includes:
SelectiveAttributeProxy
Defined in:
lib/aliyun/oss/owner.rb

Overview

Entities in OSS have an associated owner (the person who created them). The owner is a canonical representation of an entity in the OSS 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

Methods included from SelectiveAttributeProxy

included

Constructor Details

#initialize(attributes = {}) ⇒ Owner

:nodoc:



23
24
25
# File 'lib/aliyun/oss/owner.rb', line 23

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

Class Method Details

.currentObject

The owner of the current account.



16
17
18
19
# File 'lib/aliyun/oss/owner.rb', line 16

def current
  response = Service.get('/')
  new(response.parsed['owner']) if response.parsed['owner']
end

Instance Method Details

#==(other_owner) ⇒ Object

:nodoc:



27
28
29
# File 'lib/aliyun/oss/owner.rb', line 27

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

#hashObject

:nodoc



31
32
33
# File 'lib/aliyun/oss/owner.rb', line 31

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