Class: ThePlaidApi::ExpenditureInsights
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::ExpenditureInsights
- Defined in:
- lib/the_plaid_api/models/expenditure_insights.rb
Overview
Comprehensive analysis of spending patterns, categorizing expenses into essential, non-essential, and other categories.
Instance Attribute Summary collapse
-
#cash_flow ⇒ AmountWithCurrencyWithMonthlyAverage
Net cash flow for the period (inflows minus outflows), including a monthly average.
-
#essential_expenditure ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
-
#non_essential_expenditure ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
-
#other ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
-
#outlier_transactions ⇒ OutlierTransactionsInsights
Insights into unusually large transactions that exceed typical spending patterns for the account.
-
#total_expenditure ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
-
#transfers_out ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
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(cash_flow: SKIP, total_expenditure: SKIP, essential_expenditure: SKIP, non_essential_expenditure: SKIP, other: SKIP, transfers_out: SKIP, outlier_transactions: SKIP, additional_properties: nil) ⇒ ExpenditureInsights
constructor
A new instance of ExpenditureInsights.
-
#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(cash_flow: SKIP, total_expenditure: SKIP, essential_expenditure: SKIP, non_essential_expenditure: SKIP, other: SKIP, transfers_out: SKIP, outlier_transactions: SKIP, additional_properties: nil) ⇒ ExpenditureInsights
Returns a new instance of ExpenditureInsights.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 87 def initialize(cash_flow: SKIP, total_expenditure: SKIP, essential_expenditure: SKIP, non_essential_expenditure: SKIP, other: SKIP, transfers_out: SKIP, outlier_transactions: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @cash_flow = cash_flow unless cash_flow == SKIP @total_expenditure = total_expenditure unless total_expenditure == SKIP @essential_expenditure = essential_expenditure unless essential_expenditure == SKIP unless non_essential_expenditure == SKIP @non_essential_expenditure = non_essential_expenditure end @other = other unless other == SKIP @transfers_out = transfers_out unless transfers_out == SKIP @outlier_transactions = outlier_transactions unless outlier_transactions == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#cash_flow ⇒ AmountWithCurrencyWithMonthlyAverage
Net cash flow for the period (inflows minus outflows), including a monthly average.
16 17 18 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 16 def cash_flow @cash_flow end |
#essential_expenditure ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
26 27 28 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 26 def essential_expenditure @essential_expenditure end |
#non_essential_expenditure ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
31 32 33 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 31 def non_essential_expenditure @non_essential_expenditure end |
#other ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
36 37 38 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 36 def other @other end |
#outlier_transactions ⇒ OutlierTransactionsInsights
Insights into unusually large transactions that exceed typical spending patterns for the account.
46 47 48 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 46 def outlier_transactions @outlier_transactions end |
#total_expenditure ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
21 22 23 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 21 def total_expenditure @total_expenditure end |
#transfers_out ⇒ ExpenditureSummary
Summary statistics for a specific expenditure category, including total amount, monthly average, and percentage of income.
41 42 43 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 41 def transfers_out @transfers_out end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 137 138 139 140 141 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 108 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. cash_flow = AmountWithCurrencyWithMonthlyAverage.from_hash(hash['cash_flow']) if hash['cash_flow'] total_expenditure = ExpenditureSummary.from_hash(hash['total_expenditure']) if hash['total_expenditure'] essential_expenditure = ExpenditureSummary.from_hash(hash['essential_expenditure']) if hash['essential_expenditure'] non_essential_expenditure = ExpenditureSummary.from_hash(hash['non_essential_expenditure']) if hash['non_essential_expenditure'] other = ExpenditureSummary.from_hash(hash['other']) if hash['other'] transfers_out = ExpenditureSummary.from_hash(hash['transfers_out']) if hash['transfers_out'] outlier_transactions = OutlierTransactionsInsights.from_hash(hash['outlier_transactions']) if hash['outlier_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. ExpenditureInsights.new(cash_flow: cash_flow, total_expenditure: total_expenditure, essential_expenditure: essential_expenditure, non_essential_expenditure: non_essential_expenditure, other: other, transfers_out: transfers_out, outlier_transactions: outlier_transactions, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['cash_flow'] = 'cash_flow' @_hash['total_expenditure'] = 'total_expenditure' @_hash['essential_expenditure'] = 'essential_expenditure' @_hash['non_essential_expenditure'] = 'non_essential_expenditure' @_hash['other'] = 'other' @_hash['transfers_out'] = 'transfers_out' @_hash['outlier_transactions'] = 'outlier_transactions' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 75 def self.nullables %w[ cash_flow total_expenditure essential_expenditure non_essential_expenditure other transfers_out outlier_transactions ] end |
.optionals ⇒ Object
An array for optional fields
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 62 def self.optionals %w[ cash_flow total_expenditure essential_expenditure non_essential_expenditure other transfers_out outlier_transactions ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
154 155 156 157 158 159 160 161 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 154 def inspect class_name = self.class.name.split('::').last "<#{class_name} cash_flow: #{@cash_flow.inspect}, total_expenditure:"\ " #{@total_expenditure.inspect}, essential_expenditure: #{@essential_expenditure.inspect},"\ " non_essential_expenditure: #{@non_essential_expenditure.inspect}, other:"\ " #{@other.inspect}, transfers_out: #{@transfers_out.inspect}, outlier_transactions:"\ " #{@outlier_transactions.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
144 145 146 147 148 149 150 151 |
# File 'lib/the_plaid_api/models/expenditure_insights.rb', line 144 def to_s class_name = self.class.name.split('::').last "<#{class_name} cash_flow: #{@cash_flow}, total_expenditure: #{@total_expenditure},"\ " essential_expenditure: #{@essential_expenditure}, non_essential_expenditure:"\ " #{@non_essential_expenditure}, other: #{@other}, transfers_out: #{@transfers_out},"\ " outlier_transactions: #{@outlier_transactions}, additional_properties:"\ " #{@additional_properties}>" end |