Class: ThePlaidApi::BaseReportUserAttributes

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

Overview

Calculated attributes derived from transaction-level data, aggregated across accounts.

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(nsf_overdraft_transactions_count: SKIP, nsf_overdraft_transactions_count_30d: SKIP, nsf_overdraft_transactions_count_60d: SKIP, nsf_overdraft_transactions_count_90d: SKIP, total_inflow_amount: SKIP, total_inflow_amount_30d: SKIP, total_inflow_amount_60d: SKIP, total_inflow_amount_90d: SKIP, total_outflow_amount: SKIP, total_outflow_amount_30d: SKIP, total_outflow_amount_60d: SKIP, total_outflow_amount_90d: SKIP, additional_properties: nil) ⇒ BaseReportUserAttributes

Returns a new instance of BaseReportUserAttributes.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 135

def initialize(nsf_overdraft_transactions_count: SKIP,
               nsf_overdraft_transactions_count_30d: SKIP,
               nsf_overdraft_transactions_count_60d: SKIP,
               nsf_overdraft_transactions_count_90d: SKIP,
               total_inflow_amount: SKIP, total_inflow_amount_30d: SKIP,
               total_inflow_amount_60d: SKIP, total_inflow_amount_90d: SKIP,
               total_outflow_amount: SKIP, total_outflow_amount_30d: SKIP,
               total_outflow_amount_60d: SKIP,
               total_outflow_amount_90d: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  unless nsf_overdraft_transactions_count == SKIP
    @nsf_overdraft_transactions_count =
      nsf_overdraft_transactions_count
  end
  unless nsf_overdraft_transactions_count_30d == SKIP
    @nsf_overdraft_transactions_count_30d =
      nsf_overdraft_transactions_count_30d
  end
  unless nsf_overdraft_transactions_count_60d == SKIP
    @nsf_overdraft_transactions_count_60d =
      nsf_overdraft_transactions_count_60d
  end
  unless nsf_overdraft_transactions_count_90d == SKIP
    @nsf_overdraft_transactions_count_90d =
      nsf_overdraft_transactions_count_90d
  end
  @total_inflow_amount = total_inflow_amount unless total_inflow_amount == SKIP
  @total_inflow_amount_30d = total_inflow_amount_30d unless total_inflow_amount_30d == SKIP
  @total_inflow_amount_60d = total_inflow_amount_60d unless total_inflow_amount_60d == SKIP
  @total_inflow_amount_90d = total_inflow_amount_90d unless total_inflow_amount_90d == SKIP
  @total_outflow_amount = total_outflow_amount unless total_outflow_amount == SKIP
  @total_outflow_amount_30d = total_outflow_amount_30d unless total_outflow_amount_30d == SKIP
  @total_outflow_amount_60d = total_outflow_amount_60d unless total_outflow_amount_60d == SKIP
  @total_outflow_amount_90d = total_outflow_amount_90d unless total_outflow_amount_90d == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#nsf_overdraft_transactions_countInteger

The number of net NSF fee transactions in the time range for the report (not counting any fees that were reversed within that time range).

Returns:

  • (Integer)


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

def nsf_overdraft_transactions_count
  @nsf_overdraft_transactions_count
end

#nsf_overdraft_transactions_count_30dInteger

The number of net NSF fee transactions in the last 30 days in the report (not counting any fees that were reversed within that time range).

Returns:

  • (Integer)


21
22
23
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 21

def nsf_overdraft_transactions_count_30d
  @nsf_overdraft_transactions_count_30d
end

#nsf_overdraft_transactions_count_60dInteger

The number of net NSF fee transactions in the last 60 days in the report (not counting any fees that were reversed within that time range).

Returns:

  • (Integer)


26
27
28
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 26

def nsf_overdraft_transactions_count_60d
  @nsf_overdraft_transactions_count_60d
end

#nsf_overdraft_transactions_count_90dInteger

The number of net NSF fee transactions in the last 90 days in the report (not counting any fees that were reversed within that time range).

Returns:

  • (Integer)


31
32
33
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 31

def nsf_overdraft_transactions_count_90d
  @nsf_overdraft_transactions_count_90d
end

#total_inflow_amountTotalReportInflowAmount

Total amount of debit transactions into the report’s accounts in the time period of the report. This field only takes into account USD transactions from the accounts.



37
38
39
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 37

def total_inflow_amount
  @total_inflow_amount
end

#total_inflow_amount_30dTotalReportInflowAmount30D

Total amount of debit transactions into the report’s accounts in the last 30 days. This field only takes into account USD transactions from the accounts.



43
44
45
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 43

def total_inflow_amount_30d
  @total_inflow_amount_30d
end

#total_inflow_amount_60dTotalReportInflowAmount60D

Total amount of debit transactions into the report’s accounts in the last 60 days. This field only takes into account USD transactions from the accounts.



49
50
51
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 49

def total_inflow_amount_60d
  @total_inflow_amount_60d
end

#total_inflow_amount_90dTotalReportInflowAmount90D

Total amount of debit transactions into the report’s account in the last 90 days. This field only takes into account USD transactions from the accounts.



55
56
57
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 55

def total_inflow_amount_90d
  @total_inflow_amount_90d
end

#total_outflow_amountTotalReportOutflowAmount

Total amount of credit transactions into the report’s accounts in the time period of the report. This field only takes into account USD transactions from the accounts.



61
62
63
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 61

def total_outflow_amount
  @total_outflow_amount
end

#total_outflow_amount_30dTotalReportOutflowAmount30D

Total amount of credit transactions into the report’s accounts in the last 30 days. This field only takes into account USD transactions from the accounts.



67
68
69
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 67

def total_outflow_amount_30d
  @total_outflow_amount_30d
end

#total_outflow_amount_60dTotalReportOutflowAmount60D

Total amount of credit transactions into the report’s accounts in the last 60 days. This field only takes into account USD transactions from the accounts.



73
74
75
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 73

def total_outflow_amount_60d
  @total_outflow_amount_60d
end

#total_outflow_amount_90dTotalReportOutflowAmount90D

Total amount of credit transactions into the report’s accounts in the last 90 days. This field only takes into account USD transactions from the accounts.



79
80
81
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 79

def total_outflow_amount_90d
  @total_outflow_amount_90d
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 175

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  nsf_overdraft_transactions_count =
    hash.key?('nsf_overdraft_transactions_count') ? hash['nsf_overdraft_transactions_count'] : SKIP
  nsf_overdraft_transactions_count_30d =
    hash.key?('nsf_overdraft_transactions_count_30d') ? hash['nsf_overdraft_transactions_count_30d'] : SKIP
  nsf_overdraft_transactions_count_60d =
    hash.key?('nsf_overdraft_transactions_count_60d') ? hash['nsf_overdraft_transactions_count_60d'] : SKIP
  nsf_overdraft_transactions_count_90d =
    hash.key?('nsf_overdraft_transactions_count_90d') ? hash['nsf_overdraft_transactions_count_90d'] : SKIP
  total_inflow_amount = TotalReportInflowAmount.from_hash(hash['total_inflow_amount']) if
    hash['total_inflow_amount']
  if hash['total_inflow_amount_30d']
    total_inflow_amount_30d = TotalReportInflowAmount30D.from_hash(hash['total_inflow_amount_30d'])
  end
  if hash['total_inflow_amount_60d']
    total_inflow_amount_60d = TotalReportInflowAmount60D.from_hash(hash['total_inflow_amount_60d'])
  end
  if hash['total_inflow_amount_90d']
    total_inflow_amount_90d = TotalReportInflowAmount90D.from_hash(hash['total_inflow_amount_90d'])
  end
  total_outflow_amount = TotalReportOutflowAmount.from_hash(hash['total_outflow_amount']) if
    hash['total_outflow_amount']
  if hash['total_outflow_amount_30d']
    total_outflow_amount_30d = TotalReportOutflowAmount30D.from_hash(hash['total_outflow_amount_30d'])
  end
  if hash['total_outflow_amount_60d']
    total_outflow_amount_60d = TotalReportOutflowAmount60D.from_hash(hash['total_outflow_amount_60d'])
  end
  if hash['total_outflow_amount_90d']
    total_outflow_amount_90d = TotalReportOutflowAmount90D.from_hash(hash['total_outflow_amount_90d'])
  end

  # 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.
  BaseReportUserAttributes.new(nsf_overdraft_transactions_count: nsf_overdraft_transactions_count,
                               nsf_overdraft_transactions_count_30d: nsf_overdraft_transactions_count_30d,
                               nsf_overdraft_transactions_count_60d: nsf_overdraft_transactions_count_60d,
                               nsf_overdraft_transactions_count_90d: nsf_overdraft_transactions_count_90d,
                               total_inflow_amount: total_inflow_amount,
                               total_inflow_amount_30d: total_inflow_amount_30d,
                               total_inflow_amount_60d: total_inflow_amount_60d,
                               total_inflow_amount_90d: total_inflow_amount_90d,
                               total_outflow_amount: total_outflow_amount,
                               total_outflow_amount_30d: total_outflow_amount_30d,
                               total_outflow_amount_60d: total_outflow_amount_60d,
                               total_outflow_amount_90d: total_outflow_amount_90d,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 82

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['nsf_overdraft_transactions_count'] =
    'nsf_overdraft_transactions_count'
  @_hash['nsf_overdraft_transactions_count_30d'] =
    'nsf_overdraft_transactions_count_30d'
  @_hash['nsf_overdraft_transactions_count_60d'] =
    'nsf_overdraft_transactions_count_60d'
  @_hash['nsf_overdraft_transactions_count_90d'] =
    'nsf_overdraft_transactions_count_90d'
  @_hash['total_inflow_amount'] = 'total_inflow_amount'
  @_hash['total_inflow_amount_30d'] = 'total_inflow_amount_30d'
  @_hash['total_inflow_amount_60d'] = 'total_inflow_amount_60d'
  @_hash['total_inflow_amount_90d'] = 'total_inflow_amount_90d'
  @_hash['total_outflow_amount'] = 'total_outflow_amount'
  @_hash['total_outflow_amount_30d'] = 'total_outflow_amount_30d'
  @_hash['total_outflow_amount_60d'] = 'total_outflow_amount_60d'
  @_hash['total_outflow_amount_90d'] = 'total_outflow_amount_90d'
  @_hash
end

.nullablesObject

An array for nullable fields



122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 122

def self.nullables
  %w[
    total_inflow_amount
    total_inflow_amount_30d
    total_inflow_amount_60d
    total_inflow_amount_90d
    total_outflow_amount
    total_outflow_amount_30d
    total_outflow_amount_60d
    total_outflow_amount_90d
  ]
end

.optionalsObject

An array for optional fields



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 104

def self.optionals
  %w[
    nsf_overdraft_transactions_count
    nsf_overdraft_transactions_count_30d
    nsf_overdraft_transactions_count_60d
    nsf_overdraft_transactions_count_90d
    total_inflow_amount
    total_inflow_amount_30d
    total_inflow_amount_60d
    total_inflow_amount_90d
    total_outflow_amount
    total_outflow_amount_30d
    total_outflow_amount_60d
    total_outflow_amount_90d
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 249

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} nsf_overdraft_transactions_count:"\
  " #{@nsf_overdraft_transactions_count.inspect}, nsf_overdraft_transactions_count_30d:"\
  " #{@nsf_overdraft_transactions_count_30d.inspect}, nsf_overdraft_transactions_count_60d:"\
  " #{@nsf_overdraft_transactions_count_60d.inspect}, nsf_overdraft_transactions_count_90d:"\
  " #{@nsf_overdraft_transactions_count_90d.inspect}, total_inflow_amount:"\
  " #{@total_inflow_amount.inspect}, total_inflow_amount_30d:"\
  " #{@total_inflow_amount_30d.inspect}, total_inflow_amount_60d:"\
  " #{@total_inflow_amount_60d.inspect}, total_inflow_amount_90d:"\
  " #{@total_inflow_amount_90d.inspect}, total_outflow_amount:"\
  " #{@total_outflow_amount.inspect}, total_outflow_amount_30d:"\
  " #{@total_outflow_amount_30d.inspect}, total_outflow_amount_60d:"\
  " #{@total_outflow_amount_60d.inspect}, total_outflow_amount_90d:"\
  " #{@total_outflow_amount_90d.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/the_plaid_api/models/base_report_user_attributes.rb', line 234

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} nsf_overdraft_transactions_count: #{@nsf_overdraft_transactions_count},"\
  " nsf_overdraft_transactions_count_30d: #{@nsf_overdraft_transactions_count_30d},"\
  " nsf_overdraft_transactions_count_60d: #{@nsf_overdraft_transactions_count_60d},"\
  " nsf_overdraft_transactions_count_90d: #{@nsf_overdraft_transactions_count_90d},"\
  " total_inflow_amount: #{@total_inflow_amount}, total_inflow_amount_30d:"\
  " #{@total_inflow_amount_30d}, total_inflow_amount_60d: #{@total_inflow_amount_60d},"\
  " total_inflow_amount_90d: #{@total_inflow_amount_90d}, total_outflow_amount:"\
  " #{@total_outflow_amount}, total_outflow_amount_30d: #{@total_outflow_amount_30d},"\
  " total_outflow_amount_60d: #{@total_outflow_amount_60d}, total_outflow_amount_90d:"\
  " #{@total_outflow_amount_90d}, additional_properties: #{@additional_properties}>"
end