shopify_api 4.9.0 → 4.9.1
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/CHANGELOG +4 -0
- data/README.md +2 -11
- data/lib/shopify_api/limits.rb +1 -2
- data/lib/shopify_api/resources/{customer_invite_message.rb → customer_invite.rb} +0 -0
- data/lib/shopify_api/resources/line_item.rb +9 -1
- data/lib/shopify_api/version.rb +1 -1
- data/test/fixtures/order_with_properties.json +373 -0
- data/test/order_test.rb +13 -1
- metadata +5 -9
- data/lib/shopify_api/resources/discount.rb +0 -11
- data/test/discount_test.rb +0 -52
- data/test/fixtures/discount.json +0 -17
- data/test/fixtures/discount_disabled.json +0 -17
- data/test/fixtures/discounts.json +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9df0482e44736891f79636e0aecd5da3d3b45aec
|
4
|
+
data.tar.gz: 75680b1824c8ec5998fb04e2182347fc3cb13405
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d3f27d99a8bb295cb56598ac12ff294ddaedf3d5875a27028720a72369c3c014eb3778e3f550df500393f1ff7173933a2081f1e66148d335f7ba42a1e64e9f3
|
7
|
+
data.tar.gz: b8bc42e02ddfc09074cd306a9bc4fd77bfdf09c86de473834b29137a15dd8b3fc3095cb20cb410ecd81f39a76ece1434ea55ed0c57feaa6d843e12bd63a1ba22
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -19,7 +19,7 @@ All API usage happens through Shopify applications, created by either shop owner
|
|
19
19
|
* Shop owners can create applications for themselves through their own admin: https://docs.shopify.com/api/authentication/creating-a-private-app
|
20
20
|
* Shopify Partners create applications through their admin: http://app.shopify.com/services/partners
|
21
21
|
|
22
|
-
For more information and detailed documentation about the API visit
|
22
|
+
For more information and detailed documentation about the API visit https://developers.shopify.com/
|
23
23
|
|
24
24
|
#### Ruby version
|
25
25
|
|
@@ -39,15 +39,6 @@ Or install via [gem](http://rubygems.org/)
|
|
39
39
|
gem install shopify_api
|
40
40
|
```
|
41
41
|
|
42
|
-
#### Rails 5
|
43
|
-
|
44
|
-
shopify_api is compatible with Rails 5 but since the latest ActiveResource release (4.1) is locked on Rails 4.x, you'll need to use the unreleased master version:
|
45
|
-
|
46
|
-
```ruby
|
47
|
-
gem 'shopify_api'
|
48
|
-
gem 'activeresource', github: 'rails/activeresource'
|
49
|
-
```
|
50
|
-
|
51
42
|
### Getting Started
|
52
43
|
|
53
44
|
ShopifyAPI uses ActiveResource to communicate with the REST web service. ActiveResource has to be configured with a fully authorized URL of a particular store first. To obtain that URL you can follow these steps:
|
@@ -246,7 +237,7 @@ rake install
|
|
246
237
|
|
247
238
|
## Additional Resources
|
248
239
|
|
249
|
-
API
|
240
|
+
API Reference: https://help.shopify.com/api/reference
|
250
241
|
|
251
242
|
Ask questions on the forums: http://ecommerce.shopify.com/c/shopify-apis-and-technology
|
252
243
|
|
data/lib/shopify_api/limits.rb
CHANGED
@@ -39,8 +39,7 @@ module ShopifyAPI
|
|
39
39
|
# @return {Integer}
|
40
40
|
#
|
41
41
|
def credit_limit(scope=:shop)
|
42
|
-
|
43
|
-
@api_credit_limit[scope] ||= api_credit_limit_param(scope).pop.to_i - 1
|
42
|
+
api_credit_limit_param(scope).pop.to_i - 1
|
44
43
|
end
|
45
44
|
alias_method :call_limit, :credit_limit
|
46
45
|
|
File without changes
|
@@ -1,6 +1,14 @@
|
|
1
1
|
module ShopifyAPI
|
2
|
-
class LineItem < Base
|
2
|
+
class LineItem < Base
|
3
3
|
class Property < Base
|
4
|
+
def initialize(*args)
|
5
|
+
attributes = args[0] || {}
|
6
|
+
persisted = args[1] || false
|
7
|
+
super
|
8
|
+
rescue NameError
|
9
|
+
attributes = attributes.to_hash
|
10
|
+
self
|
11
|
+
end
|
4
12
|
end
|
5
13
|
end
|
6
14
|
end
|
data/lib/shopify_api/version.rb
CHANGED
@@ -0,0 +1,373 @@
|
|
1
|
+
{
|
2
|
+
"order": {
|
3
|
+
"buyer_accepts_marketing": false,
|
4
|
+
"cancel_reason": null,
|
5
|
+
"cancelled_at": null,
|
6
|
+
"cart_token": "68778783ad298f1c80c3bafcddeea02f",
|
7
|
+
"checkout_token": null,
|
8
|
+
"closed_at": null,
|
9
|
+
"confirmed": false,
|
10
|
+
"created_at": "2008-01-10T11:00:00-05:00",
|
11
|
+
"currency": "USD",
|
12
|
+
"email": "bob.norman@hostmail.com",
|
13
|
+
"financial_status": "authorized",
|
14
|
+
"fulfillment_status": null,
|
15
|
+
"gateway": "authorize_net",
|
16
|
+
"id": 450789469,
|
17
|
+
"landing_site": "http://www.example.com?source=abc",
|
18
|
+
"location_id": null,
|
19
|
+
"name": "#1001",
|
20
|
+
"note": "Test note",
|
21
|
+
"number": 1,
|
22
|
+
"reference": "fhwdgads",
|
23
|
+
"referring_site": "http://www.otherexample.com",
|
24
|
+
"source": null,
|
25
|
+
"source_identifier": "fhwdgads",
|
26
|
+
"source_name": "web",
|
27
|
+
"source_url": null,
|
28
|
+
"subtotal_price": "398.00",
|
29
|
+
"taxes_included": false,
|
30
|
+
"test": false,
|
31
|
+
"token": "b1946ac92492d2347c6235b4d2611184",
|
32
|
+
"total_discounts": "0.00",
|
33
|
+
"total_line_items_price": "398.00",
|
34
|
+
"total_price": "409.94",
|
35
|
+
"total_price_usd": "409.94",
|
36
|
+
"total_tax": "11.94",
|
37
|
+
"total_weight": 0,
|
38
|
+
"updated_at": "2008-01-10T11:00:00-05:00",
|
39
|
+
"user_id": null,
|
40
|
+
"browser_ip": null,
|
41
|
+
"landing_site_ref": "abc",
|
42
|
+
"order_number": 1001,
|
43
|
+
"discount_codes": [],
|
44
|
+
"note_attributes": [],
|
45
|
+
"processing_method": "direct",
|
46
|
+
"checkout_id": 450789469,
|
47
|
+
"tax_lines": [
|
48
|
+
{
|
49
|
+
"price": "11.94",
|
50
|
+
"rate": 0.06,
|
51
|
+
"title": "State Tax"
|
52
|
+
}
|
53
|
+
],
|
54
|
+
"tags": "",
|
55
|
+
"line_items": [
|
56
|
+
{
|
57
|
+
"fulfillment_service": "manual",
|
58
|
+
"fulfillment_status": null,
|
59
|
+
"grams": 1361,
|
60
|
+
"id": 466157049,
|
61
|
+
"price": "45.00",
|
62
|
+
"product_id": 632910392,
|
63
|
+
"quantity": 1,
|
64
|
+
"requires_shipping": true,
|
65
|
+
"sku": "",
|
66
|
+
"taxable": true,
|
67
|
+
"title": "Create Your Own Coffee 3 Pack",
|
68
|
+
"variant_id": 39072856,
|
69
|
+
"variant_title": "",
|
70
|
+
"vendor": "VCR",
|
71
|
+
"name": "Create Your Own Coffee 3 Pack",
|
72
|
+
"variant_inventory_management": null,
|
73
|
+
"properties": [
|
74
|
+
{
|
75
|
+
"name": "1st Coffee",
|
76
|
+
"value": "Coffee1"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"name": "2nd Coffee",
|
80
|
+
"value": "Coffee2"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"name": "3rd Coffee",
|
84
|
+
"value": "Coffee3"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"name": "Select Your Grind",
|
88
|
+
"value": "Ground"
|
89
|
+
}
|
90
|
+
],
|
91
|
+
"product_exists": true,
|
92
|
+
"tax_lines": [
|
93
|
+
|
94
|
+
]
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"fulfillment_service": "manual",
|
98
|
+
"fulfillment_status": null,
|
99
|
+
"grams": 680,
|
100
|
+
"id": 641254555689,
|
101
|
+
"price": "24.00",
|
102
|
+
"product_id": 288331137065,
|
103
|
+
"quantity": 1,
|
104
|
+
"requires_shipping": true,
|
105
|
+
"sku": "",
|
106
|
+
"taxable": true,
|
107
|
+
"title": "Create Your Own Coffee 3 Pack (8oz bags)",
|
108
|
+
"variant_id": 4107806867497,
|
109
|
+
"variant_title": "",
|
110
|
+
"vendor": "OMC",
|
111
|
+
"name": "Create Your Own Coffee 3 Pack (8oz bags)",
|
112
|
+
"variant_inventory_management": null,
|
113
|
+
"properties": [
|
114
|
+
{
|
115
|
+
"name": "By default may label with \"Roasted for ",
|
116
|
+
"value": {
|
117
|
+
"Your First Name": {
|
118
|
+
"\". If you want something specific on the label, enter it here:": ""
|
119
|
+
}
|
120
|
+
}
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"name": "Select Your Grind",
|
124
|
+
"value": "Ground"
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"name": "Coffees",
|
128
|
+
"value": "Coffee blend 1"
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"name": "Coffees",
|
132
|
+
"value": "Coffee blend 2"
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"name": "Coffees",
|
136
|
+
"value": "Coffee blend 3"
|
137
|
+
}
|
138
|
+
],
|
139
|
+
"product_exists": true,
|
140
|
+
"tax_lines": [
|
141
|
+
|
142
|
+
]
|
143
|
+
}
|
144
|
+
],
|
145
|
+
"shipping_lines": [
|
146
|
+
{
|
147
|
+
"code": "Free Shipping",
|
148
|
+
"price": "0.00",
|
149
|
+
"source": "shopify",
|
150
|
+
"title": "Free Shipping",
|
151
|
+
"tax_lines": [
|
152
|
+
|
153
|
+
]
|
154
|
+
}
|
155
|
+
],
|
156
|
+
"payment_details": {
|
157
|
+
"avs_result_code": null,
|
158
|
+
"credit_card_bin": null,
|
159
|
+
"cvv_result_code": null,
|
160
|
+
"credit_card_number": "XXXX-XXXX-XXXX-4242",
|
161
|
+
"credit_card_company": "Visa"
|
162
|
+
},
|
163
|
+
"billing_address": {
|
164
|
+
"address1": "Chestnut Street 92",
|
165
|
+
"address2": "",
|
166
|
+
"city": "Louisville",
|
167
|
+
"company": null,
|
168
|
+
"country": "United States",
|
169
|
+
"first_name": "Bob",
|
170
|
+
"last_name": "Norman",
|
171
|
+
"latitude": "45.41634",
|
172
|
+
"longitude": "-75.6868",
|
173
|
+
"phone": "555-625-1199",
|
174
|
+
"province": "Kentucky",
|
175
|
+
"zip": "40202",
|
176
|
+
"name": "Bob Norman",
|
177
|
+
"country_code": "US",
|
178
|
+
"province_code": "KY"
|
179
|
+
},
|
180
|
+
"shipping_address": {
|
181
|
+
"address1": "Chestnut Street 92",
|
182
|
+
"address2": "",
|
183
|
+
"city": "Louisville",
|
184
|
+
"company": null,
|
185
|
+
"country": "United States",
|
186
|
+
"first_name": "Bob",
|
187
|
+
"last_name": "Norman",
|
188
|
+
"latitude": "45.41634",
|
189
|
+
"longitude": "-75.6868",
|
190
|
+
"phone": "555-625-1199",
|
191
|
+
"province": "Kentucky",
|
192
|
+
"zip": "40202",
|
193
|
+
"name": "Bob Norman",
|
194
|
+
"country_code": "US",
|
195
|
+
"province_code": "KY"
|
196
|
+
},
|
197
|
+
"fulfillments": [
|
198
|
+
{
|
199
|
+
"created_at": "2014-03-07T16:14:08-05:00",
|
200
|
+
"id": 255858046,
|
201
|
+
"order_id": 450789469,
|
202
|
+
"service": "manual",
|
203
|
+
"status": "failure",
|
204
|
+
"tracking_company": null,
|
205
|
+
"updated_at": "2014-03-07T16:14:08-05:00",
|
206
|
+
"tracking_number": "1Z2345",
|
207
|
+
"tracking_numbers": [
|
208
|
+
"1Z2345"
|
209
|
+
],
|
210
|
+
"tracking_url": "http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=1Z2345&TypeOfInquiryNumber=T&AcceptUPSLicenseAgreement=yes&submit=Track",
|
211
|
+
"tracking_urls": [
|
212
|
+
"http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=1Z2345&TypeOfInquiryNumber=T&AcceptUPSLicenseAgreement=yes&submit=Track"
|
213
|
+
],
|
214
|
+
"receipt": {
|
215
|
+
"testcase": true,
|
216
|
+
"authorization": "123456"
|
217
|
+
},
|
218
|
+
"line_items": [
|
219
|
+
{
|
220
|
+
"fulfillment_service": "manual",
|
221
|
+
"fulfillment_status": null,
|
222
|
+
"grams": 680,
|
223
|
+
"id": 641254555689,
|
224
|
+
"price": "24.00",
|
225
|
+
"product_id": 288331137065,
|
226
|
+
"quantity": 1,
|
227
|
+
"requires_shipping": true,
|
228
|
+
"sku": "",
|
229
|
+
"taxable": true,
|
230
|
+
"title": "Create Your Own Coffee 3 Pack (8oz bags)",
|
231
|
+
"variant_id": 4107806867497,
|
232
|
+
"variant_title": "",
|
233
|
+
"vendor": "OMC",
|
234
|
+
"name": "Create Your Own Coffee 3 Pack (8oz bags)",
|
235
|
+
"variant_inventory_management": null,
|
236
|
+
"properties": [
|
237
|
+
{
|
238
|
+
"name": "By default may label with \"Roasted for ",
|
239
|
+
"value": {
|
240
|
+
"Your First Name": {
|
241
|
+
"\". If you want something specific on the label, enter it here:": ""
|
242
|
+
}
|
243
|
+
}
|
244
|
+
},
|
245
|
+
{
|
246
|
+
"name": "Select Your Grind",
|
247
|
+
"value": "Ground"
|
248
|
+
},
|
249
|
+
{
|
250
|
+
"name": "Coffees",
|
251
|
+
"value": "Coffee blend 1"
|
252
|
+
},
|
253
|
+
{
|
254
|
+
"name": "Coffees",
|
255
|
+
"value": "Coffee blend 2"
|
256
|
+
},
|
257
|
+
{
|
258
|
+
"name": "Coffees",
|
259
|
+
"value": "Coffee blend 3"
|
260
|
+
}
|
261
|
+
],
|
262
|
+
"product_exists": true,
|
263
|
+
"tax_lines": [
|
264
|
+
|
265
|
+
]
|
266
|
+
}
|
267
|
+
]
|
268
|
+
},
|
269
|
+
{
|
270
|
+
"created_at": "2014-03-07T16:14:08-05:00",
|
271
|
+
"id": 255858046,
|
272
|
+
"order_id": 450789469,
|
273
|
+
"service": "manual",
|
274
|
+
"status": "failure",
|
275
|
+
"tracking_company": null,
|
276
|
+
"updated_at": "2014-03-07T16:14:08-05:00",
|
277
|
+
"tracking_number": "1Z2345",
|
278
|
+
"tracking_numbers": [
|
279
|
+
"1Z2345"
|
280
|
+
],
|
281
|
+
"tracking_url": "http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=1Z2345&TypeOfInquiryNumber=T&AcceptUPSLicenseAgreement=yes&submit=Track",
|
282
|
+
"tracking_urls": [
|
283
|
+
"http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=1Z2345&TypeOfInquiryNumber=T&AcceptUPSLicenseAgreement=yes&submit=Track"
|
284
|
+
],
|
285
|
+
"receipt": {},
|
286
|
+
"line_items": [
|
287
|
+
{
|
288
|
+
"fulfillment_service": "manual",
|
289
|
+
"fulfillment_status": null,
|
290
|
+
"grams": 1361,
|
291
|
+
"id": 466157049,
|
292
|
+
"price": "45.00",
|
293
|
+
"product_id": 632910392,
|
294
|
+
"quantity": 1,
|
295
|
+
"requires_shipping": true,
|
296
|
+
"sku": "",
|
297
|
+
"taxable": true,
|
298
|
+
"title": "Create Your Own Coffee 3 Pack",
|
299
|
+
"variant_id": 39072856,
|
300
|
+
"variant_title": "",
|
301
|
+
"vendor": "VCR",
|
302
|
+
"name": "Create Your Own Coffee 3 Pack",
|
303
|
+
"variant_inventory_management": null,
|
304
|
+
"properties": [
|
305
|
+
{
|
306
|
+
"name": "1st Coffee",
|
307
|
+
"value": "Coffee1"
|
308
|
+
},
|
309
|
+
{
|
310
|
+
"name": "2nd Coffee",
|
311
|
+
"value": "Coffee2"
|
312
|
+
},
|
313
|
+
{
|
314
|
+
"name": "3rd Coffee",
|
315
|
+
"value": "Coffee3"
|
316
|
+
},
|
317
|
+
{
|
318
|
+
"name": "Select Your Grind",
|
319
|
+
"value": "Ground"
|
320
|
+
}
|
321
|
+
],
|
322
|
+
"product_exists": true,
|
323
|
+
"tax_lines": [
|
324
|
+
|
325
|
+
]
|
326
|
+
}
|
327
|
+
]
|
328
|
+
}
|
329
|
+
],
|
330
|
+
"client_details": {
|
331
|
+
"accept_language": null,
|
332
|
+
"browser_ip": "0.0.0.0",
|
333
|
+
"session_hash": null,
|
334
|
+
"user_agent": null
|
335
|
+
},
|
336
|
+
"customer": {
|
337
|
+
"accepts_marketing": false,
|
338
|
+
"created_at": "2014-03-07T16:14:08-05:00",
|
339
|
+
"email": "bob.norman@hostmail.com",
|
340
|
+
"first_name": "Bob",
|
341
|
+
"id": 207119551,
|
342
|
+
"last_name": "Norman",
|
343
|
+
"last_order_id": null,
|
344
|
+
"multipass_identifier": null,
|
345
|
+
"note": null,
|
346
|
+
"orders_count": 0,
|
347
|
+
"state": "disabled",
|
348
|
+
"total_spent": "0.00",
|
349
|
+
"updated_at": "2014-03-07T16:14:08-05:00",
|
350
|
+
"verified_email": true,
|
351
|
+
"tags": "",
|
352
|
+
"last_order_name": null,
|
353
|
+
"default_address": {
|
354
|
+
"address1": "Chestnut Street 92",
|
355
|
+
"address2": "",
|
356
|
+
"city": "Louisville",
|
357
|
+
"company": null,
|
358
|
+
"country": "United States",
|
359
|
+
"first_name": null,
|
360
|
+
"id": 207119551,
|
361
|
+
"last_name": null,
|
362
|
+
"phone": "555-625-1199",
|
363
|
+
"province": "Kentucky",
|
364
|
+
"zip": "40202",
|
365
|
+
"name": null,
|
366
|
+
"province_code": "KY",
|
367
|
+
"country_code": "US",
|
368
|
+
"country_name": "United States",
|
369
|
+
"default": true
|
370
|
+
}
|
371
|
+
}
|
372
|
+
}
|
373
|
+
}
|
data/test/order_test.rb
CHANGED
@@ -8,12 +8,25 @@ class OrderTest < Test::Unit::TestCase
|
|
8
8
|
assert_equal 39072856, order.line_items.first.variant_id
|
9
9
|
end
|
10
10
|
|
11
|
+
test "create should create an order with custom properties" do
|
12
|
+
props = [{ :"By default may label with \"Roasted for " => { :"Your First Name" => { :"\". If you want something specific on the label, enter it here:" => "" }}}]
|
13
|
+
fake 'orders', :method => :post, :status => 201, :body => load_fixture('order_with_properties')
|
14
|
+
order = ShopifyAPI::Order.create(line_items: [{quantity:1, variant_id:39072856, properties:props}], financial_status:"authorized")
|
15
|
+
assert_equal 39072856, order.line_items.first.variant_id
|
16
|
+
end
|
17
|
+
|
11
18
|
test "get should get an order" do
|
12
19
|
fake 'orders/450789469', :method => :get, :status => 200, :body => load_fixture('order')
|
13
20
|
order = ShopifyAPI::Order.find(450789469)
|
14
21
|
assert_equal 450789469, order.id
|
15
22
|
end
|
16
23
|
|
24
|
+
test "get should get an order with custom properties" do
|
25
|
+
fake 'orders/450789469', :method => :get, :status => 200, :body => load_fixture('order_with_properties')
|
26
|
+
order = ShopifyAPI::Order.find(450789469)
|
27
|
+
assert_equal 450789469, order.id
|
28
|
+
end
|
29
|
+
|
17
30
|
test "get all should get all orders" do
|
18
31
|
fake 'orders', :method => :get, :status => 200, :body => load_fixture('orders')
|
19
32
|
order = ShopifyAPI::Order.all
|
@@ -44,4 +57,3 @@ class OrderTest < Test::Unit::TestCase
|
|
44
57
|
assert_request_body({'email' => false, 'restock' => true}.to_json)
|
45
58
|
end
|
46
59
|
end
|
47
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.9.
|
4
|
+
version: 4.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -171,9 +171,8 @@ files:
|
|
171
171
|
- lib/shopify_api/resources/custom_collection.rb
|
172
172
|
- lib/shopify_api/resources/customer.rb
|
173
173
|
- lib/shopify_api/resources/customer_group.rb
|
174
|
-
- lib/shopify_api/resources/
|
174
|
+
- lib/shopify_api/resources/customer_invite.rb
|
175
175
|
- lib/shopify_api/resources/customer_saved_search.rb
|
176
|
-
- lib/shopify_api/resources/discount.rb
|
177
176
|
- lib/shopify_api/resources/discount_code.rb
|
178
177
|
- lib/shopify_api/resources/draft_order.rb
|
179
178
|
- lib/shopify_api/resources/draft_order_invoice.rb
|
@@ -245,7 +244,6 @@ files:
|
|
245
244
|
- test/customer_test.rb
|
246
245
|
- test/detailed_log_subscriber_test.rb
|
247
246
|
- test/discount_code_test.rb
|
248
|
-
- test/discount_test.rb
|
249
247
|
- test/draft_order_test.rb
|
250
248
|
- test/fixtures/access_token_delegate.json
|
251
249
|
- test/fixtures/application_charge.json
|
@@ -273,11 +271,8 @@ files:
|
|
273
271
|
- test/fixtures/customers.json
|
274
272
|
- test/fixtures/customers_account_activation_url.json
|
275
273
|
- test/fixtures/customers_search.json
|
276
|
-
- test/fixtures/discount.json
|
277
274
|
- test/fixtures/discount_code.json
|
278
275
|
- test/fixtures/discount_codes.json
|
279
|
-
- test/fixtures/discount_disabled.json
|
280
|
-
- test/fixtures/discounts.json
|
281
276
|
- test/fixtures/draft_order.json
|
282
277
|
- test/fixtures/draft_order_completed.json
|
283
278
|
- test/fixtures/draft_order_invoice.json
|
@@ -300,6 +295,7 @@ files:
|
|
300
295
|
- test/fixtures/order.json
|
301
296
|
- test/fixtures/order_risk.json
|
302
297
|
- test/fixtures/order_risks.json
|
298
|
+
- test/fixtures/order_with_properties.json
|
303
299
|
- test/fixtures/orders.json
|
304
300
|
- test/fixtures/policies.json
|
305
301
|
- test/fixtures/price_rule.json
|
@@ -388,7 +384,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
388
384
|
version: '0'
|
389
385
|
requirements: []
|
390
386
|
rubyforge_project:
|
391
|
-
rubygems_version: 2.
|
387
|
+
rubygems_version: 2.6.14
|
392
388
|
signing_key:
|
393
389
|
specification_version: 4
|
394
390
|
summary: ShopifyAPI is a lightweight gem for accessing the Shopify admin REST web
|
data/test/discount_test.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class DiscountTest < Test::Unit::TestCase
|
4
|
-
test 'get should get a discount' do
|
5
|
-
fake 'discounts/680866', method: :get, status: 200, body: load_fixture('discount')
|
6
|
-
|
7
|
-
discount = ShopifyAPI::Discount.find(680866)
|
8
|
-
assert_equal 680866, discount.id
|
9
|
-
end
|
10
|
-
|
11
|
-
test 'get should get all discounts' do
|
12
|
-
fake 'discounts', method: :get, status: 200, body: load_fixture('discounts')
|
13
|
-
|
14
|
-
discounts = ShopifyAPI::Discount.all
|
15
|
-
assert_equal 'TENOFF', discounts.first.code
|
16
|
-
end
|
17
|
-
|
18
|
-
test 'create should create a discount' do
|
19
|
-
fake 'discounts', method: :post, status: 201, body: load_fixture('discount')
|
20
|
-
|
21
|
-
discount = ShopifyAPI::Discount.create(code: 'TENOFF', discount_type: 'percentage')
|
22
|
-
assert_equal 'TENOFF', discount.code
|
23
|
-
end
|
24
|
-
|
25
|
-
test 'should disable discount' do
|
26
|
-
fake 'discounts/680866', method: :get, status: 200, body: load_fixture('discount')
|
27
|
-
fake 'discounts/680866/disable', method: :post, status: 201, body: load_fixture('discount_disabled')
|
28
|
-
|
29
|
-
discount = ShopifyAPI::Discount.find(680866)
|
30
|
-
discount.disable
|
31
|
-
|
32
|
-
assert_equal "disabled", discount.status
|
33
|
-
end
|
34
|
-
|
35
|
-
test 'should enable discount' do
|
36
|
-
fake 'discounts/680866', method: :get, status: 200, body: load_fixture('discount')
|
37
|
-
fake 'discounts/680866/enable', method: :post, status: 201, body: load_fixture('discount')
|
38
|
-
|
39
|
-
discount = ShopifyAPI::Discount.find(680866)
|
40
|
-
discount.enable
|
41
|
-
|
42
|
-
assert_equal "enabled", discount.status
|
43
|
-
end
|
44
|
-
|
45
|
-
test 'delete should delete discount' do
|
46
|
-
fake 'discounts/680866', method: :get, status: 200, body: load_fixture('discount')
|
47
|
-
fake 'discounts/680866', method: :delete, status: 200, body: 'destroyed'
|
48
|
-
|
49
|
-
discount = ShopifyAPI::Discount.find(680866)
|
50
|
-
assert discount.destroy
|
51
|
-
end
|
52
|
-
end
|
data/test/fixtures/discount.json
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"discount": {
|
3
|
-
"id": 680866,
|
4
|
-
"code": "TENOFF",
|
5
|
-
"value": "10.0",
|
6
|
-
"ends_at": null,
|
7
|
-
"starts_at": null,
|
8
|
-
"status": "enabled",
|
9
|
-
"minimum_order_amount": "0.00",
|
10
|
-
"usage_limit": null,
|
11
|
-
"applies_to_id": null,
|
12
|
-
"applies_once": false,
|
13
|
-
"discount_type": "percentage",
|
14
|
-
"applies_to_resource": null,
|
15
|
-
"times_used": 1
|
16
|
-
}
|
17
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"discount": {
|
3
|
-
"id": 680866,
|
4
|
-
"code": "TENOFF",
|
5
|
-
"value": "10.0",
|
6
|
-
"ends_at": null,
|
7
|
-
"starts_at": null,
|
8
|
-
"status": "disabled",
|
9
|
-
"minimum_order_amount": "0.00",
|
10
|
-
"usage_limit": null,
|
11
|
-
"applies_to_id": null,
|
12
|
-
"applies_once": false,
|
13
|
-
"discount_type": "percentage",
|
14
|
-
"applies_to_resource": null,
|
15
|
-
"times_used": 1
|
16
|
-
}
|
17
|
-
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"discounts": [
|
3
|
-
{
|
4
|
-
"id": 680866,
|
5
|
-
"code": "TENOFF",
|
6
|
-
"value": "10.0",
|
7
|
-
"ends_at": null,
|
8
|
-
"starts_at": null,
|
9
|
-
"status": "enabled",
|
10
|
-
"minimum_order_amount": "0.00",
|
11
|
-
"usage_limit": null,
|
12
|
-
"applies_to_id": null,
|
13
|
-
"applies_once": false,
|
14
|
-
"discount_type": "percentage",
|
15
|
-
"applies_to_resource": null,
|
16
|
-
"times_used": 1
|
17
|
-
},
|
18
|
-
{
|
19
|
-
"id": 949676421,
|
20
|
-
"code": "xyz",
|
21
|
-
"value": "10.00",
|
22
|
-
"ends_at": null,
|
23
|
-
"starts_at": null,
|
24
|
-
"status": "disabled",
|
25
|
-
"minimum_order_amount": "0.00",
|
26
|
-
"usage_limit": null,
|
27
|
-
"applies_to_id": null,
|
28
|
-
"applies_once": false,
|
29
|
-
"discount_type": "fixed_amount",
|
30
|
-
"applies_to_resource": null,
|
31
|
-
"times_used": 0
|
32
|
-
}
|
33
|
-
]
|
34
|
-
}
|