Class: TransactionFaker::Transaction
- Inherits:
-
Object
- Object
- TransactionFaker::Transaction
- Defined in:
- lib/transaction_faker/models/transaction.rb
Overview
Excluded meta
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#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.
-
#id ⇒ Object
Returns the value of attribute id.
-
#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 ⇒ Object
Returns the value of attribute pending_transaction.
-
#score ⇒ Object
Returns the value of attribute score.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other_transaction) ⇒ Object
-
#initialize(account, amount, category_arr, cat_id, month_offset) ⇒ Transaction
constructor
A new instance of Transaction.
Constructor Details
#initialize(account, amount, category_arr, cat_id, month_offset) ⇒ Transaction
Returns a new instance of Transaction.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/transaction_faker/models/transaction.rb', line 8 def initialize(account, amount, category_arr, cat_id, month_offset) @id = Faker::Lorem.characters(38) @account = account @date = generate_date(month_offset) @amount = amount @name = Faker::Company.name @location = create_location_hash() @pending = false #should this vary? @pendingTransaction = nil @score = create_score # Here for backwards compatibility only. @type = { primary: Categories.get_transaction_type(cat_id) } @category = category_arr @category_id = cat_id @meta = {"location" => @location["coordinates"]} end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def account @account end |
#amount ⇒ Object
Returns the value of attribute amount.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def amount @amount end |
#cat ⇒ Object
Returns the value of attribute cat.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def cat @cat end |
#category ⇒ Object
Returns the value of attribute category.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def category @category end |
#category_id ⇒ Object
Returns the value of attribute category_id.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def category_id @category_id end |
#date ⇒ Object
Returns the value of attribute date.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def date @date end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def id @id end |
#location ⇒ Object
Returns the value of attribute location.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def location @location end |
#meta ⇒ Object
Returns the value of attribute meta.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def @meta end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def name @name end |
#pending ⇒ Object
Returns the value of attribute pending.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def pending @pending end |
#pending_transaction ⇒ Object
Returns the value of attribute pending_transaction.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def pending_transaction @pending_transaction end |
#score ⇒ Object
Returns the value of attribute score.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def score @score end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/transaction_faker/models/transaction.rb', line 6 def type @type end |
Instance Method Details
#==(other_transaction) ⇒ Object
26 27 28 |
# File 'lib/transaction_faker/models/transaction.rb', line 26 def ==(other_transaction) @id == other_transaction.id end |