Class: ThePlaidApi::CreditBankIncome

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

Overview

The report of the Bank Income data for an end user.

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_id: SKIP, generated_time: SKIP, days_requested: SKIP, items: SKIP, bank_income_summary: SKIP, warnings: SKIP, additional_properties: nil) ⇒ CreditBankIncome

Returns a new instance of CreditBankIncome.



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

def initialize(bank_income_id: SKIP, generated_time: SKIP,
               days_requested: SKIP, items: SKIP, bank_income_summary: SKIP,
               warnings: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @bank_income_id = bank_income_id unless bank_income_id == SKIP
  @generated_time = generated_time unless generated_time == SKIP
  @days_requested = days_requested unless days_requested == SKIP
  @items = items unless items == SKIP
  @bank_income_summary = bank_income_summary unless bank_income_summary == SKIP
  @warnings = warnings unless warnings == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bank_income_idString

The unique identifier associated with the Bank Income Report.

Returns:

  • (String)


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

def bank_income_id
  @bank_income_id
end

#bank_income_summaryCreditBankIncomeSummary

Summary for bank income across all income sources and items (max history of 730 days).



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

def bank_income_summary
  @bank_income_summary
end

#days_requestedInteger

The number of days requested by the customer for the report.

Returns:

  • (Integer)


23
24
25
# File 'lib/the_plaid_api/models/credit_bank_income.rb', line 23

def days_requested
  @days_requested
end

#generated_timeDateTime

The time when the report was generated.

Returns:

  • (DateTime)


19
20
21
# File 'lib/the_plaid_api/models/credit_bank_income.rb', line 19

def generated_time
  @generated_time
end

#itemsArray[CreditBankIncomeItem]

The list of Items in the report along with the associated metadata about the Item.

Returns:



28
29
30
# File 'lib/the_plaid_api/models/credit_bank_income.rb', line 28

def items
  @items
end

#warningsArray[CreditBankIncomeWarning]

If data from the report was unable to be retrieved, the warnings will contain information about the error that caused the data to be incomplete.

Returns:



38
39
40
# File 'lib/the_plaid_api/models/credit_bank_income.rb', line 38

def warnings
  @warnings
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
136
# File 'lib/the_plaid_api/models/credit_bank_income.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  bank_income_id =
    hash.key?('bank_income_id') ? hash['bank_income_id'] : SKIP
  generated_time = if hash.key?('generated_time')
                     (DateTimeHelper.from_rfc3339(hash['generated_time']) if hash['generated_time'])
                   else
                     SKIP
                   end
  days_requested =
    hash.key?('days_requested') ? hash['days_requested'] : SKIP
  # Parameter is an array, so we need to iterate through it
  items = nil
  unless hash['items'].nil?
    items = []
    hash['items'].each do |structure|
      items << (CreditBankIncomeItem.from_hash(structure) if structure)
    end
  end

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

  warnings = SKIP unless hash.key?('warnings')

  # 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.
  CreditBankIncome.new(bank_income_id: bank_income_id,
                       generated_time: generated_time,
                       days_requested: days_requested,
                       items: items,
                       bank_income_summary: bank_income_summary,
                       warnings: warnings,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['bank_income_id'] = 'bank_income_id'
  @_hash['generated_time'] = 'generated_time'
  @_hash['days_requested'] = 'days_requested'
  @_hash['items'] = 'items'
  @_hash['bank_income_summary'] = 'bank_income_summary'
  @_hash['warnings'] = 'warnings'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/the_plaid_api/models/credit_bank_income.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    bank_income_id
    generated_time
    days_requested
    items
    bank_income_summary
    warnings
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} bank_income_id: #{@bank_income_id.inspect}, generated_time:"\
  " #{@generated_time.inspect}, days_requested: #{@days_requested.inspect}, items:"\
  " #{@items.inspect}, bank_income_summary: #{@bank_income_summary.inspect}, warnings:"\
  " #{@warnings.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_generated_timeObject



138
139
140
# File 'lib/the_plaid_api/models/credit_bank_income.rb', line 138

def to_custom_generated_time
  DateTimeHelper.to_rfc3339(generated_time)
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} bank_income_id: #{@bank_income_id}, generated_time: #{@generated_time},"\
  " days_requested: #{@days_requested}, items: #{@items}, bank_income_summary:"\
  " #{@bank_income_summary}, warnings: #{@warnings}, additional_properties:"\
  " #{@additional_properties}>"
end