Class: ThePlaidApi::UserAccountItem

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/user_account_item.rb

Overview

An Item created during a Layer authorization session.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(item_id: SKIP, access_token: SKIP, additional_properties: nil) ⇒ UserAccountItem

Returns a new instance of UserAccountItem.



44
45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/user_account_item.rb', line 44

def initialize(item_id: SKIP, access_token: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @item_id = item_id unless item_id == SKIP
  @access_token = access_token unless access_token == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#access_tokenString

The access token associated with the Item data is being requested for.

Returns:

  • (String)


21
22
23
# File 'lib/the_plaid_api/models/user_account_item.rb', line 21

def access_token
  @access_token
end

#item_idString

The Plaid Item ID. The ‘item_id` is always unique; linking the same account at the same institution twice will result in two Items with different `item_id` values. Like all Plaid identifiers, the `item_id` is case-sensitive.

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/user_account_item.rb', line 17

def item_id
  @item_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/the_plaid_api/models/user_account_item.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  item_id = hash.key?('item_id') ? hash['item_id'] : SKIP
  access_token = hash.key?('access_token') ? hash['access_token'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  UserAccountItem.new(item_id: item_id,
                      access_token: access_token,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



24
25
26
27
28
29
# File 'lib/the_plaid_api/models/user_account_item.rb', line 24

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['item_id'] = 'item_id'
  @_hash['access_token'] = 'access_token'
  @_hash
end

.nullablesObject

An array for nullable fields



40
41
42
# File 'lib/the_plaid_api/models/user_account_item.rb', line 40

def self.nullables
  []
end

.optionalsObject

An array for optional fields



32
33
34
35
36
37
# File 'lib/the_plaid_api/models/user_account_item.rb', line 32

def self.optionals
  %w[
    item_id
    access_token
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



83
84
85
86
87
# File 'lib/the_plaid_api/models/user_account_item.rb', line 83

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id.inspect}, access_token: #{@access_token.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



76
77
78
79
80
# File 'lib/the_plaid_api/models/user_account_item.rb', line 76

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id}, access_token: #{@access_token},"\
  " additional_properties: #{@additional_properties}>"
end