Class: ThePlaidApi::CraIncomeStream
- Defined in:
- lib/the_plaid_api/models/cra_income_stream.rb
Overview
An income stream detected for the user.
Instance Attribute Summary collapse
-
#description ⇒ String
The most common name or original description for the underlying income transactions.
-
#end_date ⇒ Date
Maximum of all dates within the specific income stream for days requested by the client.
-
#income_metrics ⇒ CraIncomeMetrics
Modeled income metrics for a given income stream or user summary.
-
#income_stream_id ⇒ String
A unique identifier for an income stream.
-
#insights ⇒ CraIncomeStreamInsights
Modeled insights for a given income stream.
-
#start_date ⇒ Date
Minimum of all dates within the specific income stream for days requested by the client.
-
#transactions ⇒ Array[CraIncomeTransaction]
The transactions data for the income stream ordered by ascending date.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(income_stream_id:, start_date:, end_date:, description:, insights:, income_metrics:, transactions:, additional_properties: nil) ⇒ CraIncomeStream
constructor
A new instance of CraIncomeStream.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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_stream_id:, start_date:, end_date:, description:, insights:, income_metrics:, transactions:, additional_properties: nil) ⇒ CraIncomeStream
Returns a new instance of CraIncomeStream.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 70 def initialize(income_stream_id:, start_date:, end_date:, description:, insights:, income_metrics:, transactions:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @income_stream_id = income_stream_id @start_date = start_date @end_date = end_date @description = description @insights = insights @income_metrics = income_metrics @transactions = transactions @additional_properties = additional_properties end |
Instance Attribute Details
#description ⇒ String
The most common name or original description for the underlying income transactions.
33 34 35 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 33 def description @description end |
#end_date ⇒ Date
Maximum of all dates within the specific income stream for days requested by the client. The date will be returned in an ISO 8601 format (YYYY-MM-DD).
28 29 30 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 28 def end_date @end_date end |
#income_metrics ⇒ CraIncomeMetrics
Modeled income metrics for a given income stream or user summary.
41 42 43 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 41 def income_metrics @income_metrics end |
#income_stream_id ⇒ String
A unique identifier for an income stream. If the report is regenerated and a new ‘report_id` is created, the new report will have a new set of `income_stream_id`s.
16 17 18 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 16 def income_stream_id @income_stream_id end |
#insights ⇒ CraIncomeStreamInsights
Modeled insights for a given income stream.
37 38 39 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 37 def insights @insights end |
#start_date ⇒ Date
Minimum of all dates within the specific income stream for days requested by the client. The date will be returned in an ISO 8601 format (YYYY-MM-DD).
22 23 24 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 22 def start_date @start_date end |
#transactions ⇒ Array[CraIncomeTransaction]
The transactions data for the income stream ordered by ascending date.
45 46 47 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 45 def transactions @transactions end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 87 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. income_stream_id = hash.key?('income_stream_id') ? hash['income_stream_id'] : nil start_date = hash.key?('start_date') ? hash['start_date'] : nil end_date = hash.key?('end_date') ? hash['end_date'] : nil description = hash.key?('description') ? hash['description'] : nil insights = CraIncomeStreamInsights.from_hash(hash['insights']) if hash['insights'] income_metrics = CraIncomeMetrics.from_hash(hash['income_metrics']) if hash['income_metrics'] # Parameter is an array, so we need to iterate through it transactions = nil unless hash['transactions'].nil? transactions = [] hash['transactions'].each do |structure| transactions << (CraIncomeTransaction.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. CraIncomeStream.new(income_stream_id: income_stream_id, start_date: start_date, end_date: end_date, description: description, insights: insights, income_metrics: income_metrics, transactions: transactions, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 48 def self.names @_hash = {} if @_hash.nil? @_hash['income_stream_id'] = 'income_stream_id' @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash['description'] = 'description' @_hash['insights'] = 'insights' @_hash['income_metrics'] = 'income_metrics' @_hash['transactions'] = 'transactions' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 61 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
138 139 140 141 142 143 144 145 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 138 def inspect class_name = self.class.name.split('::').last "<#{class_name} income_stream_id: #{@income_stream_id.inspect}, start_date:"\ " #{@start_date.inspect}, end_date: #{@end_date.inspect}, description:"\ " #{@description.inspect}, insights: #{@insights.inspect}, income_metrics:"\ " #{@income_metrics.inspect}, transactions: #{@transactions.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
129 130 131 132 133 134 135 |
# File 'lib/the_plaid_api/models/cra_income_stream.rb', line 129 def to_s class_name = self.class.name.split('::').last "<#{class_name} income_stream_id: #{@income_stream_id}, start_date: #{@start_date},"\ " end_date: #{@end_date}, description: #{@description}, insights: #{@insights},"\ " income_metrics: #{@income_metrics}, transactions: #{@transactions}, additional_properties:"\ " #{@additional_properties}>" end |