Class: Smartware::Driver::CashAcceptor::Dummy

Inherits:
Object
  • Object
show all
Defined in:
lib/smartware/drivers/cash_acceptor/dummy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Dummy

Returns a new instance of Dummy.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 12

def initialize(config)
  @bill_types = [ 10, 50, 100, 500, 5000 ].map do |value|
    Interface::CashAcceptor::BillType.new(value, 'RUS')
  end

  @open = nil
  @closed = nil
  @escrow = nil
  @stacked = nil
  @returned = nil
  @status = nil
  @escrow_bill = nil
  @casette = true

  @enabled_types = 0

  EventMachine.add_periodic_timer 0.5, method(:poll)

  @dummy_state = :power_up
end

Instance Attribute Details

#bill_typesObject (readonly)

Returns the value of attribute bill_types.



7
8
9
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 7

def bill_types
  @bill_types
end

#closedObject

Returns the value of attribute closed.



9
10
11
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 9

def closed
  @closed
end

#enabled_typesObject

Returns the value of attribute enabled_types.



10
11
12
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 10

def enabled_types
  @enabled_types
end

#escrowObject

Returns the value of attribute escrow.



9
10
11
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 9

def escrow
  @escrow
end

#openObject

Returns the value of attribute open.



9
10
11
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 9

def open
  @open
end

#returnedObject

Returns the value of attribute returned.



9
10
11
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 9

def returned
  @returned
end

#stackedObject

Returns the value of attribute stacked.



9
10
11
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 9

def stacked
  @stacked
end

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 9

def status
  @status
end

Instance Method Details

#accepting?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 41

def accepting?
  false
end

#eject_casetteObject



49
50
51
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 49

def eject_casette
  @casette = false
end

#insert_casetteObject



45
46
47
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 45

def insert_casette
  @casette = true
end

#modelObject



33
34
35
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 33

def model
  "Generic cash acceptor"
end

#versionObject



37
38
39
# File 'lib/smartware/drivers/cash_acceptor/dummy.rb', line 37

def version
  "1.0"
end