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.



1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
# File 'lib/models/porcelain.rb', line 1188

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.



1178
1179
1180
# File 'lib/models/porcelain.rb', line 1178

def 
  @account_id
end

#idObject

Unique identifier of the AccountGrant.



1180
1181
1182
# File 'lib/models/porcelain.rb', line 1180

def id
  @id
end

#resource_idObject

The resource ID of this AccountGrant.



1182
1183
1184
# File 'lib/models/porcelain.rb', line 1182

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.



1184
1185
1186
# File 'lib/models/porcelain.rb', line 1184

def start_from
  @start_from
end

#valid_untilObject

The timestamp when the resource grant will expire.



1186
1187
1188
# File 'lib/models/porcelain.rb', line 1186

def valid_until
  @valid_until
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1202
1203
1204
1205
1206
1207
1208
# File 'lib/models/porcelain.rb', line 1202

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