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.



1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
# File 'lib/models/porcelain.rb', line 1100

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.



1090
1091
1092
# File 'lib/models/porcelain.rb', line 1090

def 
  @account_id
end

#idObject

Unique identifier of the AccountGrant.



1092
1093
1094
# File 'lib/models/porcelain.rb', line 1092

def id
  @id
end

#resource_idObject

The resource ID of this AccountGrant.



1094
1095
1096
# File 'lib/models/porcelain.rb', line 1094

def resource_id
  @resource_id
end

#start_fromObject

The timestamp when the resource will be granted. When creating an AccountGrant, if this field is not specified, it will default to the current time.



1096
1097
1098
# File 'lib/models/porcelain.rb', line 1096

def start_from
  @start_from
end

#valid_untilObject

The timestamp when the resource grant will expire.



1098
1099
1100
# File 'lib/models/porcelain.rb', line 1098

def valid_until
  @valid_until
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1114
1115
1116
1117
1118
1119
1120
# File 'lib/models/porcelain.rb', line 1114

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