Class: ThePlaidApi::LinkSessionCraUpdateResult

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

Overview

The details of a Plaid Check Item update via Update Mode in Link.

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:, accounts:, institution:, additional_properties: nil) ⇒ LinkSessionCraUpdateResult

Returns a new instance of LinkSessionCraUpdateResult.



50
51
52
53
54
55
56
57
58
59
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 50

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

  @item_id = item_id
  @accounts = accounts
  @institution = institution
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountsArray[LinkSessionSuccessMetadataAccount]

A list of accounts attached to the connected Item. If Account Select is enabled via the developer dashboard, ‘accounts` will only include selected accounts.



22
23
24
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 22

def accounts
  @accounts
end

#institutionLinkSessionSuccessMetadataInstitution

An institution object. If the Item was created via Same-Day or Instant micro-deposit verification, will be ‘null`.



27
28
29
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 27

def institution
  @institution
end

#item_idString

The Plaid Check 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. The `item_id` is case-sensitive.

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 16

def item_id
  @item_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  item_id = hash.key?('item_id') ? hash['item_id'] : nil
  # Parameter is an array, so we need to iterate through it
  accounts = nil
  unless hash['accounts'].nil?
    accounts = []
    hash['accounts'].each do |structure|
      accounts << (LinkSessionSuccessMetadataAccount.from_hash(structure) if structure)
    end
  end

  accounts = nil unless hash.key?('accounts')
  institution = LinkSessionSuccessMetadataInstitution.from_hash(hash['institution']) if
    hash['institution']

  # 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.
  LinkSessionCraUpdateResult.new(item_id: item_id,
                                 accounts: accounts,
                                 institution: institution,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 30

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

.nullablesObject

An array for nullable fields



44
45
46
47
48
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 44

def self.nullables
  %w[
    institution
  ]
end

.optionalsObject

An array for optional fields



39
40
41
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 39

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



102
103
104
105
106
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 102

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

#to_sObject

Provides a human-readable string representation of the object.



95
96
97
98
99
# File 'lib/the_plaid_api/models/link_session_cra_update_result.rb', line 95

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