order2cb 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +65 -0
- data/README.md +5 -3
- data/lib/order2cb/order.rb +1 -1
- data/lib/order2cb/version.rb +1 -1
- data/lib/order2cb.rb +1 -3
- data/order2cb.gemspec +7 -9
- data/test/lib/order2cb_test.rb +0 -5
- metadata +32 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b87908d056ed10052530a922a4a2fcd51a20b1d
|
4
|
+
data.tar.gz: 811b5da571c382d73e56262a00149773fe494da8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40f722969c5cae48ba84dec6d3adc011892b11bd0ae2e948b5fae1c1c86c9adadb428af67f9f76a1e228abc389fc92a65e1a688c6a445397ce0d51b8b793d85d
|
7
|
+
data.tar.gz: 079bf927568986894866ed835af1728693afc1470a75e1650180a727153ed6627f16ac9b82e719a63e03bbacf73c8d8e174aacdb0b095c40dfdca2e98ed6a075
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
order2cb (0.0.8)
|
5
|
+
actionview (= 4.2.6)
|
6
|
+
activesupport (= 4.2.6)
|
7
|
+
mysql2 (= 0.4.4)
|
8
|
+
rest-client (= 1.7.3)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
actionview (4.2.6)
|
14
|
+
activesupport (= 4.2.6)
|
15
|
+
builder (~> 3.1)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
18
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
19
|
+
activesupport (4.2.6)
|
20
|
+
i18n (~> 0.7)
|
21
|
+
json (~> 1.7, >= 1.7.7)
|
22
|
+
minitest (~> 5.1)
|
23
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
24
|
+
tzinfo (~> 1.1)
|
25
|
+
awesome_print (1.6.1)
|
26
|
+
builder (3.2.2)
|
27
|
+
erubis (2.7.0)
|
28
|
+
i18n (0.7.0)
|
29
|
+
json (1.8.3)
|
30
|
+
loofah (2.0.3)
|
31
|
+
nokogiri (>= 1.5.9)
|
32
|
+
mime-types (2.99.2)
|
33
|
+
mini_portile2 (2.0.0)
|
34
|
+
minitest (5.9.0)
|
35
|
+
mysql2 (0.4.4)
|
36
|
+
netrc (0.11.0)
|
37
|
+
nokogiri (1.6.7.2)
|
38
|
+
mini_portile2 (~> 2.0.0.rc2)
|
39
|
+
rails-deprecated_sanitizer (1.0.3)
|
40
|
+
activesupport (>= 4.2.0.alpha)
|
41
|
+
rails-dom-testing (1.0.7)
|
42
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
43
|
+
nokogiri (~> 1.6.0)
|
44
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
45
|
+
rails-html-sanitizer (1.0.3)
|
46
|
+
loofah (~> 2.0)
|
47
|
+
rake (11.1.2)
|
48
|
+
rest-client (1.7.3)
|
49
|
+
mime-types (>= 1.16, < 3.0)
|
50
|
+
netrc (~> 0.7)
|
51
|
+
thread_safe (0.3.5)
|
52
|
+
tzinfo (1.2.2)
|
53
|
+
thread_safe (~> 0.1)
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
|
58
|
+
DEPENDENCIES
|
59
|
+
awesome_print (= 1.6.1)
|
60
|
+
bundler (= 1.12.5)
|
61
|
+
order2cb!
|
62
|
+
rake (= 11.1.2)
|
63
|
+
|
64
|
+
BUNDLED WITH
|
65
|
+
1.12.5
|
data/README.md
CHANGED
@@ -20,11 +20,13 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
Ensure the following environment variables are set:
|
22
22
|
|
23
|
-
AWS_ACCESS_KEY=...
|
24
|
-
AWS_SECRET_ACCESS_KEY=...
|
25
|
-
CB_QUEUE=https://sqs.<region>.amazonaws.com/<account-id>/<caseblocks-queue>
|
26
23
|
CB_API_ENDPOINT=https://<subdomain>.caseblocks.com
|
27
24
|
CB_API_TOKEN=...
|
25
|
+
CB_CASE_TYPE_ID=your_casetypeid
|
26
|
+
DB_HOST=database_hostname
|
27
|
+
DB_USER=your_username
|
28
|
+
DB_PASSWORD=your_password
|
29
|
+
DB_NAME=your_database_name
|
28
30
|
|
29
31
|
And run the daemon from the CLI
|
30
32
|
|
data/lib/order2cb/order.rb
CHANGED
@@ -72,7 +72,7 @@ module Order2cb
|
|
72
72
|
'tyre_shopper_risk_assessment_notes' => @data['risk_score_reasons'],
|
73
73
|
'order_source' => 'TyreShopper',
|
74
74
|
'is_van_tyre' => short_codes.include?("VN"),
|
75
|
-
'is_winter_tyre' => short_codes.include?("
|
75
|
+
'is_winter_tyre' => short_codes.include?("W"),
|
76
76
|
'is_4x4_tyre' => short_codes.include?("4X"),
|
77
77
|
'is_run_flat_tyre' => short_codes.include?("RF"),
|
78
78
|
# set time to + 5 hours
|
data/lib/order2cb/version.rb
CHANGED
data/lib/order2cb.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative "order2cb/version"
|
2
2
|
require_relative "order2cb/order"
|
3
3
|
require_relative "order2cb/caseblocks"
|
4
|
-
require 'aws-sdk-v1'
|
5
4
|
require 'json'
|
6
5
|
require 'rest_client'
|
7
6
|
require 'logger'
|
@@ -16,7 +15,6 @@ module Order2cb
|
|
16
15
|
def initialize
|
17
16
|
@caseBlocksAPIEndpoint = ENV['CB_API_ENDPOINT']
|
18
17
|
@caseBlocksAPIToken = ENV['CB_API_TOKEN']
|
19
|
-
@caseBlocksQueue = ENV['CB_QUEUE']
|
20
18
|
@caseBlocksCaseTypeID = ENV['CB_CASE_TYPE_ID']
|
21
19
|
|
22
20
|
@tyreshopperDatabaseHost = ENV['DB_HOST']
|
@@ -26,7 +24,6 @@ module Order2cb
|
|
26
24
|
|
27
25
|
@interval = ENV['CHECK_INTERVAL'] ? ENV['CHECK_INTERVAL'] : 60
|
28
26
|
|
29
|
-
@usePatchCommand = (@caseBlocksQueue =~ /patch/)
|
30
27
|
logfile = ENV['ORDER2CB_LOGFILE_PATH'].nil? ? STDOUT : File.open(ENV['ORDER2CB_LOGFILE_PATH'], 'a')
|
31
28
|
logfile.sync = true
|
32
29
|
@logger = Logger.new logfile
|
@@ -85,6 +82,7 @@ module Order2cb
|
|
85
82
|
order = ::Order2cb::Order.find(order_number)
|
86
83
|
unless caseblocks.order_exists?(order)
|
87
84
|
# @logger.debug "#{order.number} doesn't exist in caseblocks, sending it now"
|
85
|
+
@logger.debug order.to_json
|
88
86
|
if caseblocks.create_order(order)
|
89
87
|
@logger.info "Sent #{order.number} to caseblocks."
|
90
88
|
else
|
data/order2cb.gemspec
CHANGED
@@ -18,16 +18,14 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "
|
22
|
-
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "awesome_print"
|
21
|
+
spec.add_development_dependency "bundler", "1.12.5"
|
22
|
+
spec.add_development_dependency "rake", "11.1.2"
|
23
|
+
spec.add_development_dependency "awesome_print", "1.6.1"
|
24
24
|
|
25
|
-
spec.add_dependency '
|
26
|
-
spec.add_dependency '
|
27
|
-
spec.add_dependency '
|
28
|
-
spec.add_dependency '
|
29
|
-
spec.add_dependency 'actionview', "~> 4.2.1"
|
30
|
-
spec.add_dependency 'caseblocks_api'
|
25
|
+
spec.add_dependency 'rest-client', "1.7.3"
|
26
|
+
spec.add_dependency 'mysql2', "0.4.4"
|
27
|
+
spec.add_dependency 'activesupport', "4.2.6"
|
28
|
+
spec.add_dependency 'actionview', "4.2.6"
|
31
29
|
|
32
30
|
|
33
31
|
|
data/test/lib/order2cb_test.rb
CHANGED
@@ -6,20 +6,15 @@ class MessageHandlerTest < MiniTest::Unit::TestCase
|
|
6
6
|
ENV['CB_API_TOKEN'] = '1234'
|
7
7
|
end
|
8
8
|
def test_invalid_construction
|
9
|
-
ENV['AWS_ACCESS_KEY'] = nil
|
10
|
-
ENV['AWS_SECRET_ACCESS_KEY'] = nil
|
11
9
|
ENV['CB_API_ENDPOINT'] = nil
|
12
10
|
ENV['CB_API_TOKEN'] = nil
|
13
11
|
assert_raises(RuntimeError) { Order2cb::OrderHandler.new }
|
14
12
|
end
|
15
13
|
def test_valid_construction
|
16
|
-
ENV['AWS_ACCESS_KEY'] = 'access'
|
17
|
-
ENV['AWS_SECRET_ACCESS_KEY'] = 'secret'
|
18
14
|
refute_nil Order2cb::OrderHandler.new
|
19
15
|
end
|
20
16
|
def test_basic_sqs_connectivity
|
21
17
|
oh = Order2cb::OrderHandler.new
|
22
18
|
result = oh.send_orders
|
23
|
-
|
24
19
|
end
|
25
20
|
end
|
metadata
CHANGED
@@ -1,141 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: order2cb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- EmergeAdapt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.12.5
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.12.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 11.1.2
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 11.1.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: awesome_print
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.6.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: aws-sdk-v1
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.60.2
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 1.60.2
|
54
|
+
version: 1.6.1
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rest-client
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - '='
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.7.
|
61
|
+
version: 1.7.3
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - '='
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.7.
|
68
|
+
version: 1.7.3
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: mysql2
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - '='
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.4.
|
75
|
+
version: 0.4.4
|
90
76
|
type: :runtime
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - '='
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.4.
|
82
|
+
version: 0.4.4
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: activesupport
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- -
|
87
|
+
- - '='
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: 4.2.
|
89
|
+
version: 4.2.6
|
104
90
|
type: :runtime
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- -
|
94
|
+
- - '='
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: 4.2.
|
96
|
+
version: 4.2.6
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: actionview
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 4.2.1
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 4.2.1
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: caseblocks_api
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
101
|
+
- - '='
|
130
102
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
103
|
+
version: 4.2.6
|
132
104
|
type: :runtime
|
133
105
|
prerelease: false
|
134
106
|
version_requirements: !ruby/object:Gem::Requirement
|
135
107
|
requirements:
|
136
|
-
- -
|
108
|
+
- - '='
|
137
109
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
110
|
+
version: 4.2.6
|
139
111
|
description: Basic WIP.
|
140
112
|
email:
|
141
113
|
- development@emergeadapt.com
|
@@ -149,6 +121,7 @@ files:
|
|
149
121
|
- ".ruby-gemset"
|
150
122
|
- ".ruby-version"
|
151
123
|
- Gemfile
|
124
|
+
- Gemfile.lock
|
152
125
|
- LICENSE
|
153
126
|
- LICENSE.txt
|
154
127
|
- README.md
|
@@ -184,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
157
|
version: '0'
|
185
158
|
requirements: []
|
186
159
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.5.1
|
188
161
|
signing_key:
|
189
162
|
specification_version: 4
|
190
163
|
summary: Grabs orders from Tyreshopper and posts them to SQS.
|