Class: ThePlaidApi::CreditBankStatementUploadTransaction

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

Overview

An object containing data about a transaction appearing on a user-uploaded bank statement.

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(amount:, date:, original_description:, account_id:, additional_properties: nil) ⇒ CreditBankStatementUploadTransaction

Returns a new instance of CreditBankStatementUploadTransaction.



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

def initialize(amount:, date:, original_description:, account_id:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @amount = amount
  @date = date
  @original_description = original_description
  @account_id = 
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The unique id of the bank account that this transaction occurs in

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_transaction.rb', line 30

def 
  @account_id
end

#amountFloat

The value of the transaction. A negative amount indicates that money moved into the account (such as a paycheck being deposited).

Returns:

  • (Float)


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

def amount
  @amount
end

#dateDate

The date of when the transaction was made, in ISO 8601 format (YYYY-MM-DD).

Returns:

  • (Date)


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

def date
  @date
end

#original_descriptionString

The raw description of the transaction as it appears on the bank statement.

Returns:

  • (String)


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

def original_description
  @original_description
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_transaction.rb', line 70

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount = hash.key?('amount') ? hash['amount'] : nil
  date = hash.key?('date') ? hash['date'] : nil
  original_description =
    hash.key?('original_description') ? hash['original_description'] : nil
   = hash.key?('account_id') ? hash['account_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.
  CreditBankStatementUploadTransaction.new(amount: amount,
                                           date: date,
                                           original_description: original_description,
                                           account_id: ,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['date'] = 'date'
  @_hash['original_description'] = 'original_description'
  @_hash['account_id'] = 'account_id'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
51
52
53
54
55
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_transaction.rb', line 48

def self.nullables
  %w[
    amount
    date
    original_description
    account_id
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
109
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_transaction.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount.inspect}, date: #{@date.inspect}, original_description:"\
  " #{@original_description.inspect}, account_id: #{@account_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



96
97
98
99
100
101
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_transaction.rb', line 96

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount}, date: #{@date}, original_description:"\
  " #{@original_description}, account_id: #{@account_id}, additional_properties:"\
  " #{@additional_properties}>"
end