Class: ThePlaidApi::TransactionData
- Defined in:
- lib/the_plaid_api/models/transaction_data.rb
Overview
Information about the matched direct deposit transaction used to verify a user’s payroll information.
Instance Attribute Summary collapse
-
#account_id ⇒ String
A unique identifier for the end user’s account.
-
#amount ⇒ Float
The amount of the transaction.
-
#date ⇒ Date
The date of the transaction, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (“yyyy-mm-dd”).
-
#description ⇒ String
The description of the transaction.
-
#transaction_id ⇒ String
A unique identifier for the transaction.
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(description:, amount:, date:, account_id:, transaction_id:, additional_properties: nil) ⇒ TransactionData
constructor
A new instance of TransactionData.
-
#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(description:, amount:, date:, account_id:, transaction_id:, additional_properties: nil) ⇒ TransactionData
Returns a new instance of TransactionData.
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 55 def initialize(description:, amount:, date:, account_id:, transaction_id:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @description = description @amount = amount @date = date @account_id = account_id @transaction_id = transaction_id @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
A unique identifier for the end user’s account.
28 29 30 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 28 def account_id @account_id end |
#amount ⇒ Float
The amount of the transaction.
19 20 21 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 19 def amount @amount end |
#date ⇒ Date
The date of the transaction, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (“yyyy-mm-dd”).
24 25 26 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 24 def date @date end |
#description ⇒ String
The description of the transaction.
15 16 17 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 15 def description @description end |
#transaction_id ⇒ String
A unique identifier for the transaction.
32 33 34 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 32 def transaction_id @transaction_id 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 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. description = hash.key?('description') ? hash['description'] : nil amount = hash.key?('amount') ? hash['amount'] : nil date = hash.key?('date') ? hash['date'] : nil account_id = hash.key?('account_id') ? hash['account_id'] : nil transaction_id = hash.key?('transaction_id') ? hash['transaction_id'] : nil # 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. TransactionData.new(description: description, amount: amount, date: date, account_id: account_id, transaction_id: transaction_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['description'] = 'description' @_hash['amount'] = 'amount' @_hash['date'] = 'date' @_hash['account_id'] = 'account_id' @_hash['transaction_id'] = 'transaction_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 46 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
105 106 107 108 109 110 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 105 def inspect class_name = self.class.name.split('::').last "<#{class_name} description: #{@description.inspect}, amount: #{@amount.inspect}, date:"\ " #{@date.inspect}, account_id: #{@account_id.inspect}, transaction_id:"\ " #{@transaction_id.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
97 98 99 100 101 102 |
# File 'lib/the_plaid_api/models/transaction_data.rb', line 97 def to_s class_name = self.class.name.split('::').last "<#{class_name} description: #{@description}, amount: #{@amount}, date: #{@date},"\ " account_id: #{@account_id}, transaction_id: #{@transaction_id}, additional_properties:"\ " #{@additional_properties}>" end |