Class: ThePlaidApi::CreditBankIncomeItem

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

Overview

The details and metadata for an end user’s Item.

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(bank_income_accounts: SKIP, bank_income_sources: SKIP, last_updated_time: SKIP, institution_id: SKIP, institution_name: SKIP, item_id: SKIP, additional_properties: nil) ⇒ CreditBankIncomeItem

Returns a new instance of CreditBankIncomeItem.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 68

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

  @bank_income_accounts = bank_income_accounts unless bank_income_accounts == SKIP
  @bank_income_sources = bank_income_sources unless bank_income_sources == SKIP
  @last_updated_time = last_updated_time unless last_updated_time == SKIP
  @institution_id = institution_id unless institution_id == SKIP
  @institution_name = institution_name unless institution_name == SKIP
  @item_id = item_id unless item_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bank_income_accountsArray[CreditBankIncomeAccount]

The Item’s accounts that have Bank Income data.

Returns:



15
16
17
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 15

def bank_income_accounts
  @bank_income_accounts
end

#bank_income_sourcesArray[CreditBankIncomeSource]

The income sources for this Item. Each entry in the array is a single income source.

Returns:



20
21
22
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 20

def bank_income_sources
  @bank_income_sources
end

#institution_idString

The unique identifier of the institution associated with the Item.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 29

def institution_id
  @institution_id
end

#institution_nameString

The name of the institution associated with the Item.

Returns:

  • (String)


33
34
35
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 33

def institution_name
  @institution_name
end

#item_idString

The unique identifier for the Item.

Returns:

  • (String)


37
38
39
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 37

def item_id
  @item_id
end

#last_updated_timeDateTime

The time when this Item’s data was last retrieved from the financial institution.

Returns:

  • (DateTime)


25
26
27
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 25

def last_updated_time
  @last_updated_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
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
133
134
135
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 85

def self.from_hash(hash)
  return nil unless hash

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

  bank_income_accounts = SKIP unless hash.key?('bank_income_accounts')
  # Parameter is an array, so we need to iterate through it
  bank_income_sources = nil
  unless hash['bank_income_sources'].nil?
    bank_income_sources = []
    hash['bank_income_sources'].each do |structure|
      bank_income_sources << (CreditBankIncomeSource.from_hash(structure) if structure)
    end
  end

  bank_income_sources = SKIP unless hash.key?('bank_income_sources')
  last_updated_time = if hash.key?('last_updated_time')
                        (DateTimeHelper.from_rfc3339(hash['last_updated_time']) if hash['last_updated_time'])
                      else
                        SKIP
                      end
  institution_id =
    hash.key?('institution_id') ? hash['institution_id'] : SKIP
  institution_name =
    hash.key?('institution_name') ? hash['institution_name'] : SKIP
  item_id = hash.key?('item_id') ? hash['item_id'] : 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.
  CreditBankIncomeItem.new(bank_income_accounts: bank_income_accounts,
                           bank_income_sources: bank_income_sources,
                           last_updated_time: last_updated_time,
                           institution_id: institution_id,
                           institution_name: institution_name,
                           item_id: item_id,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['bank_income_accounts'] = 'bank_income_accounts'
  @_hash['bank_income_sources'] = 'bank_income_sources'
  @_hash['last_updated_time'] = 'last_updated_time'
  @_hash['institution_id'] = 'institution_id'
  @_hash['institution_name'] = 'institution_name'
  @_hash['item_id'] = 'item_id'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
60
61
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 52

def self.optionals
  %w[
    bank_income_accounts
    bank_income_sources
    last_updated_time
    institution_id
    institution_name
    item_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



151
152
153
154
155
156
157
158
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 151

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

#to_custom_last_updated_timeObject



137
138
139
# File 'lib/the_plaid_api/models/credit_bank_income_item.rb', line 137

def to_custom_last_updated_time
  DateTimeHelper.to_rfc3339(last_updated_time)
end

#to_sObject

Provides a human-readable string representation of the object.



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

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