Class: Smartware::Driver::CardReader::Dummy
- Inherits:
-
Object
- Object
- Smartware::Driver::CardReader::Dummy
- Defined in:
- lib/smartware/drivers/card_reader/dummy.rb
Instance Method Summary collapse
- #accepting=(accepting) ⇒ Object
- #accepting? ⇒ Boolean
- #capture ⇒ Object
- #eject ⇒ Object
-
#initialize(config) ⇒ Dummy
constructor
A new instance of Dummy.
- #model ⇒ Object
- #read_magstrip ⇒ Object
- #ready? ⇒ Boolean
- #status ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(config) ⇒ Dummy
Returns a new instance of Dummy.
5 6 7 8 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 5 def initialize(config) @accepting = false @state = nil end |
Instance Method Details
#accepting=(accepting) ⇒ Object
26 27 28 29 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 26 def accepting=(accepting) @state = :accepting if accepting @accepting = accepting end |
#accepting? ⇒ Boolean
22 23 24 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 22 def accepting? @accepting end |
#capture ⇒ Object
37 38 39 40 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 37 def capture @state = :eject self end |
#eject ⇒ Object
31 32 33 34 35 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 31 def eject @state = :eject self end |
#model ⇒ Object
10 11 12 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 10 def model "Dummy card reader" end |
#read_magstrip ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 60 def read_magstrip [ "B4154000000000000^IVANOV/IVAN^1501101000", "4154000000000000=1501101000", nil, nil ] end |
#ready? ⇒ Boolean
18 19 20 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 18 def ready? true end |
#status ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 42 def status case @state when nil :ready when :accepting @state = :inserted :card_at_gate when :inserted :card_inserted when :eject @state = nil :card_at_gate end end |
#version ⇒ Object
14 15 16 |
# File 'lib/smartware/drivers/card_reader/dummy.rb', line 14 def version "" end |