Class: ThePlaidApi::ClientProvidedEnrichedTransaction

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

Overview

A client-provided transaction that Plaid has enriched.

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(id:, description:, amount:, iso_currency_code:, enrichments:, client_user_id: SKIP, client_account_id: SKIP, account_type: SKIP, account_subtype: SKIP, direction: SKIP, client_customization: SKIP, additional_properties: nil) ⇒ ClientProvidedEnrichedTransaction

Returns a new instance of ClientProvidedEnrichedTransaction.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 109

def initialize(id:, description:, amount:, iso_currency_code:, enrichments:,
               client_user_id: SKIP, client_account_id: SKIP,
               account_type: SKIP, account_subtype: SKIP, direction: SKIP,
               client_customization: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @client_user_id = client_user_id unless client_user_id == SKIP
  @client_account_id =  unless  == SKIP
  @account_type =  unless  == SKIP
  @account_subtype =  unless  == SKIP
  @description = description
  @amount = amount
  @direction = direction unless direction == SKIP
  @iso_currency_code = iso_currency_code
  @enrichments = enrichments
  @client_customization = client_customization unless client_customization == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_subtypeString

The account subtype associated with the transaction. For a full list of valid types and subtypes, see the [Account schema](plaid.com/docs/api/accounts#account-type-schema).

Returns:

  • (String)


40
41
42
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 40

def 
  @account_subtype
end

#account_typeString

The account type associated with the transaction. For a full list of valid types and subtypes, see the [Account schema](plaid.com/docs/api/accounts#account-type-schema).

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 34

def 
  @account_type
end

#amountFloat

The absolute value of the transaction (>= 0)

Returns:

  • (Float)


48
49
50
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 48

def amount
  @amount
end

#client_account_idString

A unique account id used to group transactions for a given account, as a unique identifier from your application. Personally identifiable information, such as an email address or phone number, should not be used in the ‘client_account_id`.

Returns:

  • (String)


28
29
30
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 28

def 
  @client_account_id
end

#client_customizationClientCustomization

Custom client fields

Returns:



71
72
73
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 71

def client_customization
  @client_customization
end

#client_user_idString

A unique user id used to group transactions for a given user, as a unique identifier from your application. Personally identifiable information, such as an email address or phone number, should not be used in the ‘client_user_id`.

Returns:

  • (String)


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

def client_user_id
  @client_user_id
end

#descriptionString

The raw description of the transaction.

Returns:

  • (String)


44
45
46
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 44

def description
  @description
end

#directionEnrichTransactionDirection

The direction of the transaction from the perspective of the account holder: ‘OUTFLOW` - Includes outgoing transfers, purchases, and fees. (Typically represented as a negative value on checking accounts and debit cards and a positive value on credit cards.) `INFLOW` - Includes incoming transfers, refunds, and income. (Typically represented as a positive value on checking accounts and debit cards and a negative value on credit cards.)



59
60
61
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 59

def direction
  @direction
end

#enrichmentsEnrichments

A grouping of the Plaid produced transaction enrichment fields.

Returns:



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

def enrichments
  @enrichments
end

#idString

The unique ID for the transaction as provided by you in the request.

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 14

def id
  @id
end

#iso_currency_codeString

The ISO-4217 currency code of the transaction e.g. USD.

Returns:

  • (String)


63
64
65
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 63

def iso_currency_code
  @iso_currency_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



131
132
133
134
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/client_provided_enriched_transaction.rb', line 131

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  iso_currency_code =
    hash.key?('iso_currency_code') ? hash['iso_currency_code'] : nil
  enrichments = Enrichments.from_hash(hash['enrichments']) if hash['enrichments']
  client_user_id =
    hash.key?('client_user_id') ? hash['client_user_id'] : SKIP
   =
    hash.key?('client_account_id') ? hash['client_account_id'] : SKIP
   = hash.key?('account_type') ? hash['account_type'] : SKIP
   =
    hash.key?('account_subtype') ? hash['account_subtype'] : SKIP
  direction = hash.key?('direction') ? hash['direction'] : SKIP
  client_customization = ClientCustomization.from_hash(hash['client_customization']) if
    hash['client_customization']

  # 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.
  ClientProvidedEnrichedTransaction.new(id: id,
                                        description: description,
                                        amount: amount,
                                        iso_currency_code: iso_currency_code,
                                        enrichments: enrichments,
                                        client_user_id: client_user_id,
                                        client_account_id: ,
                                        account_type: ,
                                        account_subtype: ,
                                        direction: direction,
                                        client_customization: client_customization,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 74

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['client_user_id'] = 'client_user_id'
  @_hash['client_account_id'] = 'client_account_id'
  @_hash['account_type'] = 'account_type'
  @_hash['account_subtype'] = 'account_subtype'
  @_hash['description'] = 'description'
  @_hash['amount'] = 'amount'
  @_hash['direction'] = 'direction'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash['enrichments'] = 'enrichments'
  @_hash['client_customization'] = 'client_customization'
  @_hash
end

.nullablesObject

An array for nullable fields



103
104
105
106
107
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 103

def self.nullables
  %w[
    client_customization
  ]
end

.optionalsObject

An array for optional fields



91
92
93
94
95
96
97
98
99
100
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 91

def self.optionals
  %w[
    client_user_id
    client_account_id
    account_type
    account_subtype
    direction
    client_customization
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



186
187
188
189
190
191
192
193
194
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 186

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, client_user_id: #{@client_user_id.inspect},"\
  " client_account_id: #{@client_account_id.inspect}, account_type: #{@account_type.inspect},"\
  " account_subtype: #{@account_subtype.inspect}, description: #{@description.inspect},"\
  " amount: #{@amount.inspect}, direction: #{@direction.inspect}, iso_currency_code:"\
  " #{@iso_currency_code.inspect}, enrichments: #{@enrichments.inspect}, client_customization:"\
  " #{@client_customization.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



175
176
177
178
179
180
181
182
183
# File 'lib/the_plaid_api/models/client_provided_enriched_transaction.rb', line 175

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, client_user_id: #{@client_user_id}, client_account_id:"\
  " #{@client_account_id}, account_type: #{@account_type}, account_subtype:"\
  " #{@account_subtype}, description: #{@description}, amount: #{@amount}, direction:"\
  " #{@direction}, iso_currency_code: #{@iso_currency_code}, enrichments: #{@enrichments},"\
  " client_customization: #{@client_customization}, additional_properties:"\
  " #{@additional_properties}>"
end