extface 0.4.0 → 0.4.1a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/extface/devices_controller.rb +1 -0
  3. data/app/helpers/extface/application_helper.rb +2 -2
  4. data/app/models/extface/device.rb +1 -1
  5. data/app/models/extface/driver.rb +3 -4
  6. data/app/models/extface/driver/datecs/commands_v1.rb +30 -0
  7. data/app/models/extface/driver/datecs/fp550.rb +129 -0
  8. data/app/views/extface/driver/datecs/fp550/_control.html.erb +2 -0
  9. data/app/views/extface/driver/datecs/fp550/_settings.html.erb +0 -0
  10. data/lib/extface/version.rb +1 -1
  11. data/lib/generators/extface/driver/USAGE +15 -0
  12. data/lib/generators/extface/driver/driver_generator.rb +3 -0
  13. data/test/dummy/db/test.sqlite3 +0 -0
  14. data/test/dummy/log/development.log +10 -0
  15. data/test/dummy/log/test.log +12823 -0
  16. data/test/dummy/tmp/cache/assets/test/sprockets/0a8a23b1a73ebf217f4e2b765013ce7b +0 -0
  17. data/test/dummy/tmp/cache/assets/test/sprockets/21fb58a50e25d1170f2c7d5bd5d29c54 +0 -0
  18. data/test/dummy/tmp/cache/assets/test/sprockets/263375f2d55c31687ed052f99ddead55 +0 -0
  19. data/test/dummy/tmp/cache/assets/test/sprockets/265c1a0ad735604fec09a30dc1b8b50f +0 -0
  20. data/test/dummy/tmp/cache/assets/test/sprockets/3f4ff460a79b2e29781690193a3960f6 +0 -0
  21. data/test/dummy/tmp/cache/assets/test/sprockets/4ef10b222fde3c042209a46daf3d3e36 +0 -0
  22. data/test/dummy/tmp/cache/assets/test/sprockets/544650645bc510ef8fbee0043c41fdcf +0 -0
  23. data/test/dummy/tmp/cache/assets/test/sprockets/6dbf2b0443792e51055710be15c83197 +0 -0
  24. data/test/dummy/tmp/cache/assets/test/sprockets/717acb3e7c0df18696cf1bc56de6d3d5 +0 -0
  25. data/test/dummy/tmp/cache/assets/test/sprockets/88b0a473a5770f601b60e2e38e180a0f +0 -0
  26. data/test/dummy/tmp/cache/assets/test/sprockets/9891cbb0808f38b2c42f42fd89e662a4 +0 -0
  27. data/test/dummy/tmp/cache/assets/test/sprockets/9b178820b9dc8c81c9784cf7ee3b7d35 +0 -0
  28. data/test/dummy/tmp/cache/assets/test/sprockets/a06a4a7f51754a6a2c0694eb39ff824b +0 -0
  29. data/test/dummy/tmp/cache/assets/test/sprockets/a8cc2e73253025d2518d2449e16e5266 +0 -0
  30. data/test/dummy/tmp/cache/assets/test/sprockets/b56dfad0b14283f2cc10c62f37d71cc7 +0 -0
  31. data/test/dummy/tmp/cache/assets/test/sprockets/e1197e0129ade843b08de0b45c47fc40 +0 -0
  32. data/test/dummy/tmp/cache/assets/test/sprockets/ece3270b150db7c668579bb91ac7e2e5 +0 -0
  33. data/test/dummy/tmp/cache/assets/test/sprockets/f018ab87f3490dbbcbc2e3c9f36aed3d +0 -0
  34. data/test/fixtures/extface/devices.yml +6 -0
  35. data/test/fixtures/extface/drivers.yml +4 -1
  36. data/test/lib/generators/extface/driver_generator_test.rb +16 -0
  37. data/test/models/extface/driver/datecs/fp550_test.rb +49 -0
  38. data/test/test_helper.rb +12 -0
  39. metadata +32 -4
@@ -11,3 +11,9 @@ two:
11
11
  name: MyString2
12
12
  extfaceable: one(Shop)
13
13
  driver: star_scp700
