Class: ThePlaidApi::TransactionsUserInsightsGetResponse

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

Overview

TransactionsUserInsightsGetResponse defines the response schema for ‘/beta/transactions/user_insights/v1/get`.

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(user_data_overview:, counterparty_insights: SKIP, category_insights: SKIP, recurring_transactions: SKIP, additional_properties: nil) ⇒ TransactionsUserInsightsGetResponse

Returns a new instance of TransactionsUserInsightsGetResponse.



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 55

def initialize(user_data_overview:, counterparty_insights: SKIP,
               category_insights: SKIP, recurring_transactions: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @user_data_overview = user_data_overview
  @counterparty_insights = counterparty_insights unless counterparty_insights == SKIP
  @category_insights = category_insights unless category_insights == SKIP
  @recurring_transactions = recurring_transactions unless recurring_transactions == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#category_insightsCategoryInsights

Insights on a user’s top personal finance categories.

Returns:



24
25
26
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 24

def category_insights
  @category_insights
end

#counterparty_insightsCounterpartyInsights

Insights around a user’s counterparties



20
21
22
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 20

def counterparty_insights
  @counterparty_insights
end

#recurring_transactionsRecurringTransactions

Insights object for recurring transactions for ‘/beta/transactions/user_insights/v1/get` endpoint



29
30
31
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 29

def recurring_transactions
  @recurring_transactions
end

#user_data_overviewUserDataOverview

metadata for the set of insights provided in ‘TransactionsUserInsightsGetResponse`

Returns:



16
17
18
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 16

def user_data_overview
  @user_data_overview
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
94
95
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  user_data_overview = UserDataOverview.from_hash(hash['user_data_overview']) if
    hash['user_data_overview']
  counterparty_insights = CounterpartyInsights.from_hash(hash['counterparty_insights']) if
    hash['counterparty_insights']
  category_insights = CategoryInsights.from_hash(hash['category_insights']) if
    hash['category_insights']
  recurring_transactions = RecurringTransactions.from_hash(hash['recurring_transactions']) if
    hash['recurring_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.
  TransactionsUserInsightsGetResponse.new(user_data_overview: user_data_overview,
                                          counterparty_insights: counterparty_insights,
                                          category_insights: category_insights,
                                          recurring_transactions: recurring_transactions,
                                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['user_data_overview'] = 'user_data_overview'
  @_hash['counterparty_insights'] = 'counterparty_insights'
  @_hash['category_insights'] = 'category_insights'
  @_hash['recurring_transactions'] = 'recurring_transactions'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
48
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 42

def self.optionals
  %w[
    counterparty_insights
    category_insights
    recurring_transactions
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} user_data_overview: #{@user_data_overview.inspect}, counterparty_insights:"\
  " #{@counterparty_insights.inspect}, category_insights: #{@category_insights.inspect},"\
  " recurring_transactions: #{@recurring_transactions.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



98
99
100
101
102
103
104
# File 'lib/the_plaid_api/models/transactions_user_insights_get_response.rb', line 98

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} user_data_overview: #{@user_data_overview}, counterparty_insights:"\
  " #{@counterparty_insights}, category_insights: #{@category_insights},"\
  " recurring_transactions: #{@recurring_transactions}, additional_properties:"\
  " #{@additional_properties}>"
end