commerce 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 504043403dfe7eab378ed90dec6a9be7808f4085
4
- data.tar.gz: eef0d809d0bf5571cb2ca18733d0f53a06b2ee66
3
+ metadata.gz: 66738f2f70ff673a0786d42cce9642efe8826117
4
+ data.tar.gz: ab651ca16d0e053438555963a610797f77c45303
5
5
  SHA512:
6
- metadata.gz: 9f7ac949f28cf1879fb64deb95b8451ace69db4e79b9255146b33ef9ebf30fa3aadb5854f443a14897e32599c7e60a0314ab5678190c3561d204c60ee286832a
7
- data.tar.gz: 823e606f2a2dd70ec1eb416e566606ce7c46ace8da9035974c5899df3e9114ede8367267eab8b8856abf131f717b79a7f3220c87e88468f6ace5b4aa4e09c289
6
+ metadata.gz: 0ecffc2af62df8b5bd83581ff6c6d36254323bbc74b2962ac64dde0d0a8bb00da1e6a0fdc777827b49a30b806e88d612bb4480cc22fa0d9f517569fd001dd9c7
7
+ data.tar.gz: 7fad82c0ba6f6119bd2055b8a1e2b245cd55309a3d20d4c477c179aad6bc20499a87da3cbab5f4c183e9370f21f66b586804ea76c38a07d2e90a47b6c94aec28
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class APIHelper
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class BaseController
@@ -203,6 +203,7 @@ module Commerce
203
203
 
204
204
  _request = @@http_client.PUT _query_url, parameters: _parameters
205
205
 
206
+
206
207
  CustomHeaderAuth.apply(_request)
207
208
 
208
209
  _request.headers = @@global_headers.clone.merge(_request.headers)
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class APIException < StandardError
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class CustomHeaderAuth
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class FaradayClient < HttpClient
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class HttpCallBack
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class HttpClient
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class HttpContext
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class HttpMethodEnum
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class HttpRequest
@@ -1,4 +1,4 @@
1
- # This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
1
+
2
2
 
3
3
  module Commerce
4
4
  class HttpResponse
@@ -52,6 +52,34 @@ module Commerce
52
52
 
53
53
  end
54
54
 
55
+ def self.locale_list_shipping_subdivisions(checkout_token_id, country_code, _query_parameters = [])
56
+
57
+ _query_builder = Commerce.api_base.dup
58
+ _query_builder << '/services/locale/{checkout_token_id}/countries/{country_code}/subdivisions'
59
+
60
+ _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
61
+ 'checkout_token_id' => checkout_token_id,
62
+ 'country_code' => country_code
63
+ }
64
+
65
+
66
+ _query_url = APIHelper.clean_url _query_builder
67
+
68
+
69
+ _request = @@http_client.GET _query_url
70
+
71
+ CustomHeaderAuth.apply(_request)
72
+
73
+ _request.headers = @@global_headers.clone.merge(_request.headers)
74
+
75
+ _response = @@http_client.execute_as_string(_request)
76
+
77
+ context = HttpContext.new(_request, _response)
78
+
79
+ return context.response.array
80
+
81
+ end
82
+
55
83
  def self.locale_list_subdivisions(country_code, _query_parameters = [])
56
84
 
57
85
  _query_builder = Commerce.api_base.dup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chec Commerce, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -84,14 +84,6 @@ files:
84
84
  - lib/commerce/order.rb
85
85
  - lib/commerce/product.rb
86
86
  - lib/commerce/service.rb
87
- - spec/api/cart_api_spec.rb
88
- - spec/api/checkout_api_spec.rb
89
- - spec/api/order_api_spec.rb
90
- - spec/api/product_api_spec.rb
91
- - spec/api/service_api_spec.rb
92
- - spec/api_client_spec.rb
93
- - spec/configuration_spec.rb
94
- - spec/spec_helper.rb
95
87
  homepage: https://github.com/chec
96
88
  licenses:
97
89
  - MIT