14
+
15
+ datecs_fp550:
16
+ uuid: datect_fp550
17
+ name: Datect FP550
18
+ extfaceable: one(Shop)
19
+ driver: datecs_fp550
@@ -7,4 +7,7 @@ star_tsp200:
7
7
  type: Extface::Driver::StarTsp200
8
8
 
9
9
  star_scp700:
10
- type: Extface::Driver::StarScp700
10
+ type: Extface::Driver::StarScp700
11
+
12
+ datecs_fp550:
13
+ type: Extface::Driver::Datecs::Fp550
@@ -0,0 +1,16 @@
1
+ require 'test_helper'
2
+ require 'generators/extface/driver/driver_generator'
3
+
4
+ module Extface
5
+ class DriverGeneratorTest < Rails::Generators::TestCase
6
+ tests Extface::DriverGenerator
7
+ destination Rails.root.join('tmp/generators')
8
+ setup :prepare_destination
9
+
10
+ # test "generator runs without errors" do
11
+ # assert_nothing_raised do
12
+ # run_generator ["arguments"]
13
+ # end
14
+ # end
15
+ end
16
+ end
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ module Extface
4
+ class Driver::Datecs::Fp550Test < ActiveSupport::TestCase
5
+ setup do
6
+ @driver = extface_drivers(:datecs_fp550)
7
+ @driver.flush # clear receive buffer
8
+ end
9
+
10
+ test "handle" do
11
+ assert_equal nil, @driver.handle('bad packet')
12
+ assert_equal 6, @driver.handle("\x01data\x03data"), "Frame not match"
13
+ assert_equal 9, @driver.handle("pre\x01data\x03data"), "Frame with preamble not match"
14
+ assert_equal 1, @driver.handle("\x16\x16\x01data\x03data"), "Frame with ACK preamble not match"
15
+ assert_equal 4, @driver.handle("pre\x15"), "NAK not match"
16
+ end
17
+
18
+ test "build packet" do
19
+ assert_equal "\x01\x24\x20\x4a\x05\x30\x30\x39\x33\x03".b, @driver.build_packet(0x4a), "packet without data"
20
+ assert_equal "\x01\x25\x21\x4a\x58\x05\x30\x30\x3e\x3d\x03".b, @driver.build_packet(0x4a, 'X'), "packet with data"
21
+ end
22
+
23
+ test "response frame" do
24
+ frame_class = @driver.class::Frame
25
+ assert frame_class.new("\x15").nak?, "NAK message failed"
26
+ assert frame_class.new("\x16\x16").ack?, "ACK message failed"
27
+ assert_nothing_raised do
28
+ assert_equal false, frame_class.new("bad data\x01\x25\x21\x4asome broken packet\x58\x05\x30\x30\x3e\x3d\x03".b).valid?
29
+ end
30
+ frame = frame_class.new("\x16\x01\x2C\x2F\x2D\x50\x04\x88\x80\xC0\x80\x80\xB0\x05\x30\x34\x35\x39\x03".b)
31
+ assert frame.valid?, "Vailid frame not recognized"
32
+ assert_equal "\x01\x2C\x2F\x2D\x50\x04\x88\x80\xC0\x80\x80\xB0\x05\x30\x34\x35\x39\x03".b, frame.frame
33
+ assert_equal "\x2c".b, frame.len
34
+ assert_equal "\x2f".b, frame.seq
35
+ assert_equal "\x2d".b, frame.cmd
36
+ assert_equal "\x50".b, frame.data
37
+ assert_equal "\x88\x80\xC0\x80\x80\xB0".b, frame.status
38
+ assert_equal "\x30\x34\x35\x39".b, frame.bcc
39
+ #bad check sum
40
+ frame = frame_class.new("\x01\x2C\x2F\x2D\x50\x04\x88\x80\xC0\x80\x80\xB0\x05\x30\x34\x35\x38\x03".b)
41
+ assert_equal false, frame.valid?
42
+ assert frame.errors.messages[:bcc]
43
+ #bad length
44
+ frame = frame_class.new("\x01\x2b\x2F\x2D\x50\x04\x88\x80\xC0\x80\x80\xB0\x05\x30\x34\x35\x38\x03".b)
45
+ assert_equal false, frame.valid?
46
+ assert frame.errors.messages[:len]
47
+ end
48
+ end
49
+ end
data/test/test_helper.rb CHANGED
@@ -25,5 +25,17 @@ module Extface
25
25
  setup do
