Representation of a transaction.
[R] | account_id | The String ID of the account in which this transaction occurred. E.g. “XARE85EJqKsjxLp6XR8ocg8VakrkXpTXmRdOo”. |
[R] | amount | The settled dollar value as Float. Positive values when money moves out of the account; negative values when money moves in. E.g. 0.10 (10 cents). |
[R] | category_hierarchy | The Array of String category hierarchy. E.g. [“Food and Drink”, “Restaurants”]. |
[R] | category_id | The String Category ID. E.g. “13005000”. |
[R] | date | The Date that the transaction took place. E.g. #<Date: 2016-04-28 …> |
[R] | id | The String unique ID of the transaction. E.g. “0AZ0De04KqsreDgVwM1RSRYjyd8yXxSDQ8Zxn”. |
[R] | location | The Hash with location information obtained from the meta field. The keys are Strings. E.g. {“address” => “262 W 15th St”, “city” => “New York”, “state” => “NY”, “zip” => “10011”, “coordinates” => { “lat” => 40.740352, “lon” => -74.001761 }} |
[R] | meta | The Hash with additional information regarding the transaction. The keys are Symbols. E.g. { location: { “city”: “San Francisco”, “state”: “CA” } } |
[R] | name | The String descriptive name of the transaction. E.g. “Golden Crepes”. |
[R] | pending | The Boolean flag which identifies the transaction as pending or unsettled. |
[R] | pending_transaction_id | The String ID of a posted transaction's associated pending transaction - where applicable. |
[R] | reference_number | A String attribute that is used by the bank/payment processor to identify transactions — where applicable. |
[R] | score | The Hash with numeric representation of Plaid confidence in the meta data attached to the transaction. In the case of a score <.9 Plaid will default to guaranteed and known information. E.g. {location: { “address” => 1, “city” => 1, “state” => 1 }, name: 0.9}. |
[R] | type | The Hash transaction type. E.g. {:primary => :place}. |
Initialize a Transaction instance.
- fields
-
The Hash with fields.
Source: show
# File lib/plaid/transaction.rb, line 87 def initialize(fields) @id = fields['_id'] @account_id = fields['_account'] @date = fields['date'] && Date.parse(fields['date']) @amount = fields['amount'] @name = fields['name'] @meta = Plaid.symbolize_hash(fields['meta']) @location = (@meta && @meta[:location]) || {} @pending = fields['pending'] @reference_number = fields['_reference_number'] @pending_transaction_id = fields['_pendingTransaction'] @score = Plaid.symbolize_hash(fields['score']) @type = Plaid.symbolize_hash(fields['type'], values: true) @category_hierarchy = fields['category'] @category_id = fields['category_id'] end
Get a String representation of the transaction.
Returns
Returns a String.
Source: show
# File lib/plaid/transaction.rb, line 116 def inspect "#<Plaid::Transaction id=#{id.inspect}, account_id=#{account_id.inspect}, " "date=#{date}, amount=#{amount.inspect}, name=#{name.inspect}, " "pending=#{pending.inspect}>" end