Class: Rumember::Transaction

Inherits:
Abstract show all
Defined in:
lib/rumember/transaction.rb

Instance Attribute Summary

Attributes inherited from Abstract

#parent

Instance Method Summary collapse

Methods inherited from Abstract

boolean_reader, #initialize, integer_reader, reader, time_reader

Methods included from Dispatcher

#dispatch, #lists, #locations, #transaction_dispatch

Constructor Details

This class inherits a constructor from Rumember::Abstract

Instance Method Details

#idObject



4
5
6
# File 'lib/rumember/transaction.rb', line 4

def id
  Integer(@attributes['transaction']['id'])
end

#paramsObject



20
21
22
# File 'lib/rumember/transaction.rb', line 20

def params
  {'transaction_id' => id}
end

#responseObject



16
17
18
# File 'lib/rumember/transaction.rb', line 16

def response
  @attributes
end

#undoObject



24
25
26
27
28
29
30
31
# File 'lib/rumember/transaction.rb', line 24

def undo
  if undone? || !undoable?
    false
  else
    dispatch('transactions.undo')
    @undone = true
  end
end

#undoable?Boolean

Returns:

  • (Boolean)


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

def undoable?
  @attributes['transaction']['undoable'] == '1'
end

#undone?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/rumember/transaction.rb', line 12

def undone?
  !!@undone
end