shopify_api 4.0.6 → 4.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/CONTRIBUTING.md +8 -0
- data/README.md +26 -11
- data/lib/active_resource/json_errors.rb +1 -1
- data/lib/shopify_api/resources/fulfillment_event.rb +15 -0
- data/lib/shopify_api/resources/shipping_zone.rb +4 -0
- data/lib/shopify_api/session.rb +1 -1
- data/lib/shopify_api/version.rb +1 -1
- data/test/active_resource/json_errors_test.rb +7 -10
- data/test/fixtures/fulfillment_event.json +12 -0
- data/test/fixtures/shipping_zones.json +315 -0
- data/test/fulfillment_event_test.rb +69 -0
- data/test/shipping_zone_test.rb +10 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c171c258fbdbd3d55c3d29332ae04332f4712cf
|
4
|
+
data.tar.gz: ae0cc40c73d57a7938195fc1d0bb90af8aeff0b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58ec881bfa5d516de2c9a39aefd1d8278b933f7fffe949e191d451b5b03a55e2afccb4c60c9ff9f4e3965fa30c15fa7b7336d18ad0f5d0510c13030338e81fd5
|
7
|
+
data.tar.gz: 28d02bc796f1ff6dcd56b83a01acfd94ef6aed81bcaef446c2bb4d1d30a0156c5534250f14db4cff2c5d4d7555c8665cbefc68ea4be604acf5a8b9e03e3c0a27
|
data/CHANGELOG
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
Submitting Issues
|
2
|
+
-----------------
|
3
|
+
|
4
|
+
Please open an issue here if you encounter a specific bug with this API client library or if something is documented here https://docs.shopify.com/api but is missing from this package.
|
5
|
+
|
6
|
+
General questions about the Shopify API and usage of this package (not neccessarily a bug) should be posted on the [Shopify forums](https://ecommerce.shopify.com/c/shopify-apis-and-technology).
|
7
|
+
|
8
|
+
When in doubt, post on the forum first. You'll likely have your questions answered more quickly if you post there; more people monitor the forum than Github.
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ The API is implemented as JSON over HTTP using all four verbs (GET/POST/PUT/DELE
|
|
11
11
|
|
12
12
|
All API usage happens through Shopify applications, created by either shop owners for their own shops, or by Shopify Partners for use by other shop owners:
|
13
13
|
|
14
|
-
* Shop owners can create applications for themselves through their own admin:
|
14
|
+
* Shop owners can create applications for themselves through their own admin: https://docs.shopify.com/api/authentication/creating-a-private-app
|
15
15
|
* Shopify Partners create applications through their admin: http://app.shopify.com/services/partners
|
16
16
|
|
17
17
|
For more information and detailed documentation about the API visit http://api.shopify.com
|
@@ -55,7 +55,8 @@ ShopifyAPI uses ActiveResource to communicate with the REST web service. ActiveR
|
|
55
55
|
|
56
56
|
* ``client_id``– Required – The API key for your app
|
57
57
|
* ``scope`` – Required – The list of required scopes (explained here: http://docs.shopify.com/api/tutorials/oauth)
|
58
|
-
* ``redirect_uri`` –
|
58
|
+
* ``redirect_uri`` – Required – The URL where you want to redirect the users after they authorize the client. The complete URL specified here must be identical to one of the Application Redirect URLs set in the App's section of the Partners dashboard. Note: in older applications, this parameter was optional, and redirected to the Application Callback URL when no other value was specified.
|
59
|
+
* ``state`` – Optional – A randomly selected value provided by your application, which is unique for each authorization request. During the OAuth callback phase, your application must check that this value matches the one you provided during authorization. [This mechanism is important for the security of your application](https://tools.ietf.org/html/rfc6819#section-3.6).
|
59
60
|
|
60
61
|
We've added the create_permission_url method to make this easier, first instantiate your session object:
|
61
62
|
|
@@ -76,7 +77,15 @@ ShopifyAPI uses ActiveResource to communicate with the REST web service. ActiveR
|
|
76
77
|
permission_url = session.create_permission_url(scope, "https://my_redirect_uri.com")
|
77
78
|
```
|
78
79
|
|
79
|
-
4. Once authorized, the shop redirects the owner to the return URL of your application with a parameter named 'code'. This is a temporary token that the app can exchange for a permanent access token.
|
80
|
+
4. Once authorized, the shop redirects the owner to the return URL of your application with a parameter named 'code'. This is a temporary token that the app can exchange for a permanent access token.
|
81
|
+
|
82
|
+
Before you proceed, make sure your application performs the following security checks. If any of the checks fails, your application must reject the request with an error, and must not proceed further.
|
83
|
+
|
84
|
+
* Ensure the provided ``state`` is the same one that your application provided to Shopify during Step 3.
|
85
|
+
* Ensure the provided hmac is valid. The hmac is signed by Shopify as explained below, in the Verification section.
|
86
|
+
* Ensure the provided hostname parameter is a valid hostname, ends with myshopify.com, and does not contain characters other than letters (a-z), numbers (0-9), dots, and hyphens.
|
87
|
+
|
88
|
+
If all security checks pass, the authorization code can be exchanged once for a permanent access token. The exchange is made with a request to the shop.
|
80
89
|
|
81
90
|
```
|
82
91
|
POST https://SHOP_NAME.myshopify.com/admin/oauth/access_token
|
@@ -145,28 +154,34 @@ ShopifyAPI uses ActiveResource to communicate with the REST web service. ActiveR
|
|
145
154
|
|
146
155
|
### Console
|
147
156
|
|
148
|
-
This package also
|
157
|
+
This package also supports the ``shopify-cli`` executable to make it easy to open up an interactive console to use the API with a shop.
|
158
|
+
|
159
|
+
1. Install the ``shopify_cli`` gem.
|
160
|
+
|
161
|
+
```bash
|
162
|
+
gem install shopify_cli
|
163
|
+
```
|
149
164
|
|
150
|
-
|
165
|
+
2. Obtain a private API key and password to use with your shop (step 2 in "Getting Started")
|
151
166
|
|
152
|
-
|
167
|
+
3. Use the ``shopify-cli`` script to save the credentials for the shop to quickly log in.
|
153
168
|
|
154
169
|
```bash
|
155
|
-
shopify add yourshopname
|
170
|
+
shopify-cli add yourshopname
|
156
171
|
```
|
157
172
|
|
158
173
|
Follow the prompts for the shop domain, API key and password.
|
159
174
|
|
160
|
-
|
175
|
+
4. Start the console for the connection.
|
161
176
|
|
162
177
|
```bash
|
163
|
-
shopify console
|
178
|
+
shopify-cli console
|
164
179
|
```
|
165
180
|
|
166
|
-
|
181
|
+
5. To see the full list of commands, type:
|
167
182
|
|
168
183
|
```bash
|
169
|
-
shopify help
|
184
|
+
shopify-cli help
|
170
185
|
```
|
171
186
|
|
172
187
|
## Threadsafety
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ShopifyAPI
|
2
|
+
class FulfillmentEvent < Base
|
3
|
+
self.prefix = '/admin/orders/:order_id/fulfillments/:fulfillment_id/'
|
4
|
+
self.collection_name = 'events'
|
5
|
+
self.element_name = 'event'
|
6
|
+
|
7
|
+
def order_id
|
8
|
+
@prefix_options[:order_id]
|
9
|
+
end
|
10
|
+
|
11
|
+
def fulfillment_id
|
12
|
+
@prefix_options[:fulfillment_id]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/shopify_api/session.rb
CHANGED
data/lib/shopify_api/version.rb
CHANGED
@@ -4,19 +4,16 @@ module ActiveResource
|
|
4
4
|
class JsonErrorsTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_parsing_of_error_json_hash
|
7
|
-
|
8
|
-
|
7
|
+
@model = ShopifyAPI::Order.new
|
8
|
+
@model.errors.from_json({errors: {name: ['missing']}}.to_json)
|
9
|
+
assert_equal ['missing'], @model.errors[:name]
|
9
10
|
end
|
10
11
|
|
11
12
|
def test_parsing_of_error_json_plain_string
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def some_error
|
19
|
-
ActiveResource::Errors.new(ShopifyAPI::Order.new)
|
13
|
+
@model = ShopifyAPI::Order.new
|
14
|
+
@model.errors.from_json({errors: 'some generic error'}.to_json)
|
15
|
+
assert_equal ['some generic error'], @model.errors[:base]
|
16
|
+
assert_equal 'some generic error', @model.errors.full_messages.to_sentence
|
20
17
|
end
|
21
18
|
end
|
22
19
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"event": {
|
3
|
+
"created_at": "2013-11-01T16:06:08-04:00",
|
4
|
+
"updated_at": "2013-11-01T16:06:08-04:00",
|
5
|
+
"id": 334455,
|
6
|
+
"fulfillment_id": 255858046,
|
7
|
+
"order_id": 450789469,
|
8
|
+
"status": "in_transit",
|
9
|
+
"happened_at": "2013-11-01T16:06:08-04:00",
|
10
|
+
"estimated_delivery_date": "2013-11-15T18:00:00-04:00"
|
11
|
+
}
|
12
|
+
}
|
@@ -0,0 +1,315 @@
|
|
1
|
+
{
|
2
|
+
"shipping_zones": [
|
3
|
+
{
|
4
|
+
"id": 1,
|
5
|
+
"name": "Canada",
|
6
|
+
"countries": [
|
7
|
+
{
|
8
|
+
"id": 189,
|
9
|
+
"name": "Canada",
|
10
|
+
"tax": 0,
|
11
|
+
"code": "CA",
|
12
|
+
"tax_name": "GST",
|
13
|
+
"provinces": [
|
14
|
+
{
|
15
|
+
"id": 1,
|
16
|
+
"country_id": 189,
|
17
|
+
"name": "Alberta",
|
18
|
+
"code": "AB",
|
19
|
+
"tax": 0,
|
20
|
+
"tax_name": "PST",
|
21
|
+
"tax_type": null,
|
22
|
+
"shipping_zone_id": 1,
|
23
|
+
"tax_percentage": 0
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"id": 2,
|
27
|
+
"country_id": 189,
|
28
|
+
"name": "British Columbia",
|
29
|
+
"code": "BC",
|
30
|
+
"tax": 0,
|
31
|
+
"tax_name": "PST",
|
32
|
+
"tax_type": null,
|
33
|
+
"shipping_zone_id": 1,
|
34
|
+
"tax_percentage": 0
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"id": 9,
|
38
|
+
"country_id": 189,
|
39
|
+
"name": "Ontario",
|
40
|
+
"code": "ON",
|
41
|
+
"tax": 0,
|
42
|
+
"tax_name": "HST",
|
43
|
+
"tax_type": "harmonized",
|
44
|
+
"shipping_zone_id": 1,
|
45
|
+
"tax_percentage": 0
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"id": 11,
|
49
|
+
"country_id": 189,
|
50
|
+
"name": "Quebec",
|
51
|
+
"code": "QC",
|
52
|
+
"tax": 0,
|
53
|
+
"tax_name": "QST",
|
54
|
+
"tax_type": null,
|
55
|
+
"shipping_zone_id": 1,
|
56
|
+
"tax_percentage": 0
|
57
|
+
}
|
58
|
+
]
|
59
|
+
}
|
60
|
+
],
|
61
|
+
"weight_based_shipping_rates": [
|
62
|
+
{
|
63
|
+
"id": 1,
|
64
|
+
"weight_low": 0,
|
65
|
+
"weight_high": 55.12,
|
66
|
+
"name": "Lighter items",
|
67
|
+
"price": "10.00",
|
68
|
+
"shipping_zone_id": 1
|
69
|
+
}
|
70
|
+
],
|
71
|
+
"price_based_shipping_rates": [
|
72
|
+
{
|
73
|
+
"id": 1,
|
74
|
+
"name": "Cheaper items",
|
75
|
+
"min_order_subtotal": "0.00",
|
76
|
+
"price": "100.00",
|
77
|
+
"max_order_subtotal": "50.00",
|
78
|
+
"shipping_zone_id": 1
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"carrier_shipping_rate_providers": [
|
82
|
+
{
|
83
|
+
"id": 81,
|
84
|
+
"country_id": null,
|
85
|
+
"carrier_service_id": 15,
|
86
|
+
"percent_modifier": 1,
|
87
|
+
"service_filter": {
|
88
|
+
"*": "+"
|
89
|
+
},
|
90
|
+
"flat_modifier": "0.00",
|
91
|
+
"shipping_zone_id": 1
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"id": 454,
|
95
|
+
"country_id": null,
|
96
|
+
"carrier_service_id": 17,
|
97
|
+
"percent_modifier": 0,
|
98
|
+
"service_filter": {
|
99
|
+
"*": "+"
|
100
|
+
},
|
101
|
+
"flat_modifier": "0.00",
|
102
|
+
"shipping_zone_id": 1
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"id": 457,
|
106
|
+
"country_id": null,
|
107
|
+
"carrier_service_id": 21,
|
108
|
+
"percent_modifier": 0,
|
109
|
+
"service_filter": {
|
110
|
+
"*": "+"
|
111
|
+
},
|
112
|
+
"flat_modifier": "0.00",
|
113
|
+
"shipping_zone_id": 1
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"id": 460,
|
117
|
+
"country_id": null,
|
118
|
+
"carrier_service_id": 22,
|
119
|
+
"percent_modifier": 0,
|
120
|
+
"service_filter": {
|
121
|
+
"*": "+"
|
122
|
+
},
|
123
|
+
"flat_modifier": "0.00",
|
124
|
+
"shipping_zone_id": 1
|
125
|
+
}
|
126
|
+
]
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"id": 2,
|
130
|
+
"name": "US",
|
131
|
+
"countries": [
|
132
|
+
{
|
133
|
+
"id": 190,
|
134
|
+
"name": "United States",
|
135
|
+
"tax": 0,
|
136
|
+
"code": "US",
|
137
|
+
"tax_name": "Federal Tax",
|
138
|
+
"provinces": [
|
139
|
+
{
|
140
|
+
"id": 58,
|
141
|
+
"country_id": 190,
|
142
|
+
"name": "Puerto Rico",
|
143
|
+
"code": "PR",
|
144
|
+
"tax": 0,
|
145
|
+
"tax_name": "State Tax",
|
146
|
+
"tax_type": null,
|
147
|
+
"shipping_zone_id": 2,
|
148
|
+
"tax_percentage": 0
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"id": 67,
|
152
|
+
"country_id": 190,
|
153
|
+
"name": "Washington",
|
154
|
+
"code": "WA",
|
155
|
+
"tax": 0,
|
156
|
+
"tax_name": "State Tax",
|
157
|
+
"tax_type": null,
|
158
|
+
"shipping_zone_id": 2,
|
159
|
+
"tax_percentage": 0
|
160
|
+
},
|
161
|
+
{
|
162
|
+
"id": 70,
|
163
|
+
"country_id": 190,
|
164
|
+
"name": "Wisconsin",
|
165
|
+
"code": "WI",
|
166
|
+
"tax": 0,
|
167
|
+
"tax_name": "State Tax",
|
168
|
+
"tax_type": null,
|
169
|
+
"shipping_zone_id": 2,
|
170
|
+
"tax_percentage": 0
|
171
|
+
},
|
172
|
+
{
|
173
|
+
"id": 71,
|
174
|
+
"country_id": 190,
|
175
|
+
"name": "Wyoming",
|
176
|
+
"code": "WY",
|
177
|
+
"tax": 0,
|
178
|
+
"tax_name": "State Tax",
|
179
|
+
"tax_type": null,
|
180
|
+
"shipping_zone_id": 2,
|
181
|
+
"tax_percentage": 0
|
182
|
+
}
|
183
|
+
]
|
184
|
+
}
|
185
|
+
],
|
186
|
+
"weight_based_shipping_rates": [
|
187
|
+
|
188
|
+
],
|
189
|
+
"price_based_shipping_rates": [
|
190
|
+
|
191
|
+
],
|
192
|
+
"carrier_shipping_rate_providers": [
|
193
|
+
{
|
194
|
+
"id": 455,
|
195
|
+
"country_id": null,
|
196
|
+
"carrier_service_id": 17,
|
197
|
+
"percent_modifier": 0,
|
198
|
+
"service_filter": {
|
199
|
+
"*": "+"
|
200
|
+
},
|
201
|
+
"flat_modifier": "0.00",
|
202
|
+
"shipping_zone_id": 2
|
203
|
+
},
|
204
|
+
{
|
205
|
+
"id": 458,
|
206
|
+
"country_id": null,
|
207
|
+
"carrier_service_id": 21,
|
208
|
+
"percent_modifier": 0,
|
209
|
+
"service_filter": {
|
210
|
+
"*": "+"
|
211
|
+
},
|
212
|
+
"flat_modifier": "0.00",
|
213
|
+
"shipping_zone_id": 2
|
214
|
+
},
|
215
|
+
{
|
216
|
+
"id": 461,
|
217
|
+
"country_id": null,
|
218
|
+
"carrier_service_id": 22,
|
219
|
+
"percent_modifier": 0,
|
220
|
+
"service_filter": {
|
221
|
+
"*": "+"
|
222
|
+
},
|
223
|
+
"flat_modifier": "0.00",
|
224
|
+
"shipping_zone_id": 2
|
225
|
+
},
|
226
|
+
{
|
227
|
+
"id": 475,
|
228
|
+
"country_id": null,
|
229
|
+
"carrier_service_id": 15,
|
230
|
+
"percent_modifier": 0,
|
231
|
+
"service_filter": {
|
232
|
+
"*": "+"
|
233
|
+
},
|
234
|
+
"flat_modifier": "0.00",
|
235
|
+
"shipping_zone_id": 2
|
236
|
+
}
|
237
|
+
]
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"id": 7,
|
241
|
+
"name": "UK",
|
242
|
+
"countries": [
|
243
|
+
{
|
244
|
+
"id": 195,
|
245
|
+
"name": "United Kingdom",
|
246
|
+
"tax": 0,
|
247
|
+
"code": "GB",
|
248
|
+
"tax_name": "VAT",
|
249
|
+
"provinces": [
|
250
|
+
|
251
|
+
]
|
252
|
+
}
|
253
|
+
],
|
254
|
+
"weight_based_shipping_rates": [
|
255
|
+
|
256
|
+
],
|
257
|
+
"price_based_shipping_rates": [
|
258
|
+
{
|
259
|
+
"id": 2,
|
260
|
+
"name": "Some name",
|
261
|
+
"min_order_subtotal": "0.00",
|
262
|
+
"price": "30.00",
|
263
|
+
"max_order_subtotal": "29.99",
|
264
|
+
"shipping_zone_id": 7
|
265
|
+
}
|
266
|
+
],
|
267
|
+
"carrier_shipping_rate_providers": [
|
268
|
+
{
|
269
|
+
"id": 456,
|
270
|
+
"country_id": null,
|
271
|
+
"carrier_service_id": 17,
|
272
|
+
"percent_modifier": 0,
|
273
|
+
"service_filter": {
|
274
|
+
"*": "+"
|
275
|
+
},
|
276
|
+
"flat_modifier": "0.00",
|
277
|
+
"shipping_zone_id": 7
|
278
|
+
},
|
279
|
+
{
|
280
|
+
"id": 459,
|
281
|
+
"country_id": null,
|
282
|
+
"carrier_service_id": 21,
|
283
|
+
"percent_modifier": 0,
|
284
|
+
"service_filter": {
|
285
|
+
"*": "+"
|
286
|
+
},
|
287
|
+
"flat_modifier": "0.00",
|
288
|
+
"shipping_zone_id": 7
|
289
|
+
},
|
290
|
+
{
|
291
|
+
"id": 462,
|
292
|
+
"country_id": null,
|
293
|
+
"carrier_service_id": 22,
|
294
|
+
"percent_modifier": 0,
|
295
|
+
"service_filter": {
|
296
|
+
"*": "+"
|
297
|
+
},
|
298
|
+
"flat_modifier": "0.00",
|
299
|
+
"shipping_zone_id": 7
|
300
|
+
},
|
301
|
+
{
|
302
|
+
"id": 476,
|
303
|
+
"country_id": null,
|
304
|
+
"carrier_service_id": 15,
|
305
|
+
"percent_modifier": 0,
|
306
|
+
"service_filter": {
|
307
|
+
"*": "+"
|
308
|
+
},
|
309
|
+
"flat_modifier": "0.00",
|
310
|
+
"shipping_zone_id": 7
|
311
|
+
}
|
312
|
+
]
|
313
|
+
}
|
314
|
+
]
|
315
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FulFillmentEventTest < Test::Unit::TestCase
|
4
|
+
def test_find_all_resources
|
5
|
+
fake 'orders/450789469/fulfillments/255858046/events',
|
6
|
+
method: :get,
|
7
|
+
body: "[#{load_fixture('fulfillment_event')}]"
|
8
|
+
|
9
|
+
events = ShopifyAPI::FulfillmentEvent.all(
|
10
|
+
params: { fulfillment_id: 255858046, order_id: 450789469 }
|
11
|
+
)
|
12
|
+
|
13
|
+
assert_equal 1, events.count
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_find_a_resource
|
17
|
+
fake 'orders/450789469/fulfillments/255858046/events/334455',
|
18
|
+
method: :get,
|
19
|
+
body: load_fixture('fulfillment_event')
|
20
|
+
|
21
|
+
event = ShopifyAPI::FulfillmentEvent.find(
|
22
|
+
334455, params: { fulfillment_id: 255858046, order_id: 450789469 }
|
23
|
+
)
|
24
|
+
|
25
|
+
assert_equal 'in_transit', event.status
|
26
|
+
assert_equal 255858046, event.fulfillment_id
|
27
|
+
assert_equal 450789469, event.order_id
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_create_a_resource
|
31
|
+
fake 'orders/450789469/fulfillments/255858046/events', method: :post, body: ''
|
32
|
+
|
33
|
+
event = ShopifyAPI::FulfillmentEvent.new(
|
34
|
+
fulfillment_id: 255858046,
|
35
|
+
order_id: 450789469,
|
36
|
+
status: 'in_transit'
|
37
|
+
)
|
38
|
+
|
39
|
+
assert event.save
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_update_a_resource
|
43
|
+
fake 'orders/450789469/fulfillments/255858046/events/334455',
|
44
|
+
method: :get,
|
45
|
+
body: load_fixture('fulfillment_event')
|
46
|
+
|
47
|
+
event = ShopifyAPI::FulfillmentEvent.find(
|
48
|
+
334455, params: { fulfillment_id: 255858046, order_id: 450789469 }
|
49
|
+
)
|
50
|
+
|
51
|
+
fake 'orders/450789469/fulfillments/255858046/events/334455', method: :put, body: ''
|
52
|
+
|
53
|
+
assert event.save
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_destroy_a_resource
|
57
|
+
fake 'orders/450789469/fulfillments/255858046/events/334455',
|
58
|
+
method: :get,
|
59
|
+
body: load_fixture('fulfillment_event')
|
60
|
+
|
61
|
+
event = ShopifyAPI::FulfillmentEvent.find(
|
62
|
+
334455, params: { fulfillment_id: 255858046, order_id: 450789469 }
|
63
|
+
)
|
64
|
+
|
65
|
+
fake 'orders/450789469/fulfillments/255858046/events/334455', method: :delete, body: ''
|
66
|
+
|
67
|
+
assert event.destroy
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ShippingZoneTest < Test::Unit::TestCase
|
4
|
+
test "get all should get all shipping zones" do
|
5
|
+
fake 'shipping_zones', :method => :get, :status => 200, :body => load_fixture('shipping_zones')
|
6
|
+
checkout = ShopifyAPI::ShippingZone.all
|
7
|
+
assert_equal 1, checkout.first.id
|
8
|
+
assert_equal "Canada", checkout.first.name
|
9
|
+
end
|
10
|
+
end
|
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.0.
|
4
|
+
version: 4.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- ".gitignore"
|
111
111
|
- ".travis.yml"
|
112
112
|
- CHANGELOG
|
113
|
+
- CONTRIBUTING.md
|
113
114
|
- CONTRIBUTORS
|
114
115
|
- Gemfile
|
115
116
|
- Gemfile_ar30
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- lib/shopify_api/resources/customer_saved_search.rb
|
156
157
|
- lib/shopify_api/resources/event.rb
|
157
158
|
- lib/shopify_api/resources/fulfillment.rb
|
159
|
+
- lib/shopify_api/resources/fulfillment_event.rb
|
158
160
|
- lib/shopify_api/resources/fulfillment_service.rb
|
159
161
|
- lib/shopify_api/resources/gift_card.rb
|
160
162
|
- lib/shopify_api/resources/image.rb
|
@@ -178,6 +180,7 @@ files:
|
|
178
180
|
- lib/shopify_api/resources/script_tag.rb
|
179
181
|
- lib/shopify_api/resources/shipping_address.rb
|
180
182
|
- lib/shopify_api/resources/shipping_line.rb
|
183
|
+
- lib/shopify_api/resources/shipping_zone.rb
|
181
184
|
- lib/shopify_api/resources/shop.rb
|
182
185
|
- lib/shopify_api/resources/smart_collection.rb
|
183
186
|
- lib/shopify_api/resources/tax_line.rb
|
@@ -218,6 +221,7 @@ files:
|
|
218
221
|
- test/fixtures/customers_search.json
|
219
222
|
- test/fixtures/events.json
|
220
223
|
- test/fixtures/fulfillment.json
|
224
|
+
- test/fixtures/fulfillment_event.json
|
221
225
|
- test/fixtures/fulfillment_service.json
|
222
226
|
- test/fixtures/gift_card.json
|
223
227
|
- test/fixtures/gift_card_disabled.json
|
@@ -236,6 +240,7 @@ files:
|
|
236
240
|
- test/fixtures/recurring_application_charges.json
|
237
241
|
- test/fixtures/script_tag.json
|
238
242
|
- test/fixtures/script_tags.json
|
243
|
+
- test/fixtures/shipping_zones.json
|
239
244
|
- test/fixtures/shop.json
|
240
245
|
- test/fixtures/tags.json
|
241
246
|
- test/fixtures/transaction.json
|
@@ -243,6 +248,7 @@ files:
|
|
243
248
|
- test/fixtures/variants.json
|
244
249
|
- test/fixtures/webhook.json
|
245
250
|
- test/fixtures/webhooks.json
|
251
|
+
- test/fulfillment_event_test.rb
|
246
252
|
- test/fulfillment_service_test.rb
|
247
253
|
- test/fulfillment_test.rb
|
248
254
|
- test/gift_card_test.rb
|
@@ -257,6 +263,7 @@ files:
|
|
257
263
|
- test/recurring_application_charge_test.rb
|
258
264
|
- test/script_tag_test.rb
|
259
265
|
- test/session_test.rb
|
266
|
+
- test/shipping_zone_test.rb
|
260
267
|
- test/shop_test.rb
|
261
268
|
- test/test_helper.rb
|
262
269
|
- test/transaction_test.rb
|