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.



651
652
653
654
655
656
657
658
659
660
661
662
663
# File 'lib/models/porcelain.rb', line 651

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 account id of this AccountGrant.



639
640
641
# File 'lib/models/porcelain.rb', line 639

def 
  @account_id
end

#idObject

Unique identifier of the AccountGrant.



641
642
643
# File 'lib/models/porcelain.rb', line 641

def id
  @id
end

#resource_idObject

The resource id of this AccountGrant.



643
644
645
# File 'lib/models/porcelain.rb', line 643

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.



646
647
648
# File 'lib/models/porcelain.rb', line 646

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.



649
650
651
# File 'lib/models/porcelain.rb', line 649

def valid_until
  @valid_until
end

Instance Method Details

#to_json(options = {}) ⇒ Object



665
666
667
668
669
670
671
# File 'lib/models/porcelain.rb', line 665

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