26
26
  @routes = Extface::Engine.routes
27
27
  end
28
+ module Behavior
29
+ def process_with_shop(action, http_method = 'GET', parameters = nil, session = nil, flash = nil)
30
+ parameters = { shop_id: shops(:one) }.merge(parameters || {})
31
+ process_without_shop(action, http_method, parameters, session, flash)
32
+ end
33
+ alias_method_chain :process, :shop
34
+ end
35
+ end
36
+ class ActionDispatch::Routing::RouteSet
37
+ def default_url_options(options={})
38
+ options.merge(shop_id: Shop.first)
39
+ end
28
40
  end
29
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extface
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Vangelov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-07 00:00:00.000000000 Z
11
+ date: 2014-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: billing
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Extface allows use of Cash Registers, Fiscal and POS printers without
70
84
  physical connection between the device, application server and the end user. Can
71
85
  also be used for remotely reading CDR logs from PBX systems and actually supports
@@ -100,6 +114,8 @@ files:
100
114
  - app/models/extface/driver/base/fiscal.rb
101
115
  - app/models/extface/driver/daisy/commands_fx1200.rb
102
116
  - app/models/extface/driver/daisy_fx1200.rb
117
+ - app/models/extface/driver/datecs/commands_v1.rb
118
+ - app/models/extface/driver/datecs/fp550.rb
103
119
  - app/models/extface/driver/eltrade/commands_fp4.rb
104
120
  - app/models/extface/driver/eltrade_tm_u220.rb
105
121
  - app/models/extface/driver/generic_pos.rb
@@ -116,6 +132,8 @@ files:
116
132
  - app/views/extface/driver/_control_raw.html.erb
117
133
  - app/views/extface/driver/_control_report.html.erb
118
134
  - app/views/extface/driver/daisy_fx1200/_settings.html.erb
135
+ - app/views/extface/driver/datecs/fp550/_control.html.erb
136
+ - app/views/extface/driver/datecs/fp550/_settings.html.erb
119
137
  - app/views/extface/driver/eltrade_tm_u220/_control_.html.erb
120
138
  - app/views/extface/driver/eltrade_tm_u220/_settings.html.erb
121
139
  - app/views/extface/driver/generic_pos/_settings.html.erb
@@ -142,6 +160,8 @@ files:
142
160
  - lib/extface/mapping.rb
143
161
  - lib/extface/routes.rb
144
162
  - lib/extface/version.rb
163
+ - lib/generators/extface/driver/USAGE
164
+ - lib/generators/extface/driver/driver_generator.rb
145
165
  - lib/tasks/extface_tasks.rake
146
166
  - test/controllers/extface/devices_controller_test.rb
147
167
  - test/controllers/extface/jobs_controller_test.rb
@@ -186,11 +206,13 @@ files:
186
206
  - test/dummy/tmp/cache/assets/test/sprockets/0a8a23b1a73ebf217f4e2b765013ce7b
187
207
  - test/dummy/tmp/cache/assets/test/sprockets/21fb58a50e25d1170f2c7d5bd5d29c54
188
208
  - test/dummy/tmp/cache/assets/test/sprockets/263375f2d55c31687ed052f99ddead55
209
+ - test/dummy/tmp/cache/assets/test/sprockets/265c1a0ad735604fec09a30dc1b8b50f
189
210
  - test/dummy/tmp/cache/assets/test/sprockets/3f4ff460a79b2e29781690193a3960f6
190
211
  - test/dummy/tmp/cache/assets/test/sprockets/4ef10b222fde3c042209a46daf3d3e36
191
212
  - test/dummy/tmp/cache/assets/test/sprockets/544650645bc510ef8fbee0043c41fdcf
192
213
  - test/dummy/tmp/cache/assets/test/sprockets/6dbf2b0443792e51055710be15c83197
