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.



609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/models/porcelain.rb', line 609

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.



597
598
599
# File 'lib/models/porcelain.rb', line 597

def 
  @account_id
end

#idObject

Unique identifier of the AccountGrant.



599
600
601
# File 'lib/models/porcelain.rb', line 599

def id
  @id
end

#resource_idObject

The id of the composite role of this AccountGrant.



601
602
603
# File 'lib/models/porcelain.rb', line 601

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.



604
605
606
# File 'lib/models/porcelain.rb', line 604

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.



607
608
609
# File 'lib/models/porcelain.rb', line 607

def valid_until
  @valid_until
end

Instance Method Details

#to_json(options = {}) ⇒ Object



623
624
625
626
627
628
629
# File 'lib/models/porcelain.rb', line 623

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