Class: StarkBank::CorporateHolder::Permission
- Inherits:
-
StarkCore::Utils::SubResource
- Object
- StarkCore::Utils::SubResource
- StarkBank::CorporateHolder::Permission
- Defined in:
- lib/corporate_holder/permission.rb
Overview
# CorporateHolder::Permission object
The CorporateHolder::Permission object modifies the behavior of CorporateHolder objects when passed as an argument upon their creation.
## Parameters (optional):
-
owner_id [string, default nil]: owner unique id. ex: “5656565656565656”
-
owner_type [string, default nil]: owner type. ex: “project”
## Attributes (return-only):
-
owner_email [string]: email address of the owner. ex: “[email protected]
-
owner_name [string]: name of the owner. ex: “Tony Stark”
-
owner_picture_url [string]: Profile picture Url of the owner. ex: “storage.googleapis.com/api-ms-workspace-sbx.appspot.com/pictures/member/6227829385592832?20230404164942”
-
owner_status [string]: current owner status. ex: “active”, “blocked”, “canceled”
-
created [DateTime]: creation datetime for the Permission. ex: ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
Instance Attribute Summary collapse
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#owner_email ⇒ Object
readonly
Returns the value of attribute owner_email.
-
#owner_id ⇒ Object
readonly
Returns the value of attribute owner_id.
-
#owner_name ⇒ Object
readonly
Returns the value of attribute owner_name.
-
#owner_picture_url ⇒ Object
readonly
Returns the value of attribute owner_picture_url.
-
#owner_status ⇒ Object
readonly
Returns the value of attribute owner_status.
-
#owner_type ⇒ Object
readonly
Returns the value of attribute owner_type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(owner_email: nil, owner_id: nil, owner_name: nil, owner_picture_url: nil, owner_status: nil, owner_type: nil, created: nil) ⇒ Permission
constructor
A new instance of Permission.
Constructor Details
#initialize(owner_email: nil, owner_id: nil, owner_name: nil, owner_picture_url: nil, owner_status: nil, owner_type: nil, created: nil) ⇒ Permission
Returns a new instance of Permission.
23 24 25 26 27 28 29 30 31 |
# File 'lib/corporate_holder/permission.rb', line 23 def initialize(owner_email: nil, owner_id: nil, owner_name: nil, owner_picture_url: nil, owner_status: nil, owner_type: nil, created: nil) @owner_email = owner_email @owner_id = owner_id @owner_name = owner_name @owner_picture_url = owner_picture_url @owner_status = owner_status @owner_type = owner_type @created = StarkCore::Utils::Checks.check_datetime(created) end |
Instance Attribute Details
#created ⇒ Object (readonly)
Returns the value of attribute created.
22 23 24 |
# File 'lib/corporate_holder/permission.rb', line 22 def created @created end |
#owner_email ⇒ Object (readonly)
Returns the value of attribute owner_email.
22 23 24 |
# File 'lib/corporate_holder/permission.rb', line 22 def owner_email @owner_email end |
#owner_id ⇒ Object (readonly)
Returns the value of attribute owner_id.
22 23 24 |
# File 'lib/corporate_holder/permission.rb', line 22 def owner_id @owner_id end |
#owner_name ⇒ Object (readonly)
Returns the value of attribute owner_name.
22 23 24 |
# File 'lib/corporate_holder/permission.rb', line 22 def owner_name @owner_name end |
#owner_picture_url ⇒ Object (readonly)
Returns the value of attribute owner_picture_url.
22 23 24 |
# File 'lib/corporate_holder/permission.rb', line 22 def owner_picture_url @owner_picture_url end |
#owner_status ⇒ Object (readonly)
Returns the value of attribute owner_status.
22 23 24 |
# File 'lib/corporate_holder/permission.rb', line 22 def owner_status @owner_status end |
#owner_type ⇒ Object (readonly)
Returns the value of attribute owner_type.
22 23 24 |
# File 'lib/corporate_holder/permission.rb', line 22 def owner_type @owner_type end |
Class Method Details
.parse_permissions(permissions) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/corporate_holder/permission.rb', line 33 def self.() resource_maker = StarkBank::CorporateHolder::Permission.resource[:resource_maker] return if .nil? = [] .each do || unless .is_a? Permission = StarkCore::Utils::API.from_api_json(resource_maker, ) end << end return end |
.resource ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/corporate_holder/permission.rb', line 47 def self.resource { resource_name: 'Permission', resource_maker: proc { |json| Permission.new( owner_email: json['owner_email'], owner_id: json['owner_id'], owner_name: json['owner_name'], owner_picture_url: json['owner_picture_url'], owner_status: json['owner_status'], owner_type: json['owner_type'], created: json['created'], ) } } end |