Class: ThePlaidApi::CounterpartyInsights
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::CounterpartyInsights
- Defined in:
- lib/the_plaid_api/models/counterparty_insights.rb
Overview
Insights around a user’s counterparties
Instance Attribute Summary collapse
-
#financial_institution_insights ⇒ Array[FinancialInstitutionInsights]
Insights related to a user’s transactions with other financial institutions, including detected account types.
-
#merchant_insights ⇒ Array[MerchantInsights]
Insights about a user’s top merchants, ranked by spend.
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(financial_institution_insights: SKIP, merchant_insights: SKIP, additional_properties: nil) ⇒ CounterpartyInsights
constructor
A new instance of CounterpartyInsights.
-
#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(financial_institution_insights: SKIP, merchant_insights: SKIP, additional_properties: nil) ⇒ CounterpartyInsights
Returns a new instance of CounterpartyInsights.
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/the_plaid_api/models/counterparty_insights.rb', line 43 def initialize(financial_institution_insights: SKIP, merchant_insights: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? unless financial_institution_insights == SKIP @financial_institution_insights = financial_institution_insights end @merchant_insights = merchant_insights unless merchant_insights == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#financial_institution_insights ⇒ Array[FinancialInstitutionInsights]
Insights related to a user’s transactions with other financial institutions, including detected account types.
15 16 17 |
# File 'lib/the_plaid_api/models/counterparty_insights.rb', line 15 def financial_institution_insights @financial_institution_insights end |
#merchant_insights ⇒ Array[MerchantInsights]
Insights about a user’s top merchants, ranked by spend.
19 20 21 |
# File 'lib/the_plaid_api/models/counterparty_insights.rb', line 19 def merchant_insights @merchant_insights end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/the_plaid_api/models/counterparty_insights.rb', line 57 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 financial_institution_insights = nil unless hash['financial_institution_insights'].nil? financial_institution_insights = [] hash['financial_institution_insights'].each do |structure| financial_institution_insights << (FinancialInstitutionInsights.from_hash(structure) if structure) end end financial_institution_insights = SKIP unless hash.key?('financial_institution_insights') # Parameter is an array, so we need to iterate through it merchant_insights = nil unless hash['merchant_insights'].nil? merchant_insights = [] hash['merchant_insights'].each do |structure| merchant_insights << (MerchantInsights.from_hash(structure) if structure) end end merchant_insights = SKIP unless hash.key?('merchant_insights') # 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. CounterpartyInsights.new(financial_institution_insights: financial_institution_insights, merchant_insights: merchant_insights, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 28 |
# File 'lib/the_plaid_api/models/counterparty_insights.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['financial_institution_insights'] = 'financial_institution_insights' @_hash['merchant_insights'] = 'merchant_insights' @_hash end |
.nullables ⇒ Object
An array for nullable fields
39 40 41 |
# File 'lib/the_plaid_api/models/counterparty_insights.rb', line 39 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
31 32 33 34 35 36 |
# File 'lib/the_plaid_api/models/counterparty_insights.rb', line 31 def self.optionals %w[ financial_institution_insights merchant_insights ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
104 105 106 107 108 109 |
# File 'lib/the_plaid_api/models/counterparty_insights.rb', line 104 def inspect class_name = self.class.name.split('::').last "<#{class_name} financial_institution_insights: #{@financial_institution_insights.inspect},"\ " merchant_insights: #{@merchant_insights.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
96 97 98 99 100 101 |
# File 'lib/the_plaid_api/models/counterparty_insights.rb', line 96 def to_s class_name = self.class.name.split('::').last "<#{class_name} financial_institution_insights: #{@financial_institution_insights},"\ " merchant_insights: #{@merchant_insights}, additional_properties:"\ " #{@additional_properties}>" end |