smartkiosk-client 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
data/app/models/terminal.rb
CHANGED
data/app/workers/ping_worker.rb
CHANGED
@@ -37,21 +37,35 @@ class PingWorker
|
|
37
37
|
return
|
38
38
|
end
|
39
39
|
|
40
|
-
unless Terminal.support_phone.value == response[:support_phone]
|
41
|
-
Terminal.support_phone = response[:support_phone]
|
42
|
-
Terminal.modified_at = DateTime.now
|
43
|
-
end
|
44
|
-
|
45
40
|
Sidekiq::Logging.logger.info "Response: #{response.inspect}"
|
46
41
|
|
42
|
+
#
|
43
|
+
# PROFILE
|
44
|
+
#
|
45
|
+
unless Terminal.modified_at == response[:profile][:modified_at]
|
46
|
+
Terminal.support_phone = response[:profile][:support_phone]
|
47
|
+
Terminal.modified_at = response[:profile][:modified_at]
|
48
|
+
Sync::LogoWorker.perform_async response[:profile][:logo]
|
49
|
+
end
|
50
|
+
|
47
51
|
#
|
48
52
|
# ORDERS
|
49
53
|
#
|
50
|
-
response[:orders].each do |
|
51
|
-
|
54
|
+
response[:orders].each do |foreign|
|
55
|
+
existing = Order.find_by_foreign_id(foreign[:id])
|
56
|
+
|
57
|
+
unless existing.nil?
|
58
|
+
if existing.foreign_created_at == foreign[:created_at] || # same order, not yet acknowleged
|
59
|
+
!existing.complete? # not completed yet
|
60
|
+
next
|
61
|
+
end
|
62
|
+
|
63
|
+
existing.destroy
|
64
|
+
end
|
52
65
|
|
53
|
-
|
54
|
-
|
66
|
+
foreign[:foreign_id] = foreign.delete(:id)
|
67
|
+
foreign[:foreign_created_at] = foreign.delete(:created_at)
|
68
|
+
order = Order.create!(foreign)
|
55
69
|
|
56
70
|
order.acknowledge
|
57
71
|
order.perform
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
module Sync
|
4
|
+
class LogoWorker
|
5
|
+
include Sidekiq::Worker
|
6
|
+
|
7
|
+
sidekiq_options :retry => true, :queue => :sync
|
8
|
+
|
9
|
+
def perform(url)
|
10
|
+
if url.nil?
|
11
|
+
Terminal.logo_url = nil
|
12
|
+
else
|
13
|
+
uploader = IconUploader.new
|
14
|
+
uploader.download! "#{Terminal.config.host}/#{url}"
|
15
|
+
Terminal.logo_url = uploader.url
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/config/boot.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
class CreateOrders < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :orders do |t|
|
4
|
-
t.integer
|
5
|
-
t.
|
6
|
-
t.
|
7
|
-
t.
|
8
|
-
t.
|
9
|
-
t.boolean
|
4
|
+
t.integer :foreign_id
|
5
|
+
t.datetime :foreign_created_at
|
6
|
+
t.string :keyword
|
7
|
+
t.text :args
|
8
|
+
t.string :error
|
9
|
+
t.boolean :acknowledged
|
10
|
+
t.boolean :complete
|
10
11
|
|
11
12
|
t.timestamps
|
12
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartkiosk-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -554,6 +554,7 @@ files:
|
|
554
554
|
- app/workers/payments/pay_worker.rb
|
555
555
|
- app/workers/ping_worker.rb
|
556
556
|
- app/workers/sync/icons_worker.rb
|
557
|
+
- app/workers/sync/logo_worker.rb
|
557
558
|
- app/workers/sync/receipt_templates_worker.rb
|
558
559
|
- bin/smartkiosk-client
|
559
560
|
- config/boot.rb
|
@@ -606,7 +607,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
606
607
|
version: '0'
|
607
608
|
segments:
|
608
609
|
- 0
|
609
|
-
hash: -
|
610
|
+
hash: -4222507669661345488
|
610
611
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
611
612
|
none: false
|
612
613
|
requirements:
|
@@ -615,7 +616,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
615
616
|
version: '0'
|
616
617
|
segments:
|
617
618
|
- 0
|
618
|
-
hash: -
|
619
|
+
hash: -4222507669661345488
|
619
620
|
requirements: []
|
620
621
|
rubyforge_project:
|
621
622
|
rubygems_version: 1.8.24
|