@@ -1,167 +0,0 @@
1
- =begin
2
- Commerce js by Chec
3
-
4
- Full-stack eCommerce API for developers & designers.
5
-
6
- OpenAPI spec version: 1.0.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
-
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for Commerce::Cart
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'Cart' do
20
- before do
21
- # run before each test
22
- @instance = Commerce::Cart.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of Cart' do
30
- it 'should create an instact of Cart' do
31
- @instance.should be_a(Commerce::Cart)
32
- end
33
- end
34
-
35
- # unit tests for add
36
- # ListProducts
37
- # List
38
- # @param id cart_id
39
- # @param id2 id
40
- # @param [Hash] opts the optional parameters
41
- # @option opts [Integer] :quantity quantity
42
- # @return [String]
43
- describe 'add test' do
44
- it "should work" do
45
- # assertion here
46
- # should be_a()
47
- # should be_nil
48
- # should ==
49
- # should_not ==
50
- end
51
- end
52
-
53
- # unit tests for contents
54
- # ListProducts
55
- # List
56
- # @param id id
57
- # @param [Hash] opts the optional parameters
58
- # @return [String]
59
- describe 'contents test' do
60
- it "should work" do
61
- # assertion here
62
- # should be_a()
63
- # should be_nil
64
- # should ==
65
- # should_not ==
66
- end
67
- end
68
-
69
- # unit tests for create
70
- # ListProducts
71
- # List
72
- # @param [Hash] opts the optional parameters
73
- # @return [String]
74
- describe 'create test' do
75
- it "should work" do
76
- # assertion here
77
- # should be_a()
78
- # should be_nil
79
- # should ==
80
- # should_not ==
81
- end
82
- end
83
-
84
- # unit tests for delete
85
- # ListProducts
86
- # List
87
- # @param id id
88
- # @param [Hash] opts the optional parameters
89
- # @return [String]
90
- describe 'delete test' do
91
- it "should work" do
92
- # assertion here
93
- # should be_a()
94
- # should be_nil
95
- # should ==
96
- # should_not ==
97
- end
98
- end
99
-
100
- # unit tests for remove
101
- # ListProducts
102
- # List
103
- # @param id cart_id
104
- # @param line_item_id line_item_id
105
- # @param [Hash] opts the optional parameters
106
- # @return [String]
107
- describe 'remove test' do
108
- it "should work" do
109
- # assertion here
110
- # should be_a()
111
- # should be_nil
112
- # should ==
113
- # should_not ==
114
- end
115
- end
116
-
117
- # unit tests for reset
118
- # ListProducts
119
- # List
120
- # @param id id
121
- # @param [Hash] opts the optional parameters
122
- # @return [String]
123
- describe 'reset test' do
124
- it "should work" do
125
- # assertion here
126
- # should be_a()
127
- # should be_nil
128
- # should ==
129
- # should_not ==
130
- end
131
- end
132
-
133
- # unit tests for retrieve
134
- # ListProducts
135
- # List
136
- # @param id id
137
- # @param [Hash] opts the optional parameters
138
- # @return [String]
139
- describe 'retrieve test' do
140
- it "should work" do
141
- # assertion here
142
- # should be_a()
143
- # should be_nil
144
- # should ==
145
- # should_not ==
146
- end
147
- end
148
-
149
- # unit tests for update
150
- # ListProducts
151
- # List
152
- # @param id cart_id
153
- # @param line_item_id line_item_id
154
- # @param [Hash] opts the optional parameters
155
- # @option opts [Integer] :quantity quantity
156
- # @return [String]
157
- describe 'update test' do
158
- it "should work" do
159
- # assertion here
160
- # should be_a()
161
- # should be_nil
162
- # should ==
163
- # should_not ==
164
- end
165
- end
166
-
167
- end
@@ -1,309 +0,0 @@
1
- =begin
2
- Commerce js by Chec
3
-
4
- Full-stack eCommerce API for developers & designers.
5
-
6
- OpenAPI spec version: 1.0.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
-
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for Commerce::Checkout
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'Checkout' do
20
- before do
21
- # run before each test
22
- @instance = Commerce::Checkout.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of Checkout' do
30
- it 'should create an instact of Checkout' do
31
- @instance.should be_a(Commerce::Checkout)
32
- end
33
- end
34
-
35
- # unit tests for capture
36
- # capture
37
- # capture
38
- # @param identifier identifier
39
- # @param data data
40
- # @param [Hash] opts the optional parameters
41
- # @return [String]
42
- describe 'capture test' do
43
- it "should work" do
44
- # assertion here
45
- # should be_a()
46
- # should be_nil
47
- # should ==
48
- # should_not ==
49
- end
50
- end
51
-
52
- # unit tests for check_discount
53
- # ListProducts
54
- # List
55
- # @param id id
56
- # @param code code
57
- # @param [Hash] opts the optional parameters
58
- # @return [String]
59
- describe 'check_discount test' do
60
- it "should work" do
61
- # assertion here
62
- # should be_a()
63
- # should be_nil
64
- # should ==
65
- # should_not ==
66
- end
67
- end
68
-
69
- # unit tests for check_pay_what_you_want
70
- # ListProducts
71
- # List
72
- # @param id id
73
- # @param customer_set_price customer_set_price
74
- # @param [Hash] opts the optional parameters
75
- # @return [String]
76
- describe 'check_pay_what_you_want test' do
77
- it "should work" do
78
- # assertion here
79
- # should be_a()
80
- # should be_nil
81
- # should ==
82
- # should_not ==
83
- end
84
- end
85
-
86
- # unit tests for check_paypal_order_captured
87
- # ListProducts
88
- # List
89
- # @param id id
90
- # @param [Hash] opts the optional parameters
91
- # @return [String]
92
- describe 'check_paypal_order_captured test' do
93
- it "should work" do
94
- # assertion here
95
- # should be_a()
96
- # should be_nil
97
- # should ==
98
- # should_not ==
99
- end
100
- end
101
-
102
- # unit tests for check_paypal_status
103
- # ListProducts
104
- # List
105
- # @param id id
106
- # @param [Hash] opts the optional parameters
107
- # @return [String]
108
- describe 'check_paypal_status test' do
109
- it "should work" do
110
- # assertion here
111
- # should be_a()
112
- # should be_nil
113
- # should ==
114
- # should_not ==
115
- end
116
- end
117
-
118
- # unit tests for check_quantity
119
- # ListProducts
120
- # List
121
- # @param id id
122
- # @param line_item_id line_item_id
123
- # @param amount amount
124
- # @param [Hash] opts the optional parameters
125
- # @return [String]
126
- describe 'check_quantity test' do
127
- it "should work" do
128
- # assertion here
129
- # should be_a()
130
- # should be_nil
131
- # should ==
132
- # should_not ==
133
- end
134
- end
135
-
136
- # unit tests for check_shipping_option
137
- # ListProducts
138
- # List
139
- # @param id id
140
- # @param country country
141
- # @param id2 id
142
- # @param [Hash] opts the optional parameters
143
- # @return [String]
144
- describe 'check_shipping_option test' do
145
- it "should work" do
146
- # assertion here
147
- # should be_a()
148
- # should be_nil
149
- # should ==
150
- # should_not ==
151
- end
152
- end
153
-
154
- # unit tests for check_variant
155
- # ListProducts
156
- # List
157
- # @param id id
158
- # @param line_item_id line_item_id
159
- # @param variant_id variant_id
160
- # @param option_id option_id
161
- # @param [Hash] opts the optional parameters
162
- # @return [String]
163
- describe 'check_variant test' do
164
- it "should work" do
165
- # assertion here
166
- # should be_a()
167
- # should be_nil
168
- # should ==
169
- # should_not ==
170
- end
171
- end
172
-
173
- # unit tests for generate_token
174
- # Generate id
175
- # generateToken
176
- # @param identifier identifier
177
- # @param [Hash] opts the optional parameters
178
- # @option opts [String] :type Id type
179
- # @return [String]
180
- describe 'generate_token test' do
181
- it "should work" do
182
- # assertion here
183
- # should be_a()
184
- # should be_nil
185
- # should ==
186
- # should_not ==
187
- end
188
- end
189
-
190
- # unit tests for get_live
191
- # ListProducts
192
- # List
193
- # @param id id
194
- # @param [Hash] opts the optional parameters
195
- # @return [String]
196
- describe 'get_live test' do
197
- it "should work" do
198
- # assertion here
199
- # should be_a()
200
- # should be_nil
201
- # should ==
202
- # should_not ==
203
- end
204
- end
205
-
206
- # unit tests for get_location_from_ip
207
- # ListProducts
208
- # List
209
- # @param id id
210
- # @param ip_address ip_address
211
- # @param [Hash] opts the optional parameters
212
- # @return [String]
213
- describe 'get_location_from_ip test' do
214
- it "should work" do
215
- # assertion here
216
- # should be_a()
217
- # should be_nil
218
- # should ==
219
- # should_not ==
220
- end
221
- end
222
-
223
- # unit tests for get_shipping_options
224
- # ListProducts
225
- # List
226
- # @param id id
227
- # @param country country
228
- # @param [Hash] opts the optional parameters
229
- # @return [String]
230
- describe 'get_shipping_options test' do
231
- it "should work" do
232
- # assertion here
233
- # should be_a()
234
- # should be_nil
235
- # should ==
236
- # should_not ==
237
- end
238
- end
239
-
240
- # unit tests for helper_validation
241
- # ListProducts
242
- # List
243
- # @param id id
244
- # @param [Hash] opts the optional parameters
245
- # @return [String]
246
- describe 'helper_validation test' do
247
- it "should work" do
248
- # assertion here
249
- # should be_a()
250
- # should be_nil
251
- # should ==
252
- # should_not ==
253
- end
254
- end
255
-
256
- # unit tests for is_free
257
- # ListProducts
258
- # List
259
- # @param id id
260
- # @param [Hash] opts the optional parameters
261
- # @return [String]
262
- describe 'is_free test' do
263
- it "should work" do
264
- # assertion here
265
- # should be_a()
266
- # should be_nil
267
- # should ==
268
- # should_not ==
269
- end
270
- end
271
-
272
- # unit tests for receipt
273
- # ListProducts
274
- # receipt
275
- # @param id id
276
- # @param [Hash] opts the optional parameters
277
- # @option opts [String] :type Id type
278
- # @return [String]
279
- describe 'receipt test' do
280
- it "should work" do
281
- # assertion here
282
- # should be_a()
283
- # should be_nil
284
- # should ==
285
- # should_not ==
286
- end
287
- end
288
-
289
- # unit tests for set_tax_zone
290
- # ListProducts
291
- # List
292
- # @param id id
293
- # @param [Hash] opts the optional parameters
294
- # @option opts [String] :ip_address ip_address
295
- # @option opts [String] :country country
296
- # @option opts [String] :region region
297
- # @option opts [String] :postal_zip_code postal_zip_code
298
- # @return [String]
299
- describe 'set_tax_zone test' do
300
- it "should work" do
301
- # assertion here
302
- # should be_a()
303
- # should be_nil
304
- # should ==
305
- # should_not ==
306
- end
307
- end
308
-
309
- end
@@ -1,100 +0,0 @@
1
- =begin
2
- Commerce js by Chec
3
-
4
- Full-stack eCommerce API for developers & designers.
5
-
6
- OpenAPI spec version: 1.0.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
-
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for Commerce::Order
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'Order' do
20
- before do
21
- # run before each test
22
- @instance = Commerce::Order.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of Order' do
30
- it 'should create an instact of Order' do
31
- @instance.should be_a(Commerce::Order)
32
- end
33
- end
34
-
35
- # unit tests for all
36
- # Orders
37
- # List
38
- # @param [Hash] opts the optional parameters
39
- # @option opts [String] :limit limit
40
- # @option opts [String] :page page
41
- # @return [String]
42
- describe 'all test' do
43
- it "should work" do
44
- # assertion here
45
- # should be_a()
46
- # should be_nil
47
- # should ==
48
- # should_not ==
49
- end
50
- end
51
-
52
- # unit tests for fulfillment
53
- # fulfillment
54
- # fulfillment
55
- # @param id order id
56
- # @param [Hash] opts the optional parameters
57
- # @return [String]
58
- describe 'fulfillment test' do
59
- it "should work" do
60
- # assertion here
61
- # should be_a()
62
- # should be_nil
63
- # should ==
64
- # should_not ==
65
- end
66
- end
67
-
68
- # unit tests for payments
69
- # payments
70
- # payments
71
- # @param id order id
72
- # @param [Hash] opts the optional parameters
73
- # @return [String]
74
- describe 'payments test' do
75
- it "should work" do
76
- # assertion here
77
- # should be_a()
78
- # should be_nil
79
- # should ==
80
- # should_not ==
81
- end
82
- end
83
-
84
- # unit tests for receipt
85
- # Receipt
86
- # Receipt
87
- # @param id order id
88
- # @param [Hash] opts the optional parameters
89
- # @return [String]
90
- describe 'receipt test' do
91
- it "should work" do
92
- # assertion here
93
- # should be_a()
94
- # should be_nil
95
- # should ==
96
- # should_not ==
97
- end
98
- end
99
-
100
- end
@@ -1,69 +0,0 @@
1
- =begin
2
- Commerce js by Chec
3
-
4
- Full-stack eCommerce API for developers & designers.
5
-
6
- OpenAPI spec version: 1.0.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
-
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for Commerce::Product
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'Product' do
20
- before do
21
- # run before each test
22
- @instance = Commerce::Product.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of Product' do
30
- it 'should create an instact of Product' do
31
- @instance.should be_a(Commerce::Product)
32
- end
33
- end
34
-
35
- # unit tests for all
36
- # ListProducts
37
- # List
38
- # @param [Hash] opts the optional parameters
39
- # @option opts [String] :limit limit
40
- # @option opts [String] :page page
41
- # @return [String]
42
- describe 'all test' do
43
- it "should work" do
44
- # assertion here
45
- # should be_a()
46
- # should be_nil
47
- # should ==
48
- # should_not ==
49
- end
50
- end
51
-
52
- # unit tests for retrieve
53
- # retrieve
54
- # retrieve
55
- # @param identifier identifier
56
- # @param [Hash] opts the optional parameters
57
- # @option opts [String] :type Id type
58
- # @return [String]
59
- describe 'retrieve test' do
60
- it "should work" do
61
- # assertion here
62
- # should be_a()
63
- # should be_nil
64
- # should ==
65
- # should_not ==
66
- end
67
- end
68
-
69
- end
@@ -1,82 +0,0 @@
1
- =begin
2
- Commerce js by Chec
3
-
4
- Full-stack eCommerce API for developers & designers.
5
-
6
- OpenAPI spec version: 1.0.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
-
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for Commerce::Service
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'Service' do
20
- before do
21
- # run before each test
22
- @instance = Commerce::Service.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of Service' do
30
- it 'should create an instact of Service' do
31
- @instance.should be_a(Commerce::Service)
32
- end
33
- end
34
-
35
- # unit tests for locale_list_countries
36
- # ListProducts
37
- # List
38
- # @param [Hash] opts the optional parameters
39
- # @return [String]
40
- describe 'locale_list_countries test' do
41
- it "should work" do
42
- # assertion here
43
- # should be_a()
44
- # should be_nil
45
- # should ==
46
- # should_not ==
47
- end
48
- end
49
-
50
- # unit tests for locale_list_shipping_countries
51
- # ListProducts
52
- # List
53
- # @param checkout_token_id id
54
- # @param [Hash] opts the optional parameters
55
- # @return [String]
56
- describe 'locale_list_shipping_countries test' do
57
- it "should work" do
58
- # assertion here
59
- # should be_a()
60
- # should be_nil
61
- # should ==
62
- # should_not ==
63
- end
64
- end
65
-
66
- # unit tests for locale_list_subdivisions
67
- # ListProducts
68
- # List
69
- # @param country_code id
70
- # @param [Hash] opts the optional parameters
71
- # @return [String]
72
- describe 'locale_list_subdivisions test' do
73
- it "should work" do
74
- # assertion here
75
- # should be_a()
76
- # should be_nil
77
- # should ==
78
- # should_not ==
79
- end
80
- end
81
-
82
- end
@@ -1,226 +0,0 @@
1
- =begin
2
- Commerce js by Chec
3
-
4
- Full-stack eCommerce API for developers & designers.
5
-
6
- OpenAPI spec version: 1.0.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
-
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe Commerce::ApiClient do
16
- context 'initialization' do
17
- context 'URL stuff' do
18
- context 'host' do
19
- it 'removes http from host' do
20
- Commerce.configure { |c| c.host = 'http://example.com' }
21
- expect(Commerce::Configuration.default.host).to eq('example.com')
22
- end
23
-
24
- it 'removes https from host' do
25
- Commerce.configure { |c| c.host = 'https://wookiee.com' }
26
- expect(Commerce::ApiClient.default.config.host).to eq('wookiee.com')
27
- end
28
-
29
- it 'removes trailing path from host' do
30
- Commerce.configure { |c| c.host = 'hobo.com/v4' }
31
- expect(Commerce::Configuration.default.host).to eq('hobo.com')
32
- end
33
- end
34
-
35
- context 'base_path' do
36
- it "prepends a slash to base_path" do
37
- Commerce.configure { |c| c.base_path = 'v4/dog' }
38
- expect(Commerce::Configuration.default.base_path).to eq('/v4/dog')
39
- end
40
-
41
- it "doesn't prepend a slash if one is already there" do
42
- Commerce.configure { |c| c.base_path = '/v4/dog' }
43
- expect(Commerce::Configuration.default.base_path).to eq('/v4/dog')
44
- end
45
-
46
- it "ends up as a blank string if nil" do
47
- Commerce.configure { |c| c.base_path = nil }
48
- expect(Commerce::Configuration.default.base_path).to eq('')
49
- end
50
- end
51
- end
52
- end
53
-
54
- describe "params_encoding in #build_request" do
55
- let(:config) { Commerce::Configuration.new }
56
- let(:api_client) { Commerce::ApiClient.new(config) }
57
-
58
- it "defaults to nil" do
59
- expect(Commerce::Configuration.default.params_encoding).to eq(nil)
60
- expect(config.params_encoding).to eq(nil)
61
-
62
- request = api_client.build_request(:get, '/test')
63
- expect(request.options[:params_encoding]).to eq(nil)
64
- end
65
-
66
- it "can be customized" do
67
- config.params_encoding = :multi
68
- request = api_client.build_request(:get, '/test')
69
- expect(request.options[:params_encoding]).to eq(:multi)
70
- end
71
- end
72
-
73
- describe "timeout in #build_request" do
74
- let(:config) { Commerce::Configuration.new }
75
- let(:api_client) { Commerce::ApiClient.new(config) }
76
-
77
- it "defaults to 0" do
78
- expect(Commerce::Configuration.default.timeout).to eq(0)
79
- expect(config.timeout).to eq(0)
80
-
81
- request = api_client.build_request(:get, '/test')
82
- expect(request.options[:timeout]).to eq(0)
83
- end
84
-
85
- it "can be customized" do
86
- config.timeout = 100
87
- request = api_client.build_request(:get, '/test')
88
- expect(request.options[:timeout]).to eq(100)
89
- end
90
- end
91
-
92
- describe "#deserialize" do
93
- it "handles Array<Integer>" do
94
- api_client = Commerce::ApiClient.new
95
- headers = {'Content-Type' => 'application/json'}
96
- response = double('response', headers: headers, body: '[12, 34]')
97
- data = api_client.deserialize(response, 'Array<Integer>')
98
- expect(data).to be_instance_of(Array)
99
- expect(data).to eq([12, 34])
100
- end
101
-
102
- it "handles Array<Array<Integer>>" do
103
- api_client = Commerce::ApiClient.new
104
- headers = {'Content-Type' => 'application/json'}
105
- response = double('response', headers: headers, body: '[[12, 34], [56]]')
106
- data = api_client.deserialize(response, 'Array<Array<Integer>>')
107
- expect(data).to be_instance_of(Array)
108
- expect(data).to eq([[12, 34], [56]])
109
- end
110
-
111
- it "handles Hash<String, String>" do
112
- api_client = Commerce::ApiClient.new
113
- headers = {'Content-Type' => 'application/json'}
114
- response = double('response', headers: headers, body: '{"message": "Hello"}')
115
- data = api_client.deserialize(response, 'Hash<String, String>')
116
- expect(data).to be_instance_of(Hash)
117
- expect(data).to eq({:message => 'Hello'})
118
- end
119
- end
120
-
121
- describe "#object_to_hash" do
122
- it "ignores nils and includes empty arrays" do
123
- # uncomment below to test object_to_hash for model
124
- #api_client = Commerce::ApiClient.new
125
- #_model = Commerce::ModelName.new
126
- # update the model attribute below
127
- #_model.id = 1
128
- # update the expected value (hash) below
129
- #expected = {id: 1, name: '', tags: []}
130
- #expect(api_client.object_to_hash(_model)).to eq(expected)
131
- end
132
- end
133
-
134
- describe "#build_collection_param" do
135
- let(:param) { ['aa', 'bb', 'cc'] }
136
- let(:api_client) { Commerce::ApiClient.new }
137
-
138
- it "works for csv" do
139
- expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
140
- end
141
-
142
- it "works for ssv" do
143
- expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
144
- end
145
-
146
- it "works for tsv" do
147
- expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
148
- end
149
-
150
- it "works for pipes" do
151
- expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
152
- end
153
-
154
- it "works for multi" do
155
- expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
156
- end
157
-
158
- it "fails for invalid collection format" do
159
- expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
160
- end
161
- end
162
-
163
- describe "#json_mime?" do
164
- let(:api_client) { Commerce::ApiClient.new }
165
-
166
- it "works" do
167
- expect(api_client.json_mime?(nil)).to eq false
168
- expect(api_client.json_mime?('')).to eq false
169
-
170
- expect(api_client.json_mime?('application/json')).to eq true
171
- expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
172
- expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
173
-
174
- expect(api_client.json_mime?('application/xml')).to eq false
175
- expect(api_client.json_mime?('text/plain')).to eq false
176
- expect(api_client.json_mime?('application/jsonp')).to eq false
177
- end
178
- end
179
-
180
- describe "#select_header_accept" do
181
- let(:api_client) { Commerce::ApiClient.new }
182
-
183
- it "works" do
184
- expect(api_client.select_header_accept(nil)).to be_nil
185
- expect(api_client.select_header_accept([])).to be_nil
186
-
187
- expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
188
- expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
189
- expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
190
-
191
- expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
192
- expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
193
- end
194
- end
195
-
196
- describe "#select_header_content_type" do
197
- let(:api_client) { Commerce::ApiClient.new }
198
-
199
- it "works" do
200
- expect(api_client.select_header_content_type(nil)).to eq('application/json')
201
- expect(api_client.select_header_content_type([])).to eq('application/json')
202
-
203
- expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
204
- expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
205
- expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
206
- expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
207
- expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
208
- end
209
- end
210
-
211
- describe "#sanitize_filename" do
212
- let(:api_client) { Commerce::ApiClient.new }
213
-
214
- it "works" do
215
- expect(api_client.sanitize_filename('sun')).to eq('sun')
216
- expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
217
- expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
218
- expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
219
- expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
220
- expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
221
- expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
222
- expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
223
- expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
224
- end
225
- end
226
- end
@@ -1,42 +0,0 @@
1
- =begin
2
- Commerce js by Chec
3
-
4
- Full-stack eCommerce API for developers & designers.
5
-
6
- OpenAPI spec version: 1.0.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
-
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe Commerce::Configuration do
16
- let(:config) { Commerce::Configuration.default }
17
-
18
- before(:each) do
19
- # uncomment below to setup host and base_path
20
- #require 'URI'
21
- #uri = URI.parse("https://api.chec.io/v1")
22
- #Commerce.configure do |c|
23
- # c.host = uri.host
24
- # c.base_path = uri.path
25
- #end
26
- end
27
-
28
- describe '#base_url' do
29
- it 'should have the default value' do
30
- # uncomment below to test default value of the base path
31
- #expect(config.base_url).to eq("https://api.chec.io/v1")
32
- end
33
-
34
- it 'should remove trailing slashes' do
35
- [nil, '', '/', '//'].each do |base_path|
36
- config.base_path = base_path
37
- # uncomment below to test trailing slashes
38
- #expect(config.base_url).to eq("https://api.chec.io/v1")
39
- end
40
- end
41
- end
42
- end
@@ -1,111 +0,0 @@
1
- =begin
2
- Commerce js by Chec
3
-
4
- Full-stack eCommerce API for developers & designers.
5
-
6
- OpenAPI spec version: 1.0.0
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
-
10
-
11
- =end
12
-
13
- # load the gem
14
- require 'commerce'
15
-
16
- # The following was generated by the `rspec --init` command. Conventionally, all
17
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
18
- # The generated `.rspec` file contains `--require spec_helper` which will cause
19
- # this file to always be loaded, without a need to explicitly require it in any
20
- # files.
21
- #
22
- # Given that it is always loaded, you are encouraged to keep this file as
23
- # light-weight as possible. Requiring heavyweight dependencies from this file
24
- # will add to the boot time of your test suite on EVERY test run, even for an
25
- # individual file that may not need all of that loaded. Instead, consider making
26
- # a separate helper file that requires the additional dependencies and performs
27
- # the additional setup, and require it from the spec files that actually need
28
- # it.
29
- #
30
- # The `.rspec` file also contains a few flags that are not defaults but that
31
- # users commonly want.
32
- #
33
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
34
- RSpec.configure do |config|
35
- # rspec-expectations config goes here. You can use an alternate
36
- # assertion/expectation library such as wrong or the stdlib/minitest
37
- # assertions if you prefer.
38
- config.expect_with :rspec do |expectations|
39
- # This option will default to `true` in RSpec 4. It makes the `description`
40
- # and `failure_message` of custom matchers include text for helper methods
41
- # defined using `chain`, e.g.:
42
- # be_bigger_than(2).and_smaller_than(4).description
43
- # # => "be bigger than 2 and smaller than 4"
44
- # ...rather than:
45
- # # => "be bigger than 2"
46
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
47
- end
48
-
49
- # rspec-mocks config goes here. You can use an alternate test double
50
- # library (such as bogus or mocha) by changing the `mock_with` option here.
51
- config.mock_with :rspec do |mocks|
52
- # Prevents you from mocking or stubbing a method that does not exist on
53
- # a real object. This is generally recommended, and will default to
54
- # `true` in RSpec 4.
55
- mocks.verify_partial_doubles = true
56
- end
57
-
58
- # The settings below are suggested to provide a good initial experience
59
- # with RSpec, but feel free to customize to your heart's content.
60
- =begin
61
- # These two settings work together to allow you to limit a spec run
62
- # to individual examples or groups you care about by tagging them with
63
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
64
- # get run.
65
- config.filter_run :focus
66
- config.run_all_when_everything_filtered = true
67
-
68
- # Allows RSpec to persist some state between runs in order to support
69
- # the `--only-failures` and `--next-failure` CLI options. We recommend
70
- # you configure your source control system to ignore this file.
71
- config.example_status_persistence_file_path = "spec/examples.txt"
72
-
73
- # Limits the available syntax to the non-monkey patched syntax that is
74
- # recommended. For more details, see:
75
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
76
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
77
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
78
- config.disable_monkey_patching!
79
-
80
- # This setting enables warnings. It's recommended, but in some cases may
81
- # be too noisy due to issues in dependencies.
82
- config.warnings = true
83
-
84
- # Many RSpec users commonly either run the entire suite or an individual
85
- # file, and it's useful to allow more verbose output when running an
86
- # individual spec file.
87
- if config.files_to_run.one?
88
- # Use the documentation formatter for detailed output,
89
- # unless a formatter has already been configured
90
- # (e.g. via a command-line flag).
91
- config.default_formatter = 'doc'
92
- end
93
-
94
- # Print the 10 slowest examples and example groups at the
95
- # end of the spec run, to help surface which specs are running
96
- # particularly slow.
97
- config.profile_examples = 10
98
-
99
- # Run specs in random order to surface order dependencies. If you find an
100
- # order dependency and want to debug it, you can fix the order by providing
101
- # the seed, which is printed after each run.
102
- # --seed 1234
103
- config.order = :random
104
-
105
- # Seed global randomization in this process using the `--seed` CLI option.
106
- # Setting this allows you to use `--seed` to deterministically reproduce
107
- # test failures related to randomization by passing the same `--seed` value
108
- # as the one that triggered the failure.
109
- Kernel.srand config.seed
110
- =end
111
- end