constructorio 2.0.11 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/constructorio/client.rb +4 -0
- data/lib/constructorio/version.rb +1 -1
- data/test/constructorio_test.rb +18 -0
- data/test/constructorio_vcr_test.rb +29 -12
- data/test/fixtures/vcr_cassettes/add_batch.yml +6 -56
- data/test/fixtures/vcr_cassettes/add_or_update_batch.yml +6 -5
- data/test/fixtures/vcr_cassettes/add_or_update_item.yml +0 -48
- data/test/fixtures/vcr_cassettes/remove_batch.yml +53 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab196a51451afa8b2a68fb497909a74c4564b837
|
4
|
+
data.tar.gz: a5481b715838f451ca12235c008411057a37f366
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3997f3da91ebe0a3ed47854d3c7a65cbc36756f2f8caae51522133d81823f8adb09225b38b5b192c8a5f34a60b1aa296f99a9d09fd158d0d3d919dad7f6eeecd
|
7
|
+
data.tar.gz: c809327cd71fd37797303f69b391701e245bf2ab353fad5543f9fa52c935ec56cca15073a3967a0debc1396b728b6eadb65935ab9fc0a0ea72493bf8c5b49689
|
data/lib/constructorio/client.rb
CHANGED
data/test/constructorio_test.rb
CHANGED
@@ -187,4 +187,22 @@ class ConstructorIOTest < MiniTest::Test
|
|
187
187
|
}
|
188
188
|
)
|
189
189
|
end
|
190
|
+
|
191
|
+
def test_remove_batch_sends_request
|
192
|
+
c = ConstructorIO::Client.new
|
193
|
+
c.expects(:send_request).with(
|
194
|
+
"batch_items",
|
195
|
+
"delete",
|
196
|
+
instance_of(Faraday::Connection),
|
197
|
+
{ autocomplete_section: "Products", items: [ { item_name: "item" } ] },
|
198
|
+
"example_autocomplete_key",
|
199
|
+
{}
|
200
|
+
)
|
201
|
+
c.remove_batch(
|
202
|
+
{
|
203
|
+
autocomplete_section: "Products",
|
204
|
+
items: [ { item_name: "item" } ]
|
205
|
+
}
|
206
|
+
)
|
207
|
+
end
|
190
208
|
end
|
@@ -36,12 +36,12 @@ class ConstructorIOVCRTest < MiniTest::Test
|
|
36
36
|
VCR.use_cassette("add_batch") do
|
37
37
|
response = c.add_batch(
|
38
38
|
autocomplete_section: "standard",
|
39
|
-
items: [
|
40
|
-
item_name: "power drill
|
41
|
-
item_name: "power drill
|
42
|
-
item_name: "power drill
|
43
|
-
item_name: "power drill
|
44
|
-
|
39
|
+
items: [
|
40
|
+
{ item_name: "power drill x11" },
|
41
|
+
{ item_name: "power drill x12" },
|
42
|
+
{ item_name: "power drill x13" },
|
43
|
+
{ item_name: "power drill x14" },
|
44
|
+
]
|
45
45
|
)
|
46
46
|
assert_equal response.status, 204
|
47
47
|
end
|
@@ -53,12 +53,12 @@ class ConstructorIOVCRTest < MiniTest::Test
|
|
53
53
|
VCR.use_cassette("add_or_update_batch") do
|
54
54
|
response = c.add_or_update_batch(
|
55
55
|
autocomplete_section: "standard",
|
56
|
-
items: [
|
57
|
-
item_name: "power drill x1",
|
58
|
-
item_name: "power drill x2",
|
59
|
-
item_name: "power drill x3",
|
60
|
-
item_name: "power drill x4",
|
61
|
-
|
56
|
+
items: [
|
57
|
+
{ item_name: "power drill x1" },
|
58
|
+
{ item_name: "power drill x2" },
|
59
|
+
{ item_name: "power drill x3" },
|
60
|
+
{ item_name: "power drill x4" },
|
61
|
+
]
|
62
62
|
)
|
63
63
|
assert_equal response.status, 204
|
64
64
|
end
|
@@ -75,6 +75,23 @@ class ConstructorIOVCRTest < MiniTest::Test
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
def test_remove_batch
|
79
|
+
c = ConstructorIO::Client.new
|
80
|
+
|
81
|
+
VCR.use_cassette("remove_batch") do
|
82
|
+
response = c.remove_batch(
|
83
|
+
autocomplete_section: "standard",
|
84
|
+
items: [
|
85
|
+
{ item_name: "power_drill x1" },
|
86
|
+
{ item_name: "power_drill x2" },
|
87
|
+
{ item_name: "power_drill x3" },
|
88
|
+
{ item_name: "power_drill x4" },
|
89
|
+
]
|
90
|
+
)
|
91
|
+
assert_equal response.status, 204
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
78
95
|
def test_modify_item
|
79
96
|
c = ConstructorIO::Client.new
|
80
97
|
|
@@ -6,7 +6,8 @@ http_interactions:
|
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: '{"autocomplete_section":"standard","items":[{"item_name":"power drill
|
9
|
-
|
9
|
+
x11"},{"item_name":"power drill x12"},{"item_name":"power drill x13"},{"item_name":"power
|
10
|
+
drill x14"}]}'
|
10
11
|
headers:
|
11
12
|
User-Agent:
|
12
13
|
- Faraday v0.9.1
|
@@ -30,74 +31,23 @@ http_interactions:
|
|
30
31
|
Content-Type:
|
31
32
|
- text/html; charset=utf-8
|
32
33
|
Date:
|
33
|
-
-
|
34
|
+
- Tue, 07 Jun 2016 03:39:56 GMT
|
34
35
|
Server:
|
35
36
|
- nginx/1.4.6 (Ubuntu)
|
36
37
|
Set-Cookie:
|
37
|
-
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.
|
38
|
+
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.CjfTjA.o2g9zUSNBd574QtwB33OjGP20ZU;
|
38
39
|
HttpOnly; Path=/
|
39
40
|
Strict-Transport-Security:
|
40
41
|
- max-age=31536000
|
41
42
|
Via:
|
42
43
|
- 1.1 varnish
|
43
44
|
X-Varnish:
|
44
|
-
- '
|
45
|
+
- '726243420'
|
45
46
|
Connection:
|
46
47
|
- keep-alive
|
47
48
|
body:
|
48
49
|
encoding: UTF-8
|
49
50
|
string: ''
|
50
51
|
http_version:
|
51
|
-
recorded_at:
|
52
|
-
- request:
|
53
|
-
method: post
|
54
|
-
uri: https://IC9WGYro9O8o5orJW7p2:@devac.cnstrc.com/v1/batch_items?autocomplete_key=Du08voCN2t3IKdUhSepw
|
55
|
-
body:
|
56
|
-
encoding: UTF-8
|
57
|
-
string: '{"autocomplete_section":"standard","items":[{"item_name":"power drill
|
58
|
-
x4"}]}'
|
59
|
-
headers:
|
60
|
-
User-Agent:
|
61
|
-
- Faraday v0.9.1
|
62
|
-
Content-Type:
|
63
|
-
- application/json
|
64
|
-
Accept-Encoding:
|
65
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
66
|
-
Accept:
|
67
|
-
- "*/*"
|
68
|
-
response:
|
69
|
-
status:
|
70
|
-
code: 400
|
71
|
-
message: BAD REQUEST
|
72
|
-
headers:
|
73
|
-
Accept-Ranges:
|
74
|
-
- bytes
|
75
|
-
Age:
|
76
|
-
- '0'
|
77
|
-
Content-Type:
|
78
|
-
- application/json
|
79
|
-
Date:
|
80
|
-
- Wed, 13 Apr 2016 03:27:23 GMT
|
81
|
-
Server:
|
82
|
-
- nginx/1.4.6 (Ubuntu)
|
83
|
-
Set-Cookie:
|
84
|
-
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.Ce9OGw.EG_jTI4OybnYOTdNdcy63ZFq90I;
|
85
|
-
HttpOnly; Path=/
|
86
|
-
Strict-Transport-Security:
|
87
|
-
- max-age=31536000
|
88
|
-
Via:
|
89
|
-
- 1.1 varnish
|
90
|
-
X-Varnish:
|
91
|
-
- '205905765'
|
92
|
-
Content-Length:
|
93
|
-
- '174'
|
94
|
-
Connection:
|
95
|
-
- keep-alive
|
96
|
-
body:
|
97
|
-
encoding: UTF-8
|
98
|
-
string: "{\n \"error_items\": [\n {\n \"item_name\": \"power drill
|
99
|
-
x4\"\n }\n ], \n \"message\": \"That item already exists. Please use
|
100
|
-
the modify or add_or_update API to modify it.\"\n}"
|
101
|
-
http_version:
|
102
|
-
recorded_at: Wed, 13 Apr 2016 03:27:24 GMT
|
52
|
+
recorded_at: Tue, 07 Jun 2016 03:39:56 GMT
|
103
53
|
recorded_with: VCR 2.9.3
|
@@ -6,7 +6,8 @@ http_interactions:
|
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: '{"autocomplete_section":"standard","items":[{"item_name":"power drill
|
9
|
-
|
9
|
+
x1"},{"item_name":"power drill x2"},{"item_name":"power drill x3"},{"item_name":"power
|
10
|
+
drill x4"}]}'
|
10
11
|
headers:
|
11
12
|
User-Agent:
|
12
13
|
- Faraday v0.9.1
|
@@ -30,23 +31,23 @@ http_interactions:
|
|
30
31
|
Content-Type:
|
31
32
|
- text/html; charset=utf-8
|
32
33
|
Date:
|
33
|
-
-
|
34
|
+
- Tue, 07 Jun 2016 03:14:14 GMT
|
34
35
|
Server:
|
35
36
|
- nginx/1.4.6 (Ubuntu)
|
36
37
|
Set-Cookie:
|
37
|
-
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.
|
38
|
+
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.CjfNhg.8qcLG7yjDcmjumAfaKXGoX6vj1U;
|
38
39
|
HttpOnly; Path=/
|
39
40
|
Strict-Transport-Security:
|
40
41
|
- max-age=31536000
|
41
42
|
Via:
|
42
43
|
- 1.1 varnish
|
43
44
|
X-Varnish:
|
44
|
-
- '
|
45
|
+
- '726242482'
|
45
46
|
Connection:
|
46
47
|
- keep-alive
|
47
48
|
body:
|
48
49
|
encoding: UTF-8
|
49
50
|
string: ''
|
50
51
|
http_version:
|
51
|
-
recorded_at:
|
52
|
+
recorded_at: Tue, 07 Jun 2016 03:14:14 GMT
|
52
53
|
recorded_with: VCR 2.9.3
|
@@ -48,52 +48,4 @@ http_interactions:
|
|
48
48
|
string: ''
|
49
49
|
http_version:
|
50
50
|
recorded_at: Tue, 12 Apr 2016 21:55:33 GMT
|
51
|
-
- request:
|
52
|
-
method: put
|
53
|
-
uri: https://IC9WGYro9O8o5orJW7p2:@devac.cnstrc.com/v1/item?autocomplete_key=Du08voCN2t3IKdUhSepw&force=1
|
54
|
-
body:
|
55
|
-
encoding: UTF-8
|
56
|
-
string: '{"item_name":"power_drill","autocomplete_section":"standard"}'
|
57
|
-
headers:
|
58
|
-
User-Agent:
|
59
|
-
- Faraday v0.9.1
|
60
|
-
Content-Type:
|
61
|
-
- application/json
|
62
|
-
Accept-Encoding:
|
63
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
64
|
-
Accept:
|
65
|
-
- "*/*"
|
66
|
-
response:
|
67
|
-
status:
|
68
|
-
code: 204
|
69
|
-
message: NO CONTENT
|
70
|
-
headers:
|
71
|
-
Accept-Ranges:
|
72
|
-
- bytes
|
73
|
-
Age:
|
74
|
-
- '0'
|
75
|
-
Content-Length:
|
76
|
-
- '0'
|
77
|
-
Content-Type:
|
78
|
-
- text/html; charset=utf-8
|
79
|
-
Date:
|
80
|
-
- Wed, 13 Apr 2016 03:24:20 GMT
|
81
|
-
Server:
|
82
|
-
- nginx/1.4.6 (Ubuntu)
|
83
|
-
Set-Cookie:
|
84
|
-
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.Ce9NZA.JhmSluWZXZzLgDIGhUBA7xnsNTA;
|
85
|
-
HttpOnly; Path=/
|
86
|
-
Strict-Transport-Security:
|
87
|
-
- max-age=31536000
|
88
|
-
Via:
|
89
|
-
- 1.1 varnish
|
90
|
-
X-Varnish:
|
91
|
-
- '205905702'
|
92
|
-
Connection:
|
93
|
-
- keep-alive
|
94
|
-
body:
|
95
|
-
encoding: UTF-8
|
96
|
-
string: ''
|
97
|
-
http_version:
|
98
|
-
recorded_at: Wed, 13 Apr 2016 03:24:21 GMT
|
99
51
|
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://example_api_token:@devac.cnstrc.com/v1/batch_items?autocomplete_key=example_autocomplete_key
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"autocomplete_section":"standard","items":[{"item_name":"power_drill
|
9
|
+
x1"},{"item_name":"power_drill x2"},{"item_name":"power_drill x3"},{"item_name":"power_drill
|
10
|
+
x4"}]}'
|
11
|
+
headers:
|
12
|
+
User-Agent:
|
13
|
+
- Faraday v0.9.1
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 204
|
23
|
+
message: NO CONTENT
|
24
|
+
headers:
|
25
|
+
Accept-Ranges:
|
26
|
+
- bytes
|
27
|
+
Age:
|
28
|
+
- '0'
|
29
|
+
Content-Length:
|
30
|
+
- '0'
|
31
|
+
Content-Type:
|
32
|
+
- text/html; charset=utf-8
|
33
|
+
Date:
|
34
|
+
- Tue, 07 Jun 2016 03:26:48 GMT
|
35
|
+
Server:
|
36
|
+
- nginx/1.4.6 (Ubuntu)
|
37
|
+
Set-Cookie:
|
38
|
+
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.CjfQeA.iF5gfCJO-QeR65yv3bX96VJIYYE;
|
39
|
+
HttpOnly; Path=/
|
40
|
+
Strict-Transport-Security:
|
41
|
+
- max-age=31536000
|
42
|
+
Via:
|
43
|
+
- 1.1 varnish
|
44
|
+
X-Varnish:
|
45
|
+
- '726242940'
|
46
|
+
Connection:
|
47
|
+
- keep-alive
|
48
|
+
body:
|
49
|
+
encoding: UTF-8
|
50
|
+
string: ''
|
51
|
+
http_version:
|
52
|
+
recorded_at: Tue, 07 Jun 2016 03:26:48 GMT
|
53
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constructorio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan McCormick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- test/fixtures/vcr_cassettes/add_or_update_batch.yml
|
176
176
|
- test/fixtures/vcr_cassettes/add_or_update_item.yml
|
177
177
|
- test/fixtures/vcr_cassettes/modify_item.yml
|
178
|
+
- test/fixtures/vcr_cassettes/remove_batch.yml
|
178
179
|
- test/fixtures/vcr_cassettes/remove_item.yml
|
179
180
|
- test/test_helper.rb
|
180
181
|
homepage: http://constructor.io
|
@@ -212,5 +213,6 @@ test_files:
|
|
212
213
|
- test/fixtures/vcr_cassettes/add_or_update_batch.yml
|
213
214
|
- test/fixtures/vcr_cassettes/add_or_update_item.yml
|
214
215
|
- test/fixtures/vcr_cassettes/modify_item.yml
|
216
|
+
- test/fixtures/vcr_cassettes/remove_batch.yml
|
215
217
|
- test/fixtures/vcr_cassettes/remove_item.yml
|
216
218
|
- test/test_helper.rb
|