193
214
  - test/dummy/tmp/cache/assets/test/sprockets/717acb3e7c0df18696cf1bc56de6d3d5
215
+ - test/dummy/tmp/cache/assets/test/sprockets/88b0a473a5770f601b60e2e38e180a0f
194
216
  - test/dummy/tmp/cache/assets/test/sprockets/9891cbb0808f38b2c42f42fd89e662a4
195
217
  - test/dummy/tmp/cache/assets/test/sprockets/9b178820b9dc8c81c9784cf7ee3b7d35
196
218
  - test/dummy/tmp/cache/assets/test/sprockets/a06a4a7f51754a6a2c0694eb39ff824b
@@ -209,7 +231,9 @@ files:
209
231
  - test/helpers/extface/jobs_helper_test.rb
210
232
  - test/helpers/extface/sse_helper_test.rb
211
233
  - test/integration/navigation_test.rb
234
+ - test/lib/generators/extface/driver_generator_test.rb
212
235
  - test/models/extface/device_test.rb
236
+ - test/models/extface/driver/datecs/fp550_test.rb
213
237
  - test/models/extface/driver/generic_pos_test.rb
214
238
  - test/models/extface/driver/star_scp700_test.rb
215
239
  - test/models/extface/driver/star_tsp200_test.rb
@@ -231,9 +255,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
255
  version: '0'
232
256
  required_rubygems_version: !ruby/object:Gem::Requirement
233
257
  requirements:
234
- - - ">="
258
+ - - ">"
235
259
  - !ruby/object:Gem::Version
236
- version: '0'
260
+ version: 1.3.1
237
261
  requirements: []
238
262
  rubyforge_project:
239
263
  rubygems_version: 2.2.2
@@ -241,6 +265,7 @@ signing_key:
241
265
  specification_version: 4
242
266
  summary: External Interfaces for Cloud-Based Applications (Rails 4)
243
267
  test_files:
268
+ - test/lib/generators/extface/driver_generator_test.rb
244
269
  - test/fixtures/extface/serial_configs.yml
245
270
  - test/fixtures/extface/devices.yml
246
271
  - test/fixtures/extface/drivers.yml
@@ -249,6 +274,7 @@ test_files:
249
274
  - test/test_helper.rb
250
275
  - test/controllers/extface/devices_controller_test.rb
251
276
  - test/controllers/extface/jobs_controller_test.rb
277
+ - test/dummy/tmp/cache/assets/test/sprockets/265c1a0ad735604fec09a30dc1b8b50f
252
278
  - test/dummy/tmp/cache/assets/test/sprockets/0a8a23b1a73ebf217f4e2b765013ce7b
253
279
  - test/dummy/tmp/cache/assets/test/sprockets/4ef10b222fde3c042209a46daf3d3e36
254
280
  - test/dummy/tmp/cache/assets/test/sprockets/ece3270b150db7c668579bb91ac7e2e5
@@ -264,6 +290,7 @@ test_files:
264
290
  - test/dummy/tmp/cache/assets/test/sprockets/717acb3e7c0df18696cf1bc56de6d3d5
265
291
  - test/dummy/tmp/cache/assets/test/sprockets/3f4ff460a79b2e29781690193a3960f6
266
292
  - test/dummy/tmp/cache/assets/test/sprockets/a8cc2e73253025d2518d2449e16e5266
293
+ - test/dummy/tmp/cache/assets/test/sprockets/88b0a473a5770f601b60e2e38e180a0f
267
294
  - test/dummy/tmp/cache/assets/test/sprockets/a06a4a7f51754a6a2c0694eb39ff824b
268
295
  - test/dummy/config.ru
269
296
  - test/dummy/log/development.log
@@ -312,6 +339,7 @@ test_files:
312
339
  - test/models/extface/driver/generic_pos_test.rb
313
340
  - test/models/extface/driver/star_scp700_test.rb
314
341
  - test/models/extface/driver/star_tsp200_test.rb
342
+ - test/models/extface/driver/datecs/fp550_test.rb
315
343
  - test/models/extface/serial_config_test.rb
316
344
  - test/models/extface/device_test.rb
317
345
  - test/models/extface/driver_test.rb