Class: TransactionFaker::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/transaction_faker/models/transaction.rb

Overview

Excluded meta

Instance Attribute Summary collapse

Instance Method Summary collapse

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(, amount, category_arr, cat_id, month_offset)
  @id = Faker::Lorem.characters(38)
  @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

#accountObject

Returns the value of attribute account.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def 
  @account
end

#amountObject

Returns the value of attribute amount.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def amount
  @amount
end

#catObject

Returns the value of attribute cat.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def cat
  @cat
end

#categoryObject

Returns the value of attribute category.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def category
  @category
end

#category_idObject

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

#dateObject

Returns the value of attribute date.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def date
  @date
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def id
  @id
end

#locationObject

Returns the value of attribute location.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def location
  @location
end

#metaObject

Returns the value of attribute meta.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def meta
  @meta
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def name
  @name
end

#pendingObject

Returns the value of attribute pending.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def pending
  @pending
end

#pending_transactionObject

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

#scoreObject

Returns the value of attribute score.



6
7
8
# File 'lib/transaction_faker/models/transaction.rb', line 6

def score
  @score
end

#typeObject

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