Class: ThePlaidApi::TransactionData

Inherits:
BaseModel
  • Object
show all
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

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(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 = 
  @transaction_id = transaction_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

A unique identifier for the end user’s account.

Returns:

  • (String)


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

def 
  @account_id
end

#amountFloat

The amount of the transaction.

Returns:

  • (Float)


19
20
21
# File 'lib/the_plaid_api/models/transaction_data.rb', line 19

def amount
  @amount
end

#dateDate

The date of the transaction, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (“yyyy-mm-dd”).

Returns:

  • (Date)


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

def date
  @date
end

#descriptionString

The description of the transaction.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/transaction_data.rb', line 15

def description
  @description
end

#transaction_idString

A unique identifier for the transaction.

Returns:

  • (String)


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
   = 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: ,
                      transaction_id: transaction_id,
                      additional_properties: additional_properties)
end

.namesObject

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

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

#inspectObject

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_sObject

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