Class: ThePlaidApi::CraEmploymentRefreshReportAccount

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

Overview

Employment Refresh Report information about an account.

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(account_id:, name:, official_name:, type:, subtype:, transactions:, additional_properties: nil) ⇒ CraEmploymentRefreshReportAccount

Returns a new instance of CraEmploymentRefreshReportAccount.



82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 82

def initialize(account_id:, name:, official_name:, type:, subtype:,
               transactions:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id = 
  @name = name
  @official_name = official_name
  @type = type
  @subtype = subtype
  @transactions = transactions
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

Plaid’s unique identifier for the account. This value will not change unless Plaid can’t reconcile the account with the data returned by the financial institution. This may occur, for example, when the name of the account changes. If this happens a new ‘account_id` will be assigned to the account. If an account with a specific `account_id` disappears instead of changing, the account is likely closed. Closed accounts are not returned by the Plaid API. Like all Plaid identifiers, the `account_id` is case sensitive.

Returns:

  • (String)


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

def 
  @account_id
end

#nameString

The name of the account, either assigned by the user or by the financial institution itself.

Returns:

  • (String)


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

def name
  @name
end

#official_nameString

The official name of the account as given by the financial institution.

Returns:

  • (String)


31
32
33
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 31

def official_name
  @official_name
end

#subtypeAccountSubtype

See the [Account type schema](plaid.com/docs/api/accounts/#account-type-schema) for a full listing of account types and corresponding subtypes.

Returns:



49
50
51
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 49

def subtype
  @subtype
end

#transactionsArray[CraEmploymentRefreshReportTransaction]

Transaction history associated with the account for the Employment Refresh Report. Note that this transaction differs from a Base Report transaction in that it will only be deposits, and the amounts will be omitted.



55
56
57
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 55

def transactions
  @transactions
end

#typeAccountType

‘investment:` Investment account. In API versions 2018-05-22 and earlier, this type is called `brokerage` instead. `credit:` Credit card `depository:` Depository account `loan:` Loan account `other:` Non-specified account type See the [Account type schema](plaid.com/docs/api/accounts#account-type-schema) for a full listing of account types and corresponding subtypes.

Returns:



43
44
45
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 43

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_id') ? hash['account_id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  official_name = hash.key?('official_name') ? hash['official_name'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  subtype = hash.key?('subtype') ? hash['subtype'] : nil
  # Parameter is an array, so we need to iterate through it
  transactions = nil
  unless hash['transactions'].nil?
    transactions = []
    hash['transactions'].each do |structure|
      transactions << (CraEmploymentRefreshReportTransaction.from_hash(structure) if structure)
    end
  end

  transactions = nil unless hash.key?('transactions')

  # 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.
  CraEmploymentRefreshReportAccount.new(account_id: ,
                                        name: name,
                                        official_name: official_name,
                                        type: type,
                                        subtype: subtype,
                                        transactions: transactions,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
67
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['name'] = 'name'
  @_hash['official_name'] = 'official_name'
  @_hash['type'] = 'type'
  @_hash['subtype'] = 'subtype'
  @_hash['transactions'] = 'transactions'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    official_name
    subtype
  ]
end

.optionalsObject

An array for optional fields



70
71
72
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 70

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



143
144
145
146
147
148
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 143

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, name: #{@name.inspect}, official_name:"\
  " #{@official_name.inspect}, type: #{@type.inspect}, subtype: #{@subtype.inspect},"\
  " transactions: #{@transactions.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



135
136
137
138
139
140
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_account.rb', line 135

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, name: #{@name}, official_name:"\
  " #{@official_name}, type: #{@type}, subtype: #{@subtype}, transactions: #{@transactions},"\
  " additional_properties: #{@additional_properties}>"
end