Class: ThePlaidApi::CraIncomeStreamInsights

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

Overview

Modeled insights for a given income stream.

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(income_category:, pay_frequency:, income_provider:, status:, next_payment:, additional_properties: nil) ⇒ CraIncomeStreamInsights

Returns a new instance of CraIncomeStreamInsights.



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/the_plaid_api/models/cra_income_stream_insights.rb', line 64

def initialize(income_category:, pay_frequency:, income_provider:, status:,
               next_payment:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @income_category = income_category
  @pay_frequency = pay_frequency
  @income_provider = income_provider
  @status = status
  @next_payment = next_payment
  @additional_properties = additional_properties
end

Instance Attribute Details

#income_categoryCraIncomeCategory

The income category for a given stream. The streams returned in the response will be filtered based on these primary and secondary income categories. See the [Income V2 Category Taxonomy](plaid.com/documents/income-v2-category-taxonomy.csv) for a full list of income categories.

Returns:



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

def income_category
  @income_category
end

#income_providerCraBankIncomeIncomeProvider

The object containing data about the income provider.



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

def income_provider
  @income_provider
end

#next_paymentCraIncomeNextPayment

Metadata of the income stream’s next payment.



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

def next_payment
  @next_payment
end

#pay_frequencyCreditBankIncomePayFrequency

The income pay frequency.



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

def pay_frequency
  @pay_frequency
end

#statusCraBankIncomeStatus

The status of the income sources. ‘ACTIVE`: The income source is active. `INACTIVE`: The income source is inactive. `UNKNOWN`: The income source status is unknown.

Returns:



34
35
36
# File 'lib/the_plaid_api/models/cra_income_stream_insights.rb', line 34

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/the_plaid_api/models/cra_income_stream_insights.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  income_category = CraIncomeCategory.from_hash(hash['income_category']) if
    hash['income_category']
  pay_frequency = hash.key?('pay_frequency') ? hash['pay_frequency'] : nil
  income_provider = CraBankIncomeIncomeProvider.from_hash(hash['income_provider']) if
    hash['income_provider']
  status = hash.key?('status') ? hash['status'] : nil
  next_payment = CraIncomeNextPayment.from_hash(hash['next_payment']) if hash['next_payment']

  # 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.
  CraIncomeStreamInsights.new(income_category: income_category,
                              pay_frequency: pay_frequency,
                              income_provider: income_provider,
                              status: status,
                              next_payment: next_payment,
                              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
# File 'lib/the_plaid_api/models/cra_income_stream_insights.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['income_category'] = 'income_category'
  @_hash['pay_frequency'] = 'pay_frequency'
  @_hash['income_provider'] = 'income_provider'
  @_hash['status'] = 'status'
  @_hash['next_payment'] = 'next_payment'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
60
61
62
# File 'lib/the_plaid_api/models/cra_income_stream_insights.rb', line 57

def self.nullables
  %w[
    income_provider
    next_payment
  ]
end

.optionalsObject

An array for optional fields



52
53
54
# File 'lib/the_plaid_api/models/cra_income_stream_insights.rb', line 52

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
120
121
# File 'lib/the_plaid_api/models/cra_income_stream_insights.rb', line 115

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} income_category: #{@income_category.inspect}, pay_frequency:"\
  " #{@pay_frequency.inspect}, income_provider: #{@income_provider.inspect}, status:"\
  " #{@status.inspect}, next_payment: #{@next_payment.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
# File 'lib/the_plaid_api/models/cra_income_stream_insights.rb', line 107

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} income_category: #{@income_category}, pay_frequency: #{@pay_frequency},"\
  " income_provider: #{@income_provider}, status: #{@status}, next_payment: #{@next_payment},"\
  " additional_properties: #{@additional_properties}>"
end