Class: Syrup::Transaction

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attr_hash = nil) ⇒ Transaction

New objects can be instantiated as either empty (pass no construction parameter) or pre-set with attributes (pass a hash with key names matching the associated attribute names).



12
13
14
15
16
17
18
# File 'lib/syrup/transaction.rb', line 12

def initialize(attr_hash = nil)
  if attr_hash
    attr_hash.each do |k, v|
      instance_variable_set "@#{k}", v
    end
  end
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



8
9
10
# File 'lib/syrup/transaction.rb', line 8

def amount
  @amount
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/syrup/transaction.rb', line 8

def id
  @id
end

#payeeObject

Returns the value of attribute payee.



8
9
10
# File 'lib/syrup/transaction.rb', line 8

def payee
  @payee
end

#posted_atObject

Returns the value of attribute posted_at.



8
9
10
# File 'lib/syrup/transaction.rb', line 8

def posted_at
  @posted_at
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/syrup/transaction.rb', line 8

def status
  @status
end