Class: OldPlaid::Transaction
- Inherits:
-
Object
- Object
- OldPlaid::Transaction
- Defined in:
- lib/old_plaid/models/transaction.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#cat ⇒ Object
Returns the value of attribute cat.
-
#category ⇒ Object
Returns the value of attribute category.
-
#category_id ⇒ Object
Returns the value of attribute category_id.
-
#date ⇒ Object
Returns the value of attribute date.
-
#location ⇒ Object
Returns the value of attribute location.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pending ⇒ Object
Returns the value of attribute pending.
-
#pending_transaction_id ⇒ Object
Returns the value of attribute pending_transaction_id.
-
#score ⇒ Object
Returns the value of attribute score.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
-
#transaction_type ⇒ Object
Returns the value of attribute transaction_type.
Instance Method Summary collapse
-
#initialize(fields = {}) ⇒ Transaction
constructor
A new instance of Transaction.
Constructor Details
#initialize(fields = {}) ⇒ Transaction
Returns a new instance of Transaction.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/old_plaid/models/transaction.rb', line 5 def initialize(fields = {}) @transaction_id = fields['_id'] @account_id = fields['_account'] @date = fields['date'] @amount = fields['amount'] @name = fields['name'] @location = fields['meta'].nil? ? {} : fields['meta']['location'] @pending = fields['pending'] @pending_transaction_id = fields['_pendingTransaction'] @score = fields['score'] @cat = Category.new({ 'id' => fields['category_id'], 'hierarchy' => fields['category'], 'type' => fields['type'] }) # Here for backwards compatibility only. @transaction_type = fields['type']['primary'] if fields['type'] @category = fields['category'] @category_id = fields['category_id'] @meta = fields['meta'] end |
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def account_id @account_id end |
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def amount @amount end |
#cat ⇒ Object
Returns the value of attribute cat.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def cat @cat end |
#category ⇒ Object
Returns the value of attribute category.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def category @category end |
#category_id ⇒ Object
Returns the value of attribute category_id.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def category_id @category_id end |
#date ⇒ Object
Returns the value of attribute date.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def date @date end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def location @location end |
#meta ⇒ Object
Returns the value of attribute meta.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def @meta end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def name @name end |
#pending ⇒ Object
Returns the value of attribute pending.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def pending @pending end |
#pending_transaction_id ⇒ Object
Returns the value of attribute pending_transaction_id.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def pending_transaction_id @pending_transaction_id end |
#score ⇒ Object
Returns the value of attribute score.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def score @score end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def transaction_id @transaction_id end |
#transaction_type ⇒ Object
Returns the value of attribute transaction_type.
3 4 5 |
# File 'lib/old_plaid/models/transaction.rb', line 3 def transaction_type @transaction_type end |