Class: SDM::AccountGrant

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

AccountGrants connect a resource directly to an account, giving the account the permission to connect to that resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id: nil, id: nil, resource_id: nil, start_from: nil, valid_until: nil) ⇒ AccountGrant

Returns a new instance of AccountGrant.



635
636
637
638
639
640
641
642
643
644
645
646
647
# File 'lib/models/porcelain.rb', line 635

def initialize(
  account_id: nil,
  id: nil,
  resource_id: nil,
  start_from: nil,
  valid_until: nil
)
  @account_id =  == nil ? "" : 
  @id = id == nil ? "" : id
  @resource_id = resource_id == nil ? "" : resource_id
  @start_from = start_from == nil ? nil : start_from
  @valid_until = valid_until == nil ? nil : valid_until
end

Instance Attribute Details

#account_idObject

The id of the attached role of this AccountGrant.



623
624
625
# File 'lib/models/porcelain.rb', line 623

def 
  @account_id
end

#idObject

Unique identifier of the AccountGrant.



625
626
627
# File 'lib/models/porcelain.rb', line 625

def id
  @id
end

#resource_idObject

The id of the composite role of this AccountGrant.



627
628
629
# File 'lib/models/porcelain.rb', line 627

def resource_id
  @resource_id
end

#start_fromObject

The timestamp when the resource will be granted. Optional. Both start_at and end_at must be defined together, or not defined at all.



630
631
632
# File 'lib/models/porcelain.rb', line 630

def start_from
  @start_from
end

#valid_untilObject

The timestamp when the resource grant will expire. Optional. Both start_at and end_at must be defined together, or not defined at all.



633
634
635
# File 'lib/models/porcelain.rb', line 633

def valid_until
  @valid_until
end

Instance Method Details

#to_json(options = {}) ⇒ Object



649
650
651
652
653
654
655
# File 'lib/models/porcelain.rb', line 649

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end