extface 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -10
- data/app/controllers/extface/devices_controller.rb +2 -2
- data/app/helpers/extface/devices_helper.rb +13 -11
- data/app/models/extface/device.rb +17 -11
- data/app/models/extface/{driver_base.rb → driver.rb} +23 -8
- data/app/models/extface/driver/generic_pos.rb +46 -1
- data/app/models/extface/driver/star_scp700.rb +11 -5
- data/app/models/extface/driver/star_tsp200.rb +14 -1
- data/app/models/extface/serial_config.rb +2 -2
- data/app/views/extface/devices/form.html.erb +11 -8
- data/app/views/extface/devices/index.html.erb +1 -1
- data/app/views/extface/driver/star_tsp200/_settings.html.erb +1 -0
- data/db/migrate/20140303112124_create_extface_drivers.rb +9 -0
- data/db/migrate/20140303113217_drop_separate_driver_type_tables.rb +12 -0
- data/db/migrate/20140303122506_change_driver_polymorphic_to_belongs_to_extface_devices.rb +13 -0
- data/db/migrate/20140303123022_change_polymorphic_to_has_one_to_extface_serial_configs.rb +11 -0
- data/lib/extface.rb +5 -0
- data/lib/extface/mapping.rb +3 -2
- data/lib/extface/version.rb +1 -1
- data/test/controllers/extface/devices_controller_test.rb +1 -1
- data/test/dummy/config/routes.rb +3 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +5 -26
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +138 -31
- data/test/dummy/log/test.log +3587 -4282
- data/test/dummy/tmp/cache/assets/test/sprockets/0a8a23b1a73ebf217f4e2b765013ce7b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/21fb58a50e25d1170f2c7d5bd5d29c54 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/263375f2d55c31687ed052f99ddead55 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/3f4ff460a79b2e29781690193a3960f6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4ef10b222fde3c042209a46daf3d3e36 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/544650645bc510ef8fbee0043c41fdcf +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6dbf2b0443792e51055710be15c83197 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/717acb3e7c0df18696cf1bc56de6d3d5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9891cbb0808f38b2c42f42fd89e662a4 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9b178820b9dc8c81c9784cf7ee3b7d35 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a06a4a7f51754a6a2c0694eb39ff824b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a8cc2e73253025d2518d2449e16e5266 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/b56dfad0b14283f2cc10c62f37d71cc7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e1197e0129ade843b08de0b45c47fc40 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ece3270b150db7c668579bb91ac7e2e5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f018ab87f3490dbbcbc2e3c9f36aed3d +0 -0
- data/test/fixtures/extface/devices.yml +2 -2
- data/test/fixtures/extface/drivers.yml +10 -0
- data/test/fixtures/extface/serial_configs.yml +2 -2
- data/test/models/extface/{pos_print_driver_test.rb → driver/generic_pos_test.rb} +1 -1
- data/test/models/extface/{pbx_cdr_driver_test.rb → driver/star_scp700_test.rb} +1 -1
- metadata +17 -44
- data/app/models/extface/driver/datecs_fp550.rb +0 -6
- data/app/models/extface/driver/fixed_width_serial_cdr.rb +0 -6
- data/app/models/extface/driver/raw_serial.rb +0 -27
- data/app/models/extface/fiscal_print_driver.rb +0 -8
- data/app/models/extface/pbx_cdr_driver.rb +0 -12
- data/app/models/extface/pos_print_driver.rb +0 -46
- data/app/models/extface/raw_driver.rb +0 -16
- data/app/views/extface/driver/fixed_width_serial_cdr/_settings.html.erb +0 -0
- data/test/fixtures/extface/fiscal_print_drivers.yml +0 -7
- data/test/fixtures/extface/pbx_cdr_drivers.yml +0 -7
- data/test/fixtures/extface/pos_print_drivers.yml +0 -7
- data/test/fixtures/extface/raw_drivers.yml +0 -7
- data/test/models/extface/fiscal_print_driver_test.rb +0 -9
- data/test/models/extface/raw_driver_test.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 916e0a9bc414ba59d91de7a4e05c507d893225de
|
4
|
+
data.tar.gz: f7f130b480235e7c53d7b60b0e3cc19949eed2d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bf0e91791f22ec88193acd2e7d4cf7d7f0c1394a63d7741d551bb09e0f7529a26f982e4ecd6232cfc0928a3dd00d2a46cd068b450ec727125726b4d3110d442
|
7
|
+
data.tar.gz: 80bd3c0f44e7f428928e40abf8b8ed6015a4601e5978c3cd8f6a0c2d6f8970ed0e1e9ca41c931e347f083279608770f7299f35a6a37d277537feb18cc2f49195
|
data/Rakefile
CHANGED
@@ -4,16 +4,6 @@ rescue LoadError
|
|
4
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
5
|
end
|
6
6
|
|
7
|
-
require 'rdoc/task'
|
8
|
-
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
11
|
-
rdoc.title = 'Extface'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.rdoc')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
16
|
-
|
17
7
|
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
8
|
load 'rails/tasks/engine.rake'
|
19
9
|
|
@@ -51,7 +51,7 @@ module Extface
|
|
51
51
|
|
52
52
|
def test_page
|
53
53
|
set_device
|
54
|
-
@job = @device.
|
54
|
+
@job = @device.driver.print_test_page if params[:test_page]
|
55
55
|
render action: :show
|
56
56
|
end
|
57
57
|
|
@@ -63,7 +63,7 @@ module Extface
|
|
63
63
|
|
64
64
|
# Only allow a trusted parameter "white list" through.
|
65
65
|
def device_params
|
66
|
-
params.require(:device).permit(:uuid, :name, :
|
66
|
+
params.require(:device).permit(:uuid, :name, :driver_class, :driver_id)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -1,21 +1,23 @@
|
|
1
1
|
module Extface
|
2
2
|
module DevicesHelper
|
3
3
|
|
4
|
-
def subdrivers(
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
def subdrivers(object)
|
5
|
+
[].tap do |drivers|
|
6
|
+
object.subclasses.each do |s|
|
7
|
+
drivers << s
|
8
|
+
drivers << subdrivers(s) if s.subclasses.any?
|
9
|
+
end
|
8
10
|
end
|
9
|
-
return options
|
10
11
|
end
|
11
12
|
|
12
13
|
def options_for_drivers
|
13
|
-
Extface::Engine.eager_load!
|
14
|
-
|
15
|
-
Extface::
|
16
|
-
drivers
|
17
|
-
|
18
|
-
|
14
|
+
Extface::Engine.eager_load! if Rails.env.development?
|
15
|
+
[].tap do |drivers|
|
16
|
+
Extface::Driver.subclasses.each do |s|
|
17
|
+
drivers << s
|
18
|
+
drivers << subdrivers(s)
|
19
|
+
end
|
20
|
+
end.flatten.group_by{ |x| x::GROUP }.sort.collect{ |group, drivers| [group, drivers.collect{ |d| [d::NAME, d.to_s] }.sort ] }
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -1,37 +1,43 @@
|
|
1
1
|
module Extface
|
2
2
|
class Device < ActiveRecord::Base
|
3
|
-
attr_writer :
|
3
|
+
attr_writer :driver_class
|
4
4
|
belongs_to :extfaceable, polymorphic: true
|
5
|
-
belongs_to :
|
5
|
+
belongs_to :driver, inverse_of: :device
|
6
6
|
has_many :jobs, inverse_of: :device
|
7
7
|
|
8
|
-
accepts_nested_attributes_for :
|
8
|
+
accepts_nested_attributes_for :driver
|
9
9
|
|
10
|
-
delegate :print?, :fiscal?, :raw?, :
|
10
|
+
delegate :print?, :fiscal?, :raw?, :report?, to: :driver, allow_nil: true
|
11
11
|
|
12
12
|
validates_uniqueness_of :name, :uuid, scope: [:extfaceable_id, :extfaceable_type]
|
13
13
|
|
14
14
|
before_create do
|
15
15
|
self.uuid = SecureRandom.hex
|
16
16
|
self.name = uuid unless name.present?
|
17
|
-
self.driveable = @driver.constantize.create if @driver.present?
|
18
17
|
end
|
19
18
|
|
20
|
-
|
21
|
-
|
19
|
+
before_save do
|
20
|
+
if @driver_class.present? and @driver_class != driver_class.try(:to_s)
|
21
|
+
driver.try(:destroy)
|
22
|
+
self.driver = @driver_class.constantize.create if @driver_class.present?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def driver_class
|
27
|
+
driver.try(:class)
|
22
28
|
end
|
23
29
|
|
24
30
|
def driver_name
|
25
|
-
|
31
|
+
driver_class::NAME if driver_class
|
26
32
|
end
|
27
33
|
|
28
34
|
def session(description = nil)
|
29
35
|
job = jobs.create!(description: description)
|
30
36
|
Thread.new do
|
31
37
|
begin
|
32
|
-
raise 'No driver configured' unless
|
33
|
-
|
34
|
-
yield
|
38
|
+
raise 'No driver configured' unless driver.present?
|
39
|
+
driver.set_job(job)
|
40
|
+
yield driver
|
35
41
|
job.complete!
|
36
42
|
rescue => e
|
37
43
|
STDERR.puts e.message
|
@@ -1,19 +1,34 @@
|
|
1
1
|
require'timeout'
|
2
2
|
module Extface
|
3
|
-
class
|
4
|
-
self.abstract_class = true
|
3
|
+
class Driver < ActiveRecord::Base
|
5
4
|
|
6
|
-
|
5
|
+
NAME = 'Extface Driver Base' #human driver name
|
6
|
+
GROUP = Extface::RAW_DRIVER
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
DEVELOPMENT = true #driver is not ready for production (not passing all tests or has major bugs)
|
9
|
+
|
10
|
+
CAN_RECEСVE_DATA = true #pull from server
|
11
|
+
CAN_TRANSMIT_DATA = true #push to server
|
12
|
+
|
13
|
+
# Select driver features
|
14
|
+
RAW = true #responds to #push(data) and #pull
|
15
|
+
PRINT = false #POS, slip printers
|
16
|
+
FISCAL = false #cash registers, fiscal printers
|
17
|
+
REPORT = false #only transmit data that must be parsed by handler, CDR, report devices
|
18
|
+
|
19
|
+
DRIVER_TYPES = ['RAW', 'PRINT', 'FISCAL', 'REPORT'].freeze
|
20
|
+
|
21
|
+
has_one :device, inverse_of: :driver
|
22
|
+
|
23
|
+
DRIVER_TYPES.each do |driver_type|
|
24
|
+
define_method "#{driver_type.downcase}?" do
|
25
|
+
self.class.const_get driver_type
|
11
26
|
end
|
12
27
|
end
|
13
28
|
|
14
29
|
class << self
|
15
|
-
def has_serial_config
|
16
|
-
has_one :serial_config,
|
30
|
+
def has_serial_config #helper for serial devices, provides config for speed, boud rate, parity etc..
|
31
|
+
has_one :serial_config, inverse_of: :driver
|
17
32
|
accepts_nested_attributes_for :serial_config
|
18
33
|
define_method :serial? do
|
19
34
|
true
|
@@ -1,7 +1,52 @@
|
|
1
1
|
module Extface
|
2
|
-
class Driver::GenericPos < Extface::
|
2
|
+
class Driver::GenericPos < Extface::Driver
|
3
3
|
NAME = 'Generic Pos Printer (Serial)'.freeze
|
4
|
+
GROUP = Extface::PRINT_DRIVER
|
5
|
+
|
6
|
+
DEVELOPMENT = true #driver is not ready for production (not passing all tests or has major bugs)
|
7
|
+
|
8
|
+
CAN_RECEСVE_DATA = true #pull from server
|
9
|
+
CAN_TRANSMIT_DATA = true #push to server
|
10
|
+
|
11
|
+
# Select driver features
|
12
|
+
RAW = true #responds to #push(data) and #pull
|
13
|
+
PRINT = true #POS, slip printers
|
14
|
+
FISCAL = false #cash registers, fiscal printers
|
15
|
+
REPORT = false #only transmit data that must be parsed by handler, CDR, report devices
|
16
|
+
|
4
17
|
has_serial_config
|
5
18
|
alias_method :print, :push
|
19
|
+
|
20
|
+
def print_test_page(times = 1)
|
21
|
+
device.session("Print Test Page") do |s|
|
22
|
+
times.times do |t|
|
23
|
+
s.notify "Printing Test Page #{t}"
|
24
|
+
s.print "******************************\r\n*"
|
25
|
+
s.print "Extface Print Test #{t}".center(28)
|
26
|
+
s.print "*\r\n******************************\r\n"
|
27
|
+
|
28
|
+
s.notify "Printing driver information"
|
29
|
+
s.print "\r\nDriver:\r\n"
|
30
|
+
s.print "------------------------------\r\n"
|
31
|
+
s.print "#{self.class::NAME}".truncate(30)
|
32
|
+
s.print "\r\n"
|
33
|
+
|
34
|
+
if try(:serial?)
|
35
|
+
s.notify "Printing serial settings"
|
36
|
+
s.print "\r\nSerial Port Settings:\r\n"
|
37
|
+
s.print "------------------------------\r\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
s.print "\r\n"
|
41
|
+
s.print "------------------------------\r\n"
|
42
|
+
s.print Time.now.strftime("Printed on %m/%d/%Y %T\r\n").rjust(32)
|
43
|
+
s.print "\r\n\r\n"
|
44
|
+
s.notify "Printing finished"
|
45
|
+
|
46
|
+
s.try :autocut
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
6
51
|
end
|
7
52
|
end
|
@@ -1,16 +1,22 @@
|
|
1
1
|
module Extface
|
2
2
|
class Driver::StarScp700 < Extface::Driver::StarTsp200
|
3
3
|
NAME = 'Star SCP700 (Receipt only)'.freeze
|
4
|
+
GROUP = Extface::PRINT_DRIVER
|
4
5
|
|
5
|
-
|
6
|
+
DEVELOPMENT = true #driver is not ready for production (not passing all tests or has major bugs)
|
7
|
+
|
8
|
+
CAN_RECEСVE_DATA = true #pull from server
|
9
|
+
CAN_TRANSMIT_DATA = true #push to server
|
10
|
+
|
11
|
+
# Select driver features
|
12
|
+
RAW = true #responds to #push(data) and #pull
|
13
|
+
PRINT = true #POS, slip printers
|
14
|
+
FISCAL = false #cash registers, fiscal printers
|
15
|
+
REPORT = false #only transmit data that must be parsed by handler, CDR, report devices
|
6
16
|
|
7
17
|
def autocut(partial = true)
|
8
18
|
print "\r\n\r\n\r\n"
|
9
19
|
print partial ? "\x1B\x64\x31" : "\x1B\x64\x30"
|
10
20
|
end
|
11
|
-
|
12
|
-
def autocutter?
|
13
|
-
true
|
14
|
-
end
|
15
21
|
end
|
16
22
|
end
|
@@ -1,6 +1,19 @@
|
|
1
1
|
module Extface
|
2
|
-
class Driver::StarTsp200 <
|
2
|
+
class Driver::StarTsp200 < Driver::GenericPos
|
3
3
|
NAME = 'Star TSP200 (Base Receipt Protocol)'.freeze
|
4
|
+
GROUP = Extface::PRINT_DRIVER
|
5
|
+
|
6
|
+
DEVELOPMENT = true #driver is not ready for production (not passing all tests or has major bugs)
|
7
|
+
|
8
|
+
CAN_RECEСVE_DATA = true #pull from server
|
9
|
+
CAN_TRANSMIT_DATA = true #push to server
|
10
|
+
|
11
|
+
# Select driver features
|
12
|
+
RAW = true #responds to #push(data) and #pull
|
13
|
+
PRINT = true #POS, slip printers
|
14
|
+
FISCAL = false #cash registers, fiscal printers
|
15
|
+
REPORT = false #only transmit data that must be parsed by handler, CDR, report devices
|
16
|
+
|
4
17
|
has_serial_config
|
5
18
|
end
|
6
19
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Extface
|
2
2
|
class SerialConfig < ActiveRecord::Base
|
3
|
-
BOUD_RATES = [2400, 4800, 9600, 19200].freeze
|
3
|
+
BOUD_RATES = [2400, 4800, 9600, 19200, 38400].freeze
|
4
4
|
DATA_LENGTHS = [7, 8].freeze
|
5
5
|
PARITY_CHECKS = [0, 1, 2].freeze
|
6
6
|
STOP_BITS = [1, 2].freeze
|
7
7
|
HANDSHAKE = [0, 1, 2].freeze
|
8
|
-
belongs_to :
|
8
|
+
belongs_to :driver, inverse_of: :serial_config
|
9
9
|
end
|
10
10
|
end
|
@@ -21,26 +21,29 @@
|
|
21
21
|
<div class="form-group">
|
22
22
|
<%= f.label :driver, class: 'col-sm-2 control-label' %>
|
23
23
|
<div class='col-sm-10 col-md-8'>
|
24
|
-
<%
|
24
|
+
<% unless @device.driver.blank? || params[:driver_change] %>
|
25
25
|
<p class="form-control-static">
|
26
|
-
<%= link_to
|
26
|
+
<%= link_to edit_device_path(@device, driver_change: true), class: 'btn btn-danger btn-sm pull-right' do %>
|
27
27
|
<%= t('.change_driver') %>
|
28
28
|
<% end %>
|
29
|
-
<%= @device.
|
29
|
+
<%= @device.driver.class::NAME %>
|
30
30
|
</p>
|
31
31
|
<% else %>
|
32
|
-
<%= f.select :
|
32
|
+
<%= f.select :driver_class, options_for_drivers, { include_blank: true }, class: 'form-control' %>
|
33
|
+
<% if @device.driver.present? %>
|
34
|
+
<span class='text-danger'>Driver change will destroy current driver configuration!</span>
|
35
|
+
<% end %>
|
33
36
|
<% end %>
|
34
37
|
</div>
|
35
38
|
</div>
|
36
|
-
<%= fields_for :
|
37
|
-
<%= driver_settings fd, @device.
|
39
|
+
<%= fields_for :driver do |fd| %>
|
40
|
+
<%= driver_settings fd, @device.driver %>
|
38
41
|
<%= fields_for :serial_config do |fds| %>
|
39
42
|
<div class="form-group">
|
40
43
|
<div class='col-sm-offset-2 col-sm-10 col-md-8'>
|
41
44
|
<%= render 'extface/serial_configs/settings', f: fds %>
|
42
45
|
</div>
|
43
46
|
</div>
|
44
|
-
<% end if @device.
|
45
|
-
<% end if @device.
|
47
|
+
<% end if @device.driver.serial? %>
|
48
|
+
<% end if @device.driver.present? %>
|
46
49
|
<% end %>
|
@@ -26,7 +26,7 @@
|
|
26
26
|
<tr>
|
27
27
|
<td><%= link_to device.name, device %></td>
|
28
28
|
<td><%= device.extfaceable.composite_id %></td>
|
29
|
-
<td><%= device.
|
29
|
+
<td><%= device.driver ? device.driver.class::NAME : 'N/A' %></td>
|
30
30
|
<td class='text-right'><%= link_to 'Edit', edit_device_path(device), class: 'btn btn-primary btn-sm' %></td>
|
31
31
|
<td class='text-right'><%= button_to 'Delete', device, method: :delete, class: 'btn btn-danger btn-sm', data: { confirm: 'Are you sure?' } %></td>
|
32
32
|
</tr>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= __FILE__.gsub(Rails.root.to_s, "") %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class DropSeparateDriverTypeTables < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
drop_table :extface_pos_print_drivers
|
4
|
+
drop_table :extface_raw_drivers
|
5
|
+
drop_table :extface_fiscal_print_drivers
|
6
|
+
drop_table :extface_pbx_cdr_drivers
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
raise ActiveRecord::IrreversibleMigration
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class ChangeDriverPolymorphicToBelongsToExtfaceDevices < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_index :extface_devices, [:driveable_id, :driveable_type]
|
4
|
+
remove_column :extface_devices, :driveable_type
|
5
|
+
rename_column :extface_devices, :driveable_id, :driver_id
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
rename_column :extface_devices, :driver_id, :driveable_id
|
10
|
+
add_column :extface_devices, :driveable_type, :string
|
11
|
+
add_index :extface_devices, [:driveable_id, :driveable_type]
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class ChangePolymorphicToHasOneToExtfaceSerialConfigs < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_column :extface_serial_configs, :s_configureable_type
|
4
|
+
rename_column :extface_serial_configs, :s_configureable_id, :driver_id
|
5
|
+
end
|
6
|
+
|
7
|
+
def down
|
8
|
+
add_column :extface_serial_configs, :s_configureable_type, :string
|
9
|
+
rename_column :extface_serial_configs, :driver_id, :s_configureable_id
|
10
|
+
end
|
11
|
+
end
|
data/lib/extface.rb
CHANGED
@@ -5,6 +5,11 @@ require "extface/extfaceable"
|
|
5
5
|
require "extface/extfaceable"
|
6
6
|
require "redis-namespace"
|
7
7
|
module Extface
|
8
|
+
RAW_DRIVER = "Raw Communication Devices"
|
9
|
+
PRINT_DRIVER = "Print Devices"
|
10
|
+
FISCAL_DRIVER = "Fiscal Printers & Cash Registers"
|
11
|
+
REPORT_DRIVER = "CDR Loggers, Report Devices"
|
12
|
+
|
8
13
|
mattr_accessor :redis_connection_string
|
9
14
|
|
10
15
|
mattr_reader :mappings
|
data/lib/extface/mapping.rb
CHANGED
@@ -13,8 +13,9 @@ module Extface
|
|
13
13
|
# :shop_uuid then find_by! :uuid => params[:shop_uuid]
|
14
14
|
# :shop_id then find_by! :id => params[:shop_id]
|
15
15
|
@i_find_key = @i_param[/^(#{@name}_|)(\w+)/,2]
|
16
|
-
|
17
|
-
raise "
|
16
|
+
# FIXME not before schema load
|
17
|
+
#raise "#{@i_klass.name} has no method #{@i_find_key}" unless @i_klass.new.respond_to? @i_find_key
|
18
|
+
#raise "Did you forget to add 'has_extface_devices' in #{@i_klass.name} ?" unless @i_klass.new.respond_to? :extface_devices
|
18
19
|
@i_extra_module = options[:controller_include].to_s.constantize if options[:controller_include].present?
|
19
20
|
end
|
20
21
|
|
data/lib/extface/version.rb
CHANGED
@@ -19,7 +19,7 @@ module Extface
|
|
19
19
|
|
20
20
|
test "should create device" do
|
21
21
|
assert_difference('Device.count') do
|
22
|
-
post :create, shop_id: @device.extfaceable, use_route: :extface, device: {
|
22
|
+
post :create, shop_id: @device.extfaceable, use_route: :extface, device: { driver_class: 'Extface::Driver::GenericPos' }
|
23
23
|
end
|
24
24
|
|
25
25
|
assert_redirected_to device_path(assigns(:device))
|