constructorio 2.0.10 → 2.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/constructorio/version.rb +1 -1
- data/test/constructorio_vcr_test.rb +45 -0
- data/test/fixtures/vcr_cassettes/add_batch.yml +103 -0
- data/test/fixtures/vcr_cassettes/add_or_update_batch.yml +52 -0
- data/test/fixtures/vcr_cassettes/add_or_update_item.yml +99 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d310621f16995d46172abe1e59e484d5bd5d51d7
|
4
|
+
data.tar.gz: f8c623d39a957306aa0afa384f628f0fd0fa48a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca368210833d145d9183a975a9b280daf78abbeccfea06a35a4838eb5903974193729af48b314892ff5daab3125997002878875be1bbf695151ecdb749d5313c
|
7
|
+
data.tar.gz: 5ace0531bb83aaedf0b65215df44376fb9c61d92621518e1c2f5335b6966f502c4d78792308b8d9f320795cbb67384f11a14d438cb3f1138a7ba3133a481ca8a
|
@@ -19,6 +19,51 @@ class ConstructorIOVCRTest < MiniTest::Test
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def test_add_or_update_item
|
23
|
+
c = ConstructorIO::Client.new
|
24
|
+
|
25
|
+
VCR.use_cassette("add_or_update_item") do
|
26
|
+
response = c.add_or_update(
|
27
|
+
{ item_name: "power_drill", autocomplete_section: "standard" }
|
28
|
+
)
|
29
|
+
assert_equal response.status, 204
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_add_batch
|
34
|
+
c = ConstructorIO::Client.new
|
35
|
+
|
36
|
+
VCR.use_cassette("add_batch") do
|
37
|
+
response = c.add_batch(
|
38
|
+
autocomplete_section: "standard",
|
39
|
+
items: [{
|
40
|
+
item_name: "power drill x1",
|
41
|
+
item_name: "power drill x2",
|
42
|
+
item_name: "power drill x3",
|
43
|
+
item_name: "power drill x4",
|
44
|
+
}]
|
45
|
+
)
|
46
|
+
assert_equal response.status, 204
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_add_or_update_batch
|
51
|
+
c = ConstructorIO::Client.new
|
52
|
+
|
53
|
+
VCR.use_cassette("add_or_update_batch") do
|
54
|
+
response = c.add_or_update_batch(
|
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
|
+
}]
|
62
|
+
)
|
63
|
+
assert_equal response.status, 204
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
22
67
|
def test_remove_item
|
23
68
|
c = ConstructorIO::Client.new
|
24
69
|
|
@@ -0,0 +1,103 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
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
|
+
x4"}]}'
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Faraday v0.9.1
|
13
|
+
Content-Type:
|
14
|
+
- application/json
|
15
|
+
Accept-Encoding:
|
16
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
17
|
+
Accept:
|
18
|
+
- "*/*"
|
19
|
+
response:
|
20
|
+
status:
|
21
|
+
code: 204
|
22
|
+
message: NO CONTENT
|
23
|
+
headers:
|
24
|
+
Accept-Ranges:
|
25
|
+
- bytes
|
26
|
+
Age:
|
27
|
+
- '0'
|
28
|
+
Content-Length:
|
29
|
+
- '0'
|
30
|
+
Content-Type:
|
31
|
+
- text/html; charset=utf-8
|
32
|
+
Date:
|
33
|
+
- Wed, 13 Apr 2016 03:24:21 GMT
|
34
|
+
Server:
|
35
|
+
- nginx/1.4.6 (Ubuntu)
|
36
|
+
Set-Cookie:
|
37
|
+
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.Ce9NZQ.2WTup2w-f5SddEWh1IanDSv_eHc;
|
38
|
+
HttpOnly; Path=/
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=31536000
|
41
|
+
Via:
|
42
|
+
- 1.1 varnish
|
43
|
+
X-Varnish:
|
44
|
+
- '205905703'
|
45
|
+
Connection:
|
46
|
+
- keep-alive
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: ''
|
50
|
+
http_version:
|
51
|
+
recorded_at: Wed, 13 Apr 2016 03:24:21 GMT
|
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
|
103
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://example_api_token:@devac.cnstrc.com/v1/batch_items?autocomplete_key=example_autocomplete_key&force=1
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"autocomplete_section":"standard","items":[{"item_name":"power drill
|
9
|
+
x4"}]}'
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Faraday v0.9.1
|
13
|
+
Content-Type:
|
14
|
+
- application/json
|
15
|
+
Accept-Encoding:
|
16
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
17
|
+
Accept:
|
18
|
+
- "*/*"
|
19
|
+
response:
|
20
|
+
status:
|
21
|
+
code: 204
|
22
|
+
message: NO CONTENT
|
23
|
+
headers:
|
24
|
+
Accept-Ranges:
|
25
|
+
- bytes
|
26
|
+
Age:
|
27
|
+
- '0'
|
28
|
+
Content-Length:
|
29
|
+
- '0'
|
30
|
+
Content-Type:
|
31
|
+
- text/html; charset=utf-8
|
32
|
+
Date:
|
33
|
+
- Wed, 13 Apr 2016 03:27:23 GMT
|
34
|
+
Server:
|
35
|
+
- nginx/1.4.6 (Ubuntu)
|
36
|
+
Set-Cookie:
|
37
|
+
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.Ce9OGw.EG_jTI4OybnYOTdNdcy63ZFq90I;
|
38
|
+
HttpOnly; Path=/
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=31536000
|
41
|
+
Via:
|
42
|
+
- 1.1 varnish
|
43
|
+
X-Varnish:
|
44
|
+
- '205905766'
|
45
|
+
Connection:
|
46
|
+
- keep-alive
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: ''
|
50
|
+
http_version:
|
51
|
+
recorded_at: Wed, 13 Apr 2016 03:27:24 GMT
|
52
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,99 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://example_api_token:@devac.cnstrc.com/v1/item?autocomplete_key=example_autocomplete_key&force=1
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"item_name":"power_drill","autocomplete_section":"standard"}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 204
|
21
|
+
message: NO CONTENT
|
22
|
+
headers:
|
23
|
+
Accept-Ranges:
|
24
|
+
- bytes
|
25
|
+
Age:
|
26
|
+
- '0'
|
27
|
+
Content-Length:
|
28
|
+
- '0'
|
29
|
+
Content-Type:
|
30
|
+
- text/html; charset=utf-8
|
31
|
+
Date:
|
32
|
+
- Tue, 12 Apr 2016 21:55:33 GMT
|
33
|
+
Server:
|
34
|
+
- nginx/1.4.6 (Ubuntu)
|
35
|
+
Set-Cookie:
|
36
|
+
- session=eyJwd19oYXNoIjp7IiBiIjoiSkRKaEpEQTRKRkpQY1RkNGJGSnlOeTlzWXpaVFYzWkNjbFYyUkM1YVZqQXlZMjlUVVM5b05DNVZhRlJUVG5Bek5XSlZVVFZ0UXpobWNrd3kifX0.Ce8AVQ.A1cD_4WU8OnFKDzeNthxB2f9B2E;
|
37
|
+
HttpOnly; Path=/
|
38
|
+
Strict-Transport-Security:
|
39
|
+
- max-age=31536000
|
40
|
+
Via:
|
41
|
+
- 1.1 varnish
|
42
|
+
X-Varnish:
|
43
|
+
- '205899122'
|
44
|
+
Connection:
|
45
|
+
- keep-alive
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: ''
|
49
|
+
http_version:
|
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
|
+
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.11
|
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-04-
|
11
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -169,8 +169,11 @@ files:
|
|
169
169
|
- test/constructorio_test.rb
|
170
170
|
- test/constructorio_vcr_test.rb
|
171
171
|
- test/constructorio_vcr_test_errors.rb
|
172
|
+
- test/fixtures/vcr_cassettes/add_batch.yml
|
172
173
|
- test/fixtures/vcr_cassettes/add_item.yml
|
173
174
|
- test/fixtures/vcr_cassettes/add_item_error.yml
|
175
|
+
- test/fixtures/vcr_cassettes/add_or_update_batch.yml
|
176
|
+
- test/fixtures/vcr_cassettes/add_or_update_item.yml
|
174
177
|
- test/fixtures/vcr_cassettes/modify_item.yml
|
175
178
|
- test/fixtures/vcr_cassettes/remove_item.yml
|
176
179
|
- test/test_helper.rb
|
@@ -203,8 +206,11 @@ test_files:
|
|
203
206
|
- test/constructorio_test.rb
|
204
207
|
- test/constructorio_vcr_test.rb
|
205
208
|
- test/constructorio_vcr_test_errors.rb
|
209
|
+
- test/fixtures/vcr_cassettes/add_batch.yml
|
206
210
|
- test/fixtures/vcr_cassettes/add_item.yml
|
207
211
|
- test/fixtures/vcr_cassettes/add_item_error.yml
|
212
|
+
- test/fixtures/vcr_cassettes/add_or_update_batch.yml
|
213
|
+
- test/fixtures/vcr_cassettes/add_or_update_item.yml
|
208
214
|
- test/fixtures/vcr_cassettes/modify_item.yml
|
209
215
|
- test/fixtures/vcr_cassettes/remove_item.yml
|
210
216
|
- test/test_helper.rb
|