shopify_api 4.9.0 → 5.0.0
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/.rubocop.yml +8 -0
- data/.travis.yml +0 -4
- data/CHANGELOG +25 -0
- data/README.md +36 -14
- data/lib/shopify_api/limits.rb +1 -2
- data/lib/shopify_api/resources/abandoned_checkout.rb +7 -0
- data/lib/shopify_api/resources/access_scope.rb +5 -0
- data/lib/shopify_api/resources/api_permission.rb +9 -0
- data/lib/shopify_api/resources/asset.rb +8 -8
- data/lib/shopify_api/resources/billing_address.rb +1 -1
- data/lib/shopify_api/resources/checkout.rb +24 -1
- data/lib/shopify_api/resources/custom_collection.rb +3 -3
- data/lib/shopify_api/resources/{customer_invite_message.rb → customer_invite.rb} +0 -0
- data/lib/shopify_api/resources/graphql.rb +22 -0
- data/lib/shopify_api/resources/image.rb +2 -2
- data/lib/shopify_api/resources/inventory_item.rb +6 -0
- data/lib/shopify_api/resources/inventory_level.rb +55 -0
- data/lib/shopify_api/resources/line_item.rb +9 -1
- data/lib/shopify_api/resources/location.rb +4 -0
- data/lib/shopify_api/resources/o_auth.rb +8 -0
- data/lib/shopify_api/resources/order.rb +7 -2
- data/lib/shopify_api/resources/payment.rb +7 -0
- data/lib/shopify_api/resources/ping.rb +3 -0
- data/lib/shopify_api/resources/ping/conversation.rb +18 -0
- data/lib/shopify_api/resources/ping/message.rb +9 -0
- data/lib/shopify_api/resources/product.rb +4 -4
- data/lib/shopify_api/resources/shipping_line.rb +1 -1
- data/lib/shopify_api/resources/shipping_rate.rb +7 -0
- data/lib/shopify_api/resources/shop.rb +4 -4
- data/lib/shopify_api/session.rb +1 -1
- data/lib/shopify_api/version.rb +1 -1
- data/shopify_api.gemspec +2 -1
- data/test/abandoned_checkouts_test.rb +29 -0
- data/test/api_permission_test.rb +9 -0
- data/test/checkouts_test.rb +67 -4
- data/test/detailed_log_subscriber_test.rb +3 -2
- data/test/fixtures/abandoned_checkout.json +184 -0
- data/test/fixtures/abandoned_checkouts.json +186 -0
- data/test/fixtures/checkout.json +160 -0
- data/test/fixtures/checkouts.json +25 -49
- data/test/fixtures/inventory_level.json +7 -0
- data/test/fixtures/inventory_levels.json +24 -0
- data/test/fixtures/order_with_properties.json +373 -0
- data/test/fixtures/payment.json +7 -0
- data/test/fixtures/payments.json +9 -0
- data/test/fixtures/ping/conversation.json +1 -0
- data/test/fixtures/ping/message.json +1 -0
- data/test/fixtures/shipping_rates.json +12 -0
- data/test/inventory_level_test.rb +59 -0
- data/test/location_test.rb +14 -0
- data/test/order_test.rb +13 -1
- data/test/payment_test.rb +19 -0
- data/test/ping/conversation_test.rb +39 -0
- data/test/session_test.rb +11 -11
- data/test/shipping_rate_test.rb +17 -0
- data/test/test_helper.rb +7 -5
- data/test/variant_test.rb +4 -1
- metadata +49 -10
- 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
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class LocationTest < Test::Unit::TestCase
|
4
|
+
test '#inventory_levels returns all inventory_levels associated with this location' do
|
5
|
+
location = ShopifyAPI::Location.new(id: 487838322)
|
6
|
+
expected_body = JSON.parse(load_fixture('inventory_levels'))
|
7
|
+
expected_body['inventory_levels'].delete_if {|level| level['location_id'] != location.id }
|
8
|
+
fake "locations/#{location.id}/inventory_levels", method: :get, status: 200, body: JSON(expected_body).to_s
|
9
|
+
inventory_levels = location.inventory_levels
|
10
|
+
|
11
|
+
assert inventory_levels.all? { |item| item.location_id == location.id },
|
12
|
+
message: 'Response contained locations other than the current location.'
|
13
|
+
end
|
14
|
+
end
|
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
|
-
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class PaymentTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
|
8
|
+
@checkout_id = JSON.parse(load_fixture('checkout'))['checkout']['token']
|
9
|
+
@expected_payment = JSON.parse(load_fixture('payment'))['payment']
|
10
|
+
end
|
11
|
+
|
12
|
+
test ":create creates a new payment" do
|
13
|
+
fake "checkouts/#{@checkout_id}/payments", method: :post, status: 201, body: load_fixture('payment')
|
14
|
+
|
15
|
+
new_payment = ShopifyAPI::Payment.create(checkout_id: @checkout_id)
|
16
|
+
|
17
|
+
assert_equal @expected_payment['unique_token'], new_payment.attributes['unique_token']
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class PingConversationTest < Test::Unit::TestCase
|
6
|
+
def test_create_conversation
|
7
|
+
fake "api/ping-api/v1/conversations", method: :post, body: load_fixture('ping/conversation')
|
8
|
+
|
9
|
+
conversation = ShopifyAPI::Ping::Conversation.new(
|
10
|
+
topic: 'my topic',
|
11
|
+
participants: [
|
12
|
+
{
|
13
|
+
name: 'foo',
|
14
|
+
id: 'test',
|
15
|
+
group: 'customer',
|
16
|
+
},
|
17
|
+
]
|
18
|
+
)
|
19
|
+
|
20
|
+
conversation.save
|
21
|
+
|
22
|
+
assert_equal "d315d4f7-53bd-49ec-8808-23f6db3c641a", conversation.id
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_send_message
|
26
|
+
fake "api/ping-api/v1/conversations/123/messages", method: :post, body: load_fixture('ping/message')
|
27
|
+
|
28
|
+
conversation = ShopifyAPI::Ping::Conversation.new(id: '123')
|
29
|
+
message = conversation.send_message(
|
30
|
+
dedupe_key: SecureRandom.uuid,
|
31
|
+
content: {
|
32
|
+
text: "Hello from shopify_api",
|
33
|
+
},
|
34
|
+
sender_id: 'test',
|
35
|
+
)
|
36
|
+
|
37
|
+
assert_equal "d0c7a2e6-8084-4e79-8483-e4a1352b81f7", message.id
|
38
|
+
end
|
39
|
+
end
|
data/test/session_test.rb
CHANGED
@@ -214,33 +214,33 @@ class SessionTest < Test::Unit::TestCase
|
|
214
214
|
end
|
215
215
|
|
216
216
|
test "return true when the signature is valid and the keys of params are strings" do
|
217
|
-
params = {
|
218
|
-
params[
|
217
|
+
params = { 'code' => 'any-code', 'timestamp' => Time.now }
|
218
|
+
params[:hmac] = generate_signature(params)
|
219
219
|
assert_equal true, ShopifyAPI::Session.validate_signature(params)
|
220
220
|
end
|
221
221
|
|
222
222
|
test "return true when validating signature of params with ampersand and equal sign characters" do
|
223
223
|
ShopifyAPI::Session.secret = 'secret'
|
224
|
-
params = {'a' => '1&b=2', 'c=3&d' => '4'}
|
225
|
-
to_sign =
|
226
|
-
params[
|
227
|
-
|
224
|
+
params = { 'a' => '1&b=2', 'c=3&d' => '4' }
|
225
|
+
to_sign = 'a=1%26b=2&c%3D3%26d=4'
|
226
|
+
params[:hmac] = generate_signature(to_sign)
|
228
227
|
assert_equal true, ShopifyAPI::Session.validate_signature(params)
|
229
228
|
end
|
230
229
|
|
231
230
|
test "return true when validating signature of params with percent sign characters" do
|
232
231
|
ShopifyAPI::Session.secret = 'secret'
|
233
|
-
params = {'a%3D1%26b' => '2%26c%3D3'}
|
234
|
-
to_sign =
|
235
|
-
params[
|
236
|
-
|
232
|
+
params = { 'a%3D1%26b' => '2%26c%3D3' }
|
233
|
+
to_sign = 'a%253D1%2526b=2%2526c%253D3'
|
234
|
+
params[:hmac] = generate_signature(to_sign)
|
237
235
|
assert_equal true, ShopifyAPI::Session.validate_signature(params)
|
238
236
|
end
|
239
237
|
|
240
238
|
private
|
241
239
|
|
242
240
|
def make_sorted_params(params)
|
243
|
-
|
241
|
+
params.with_indifferent_access.except(
|
242
|
+
:signature, :hmac, :action, :controller
|
243
|
+
).collect { |k, v| "#{k}=#{v}" }.sort.join('&')
|
244
244
|
end
|
245
245
|
|
246
246
|
def generate_signature(params)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class ShippingRateTest < Test::Unit::TestCase
|
6
|
+
test ":get lists all shipping rates for a given checkout" do
|
7
|
+
fake 'checkouts', method: :get, status: 200, body: load_fixture('checkouts')
|
8
|
+
checkouts = ShopifyAPI::Checkout.all
|
9
|
+
|
10
|
+
fake "checkouts/#{checkouts.first.id}/shipping_rates",
|
11
|
+
method: :get, status: 200, body: load_fixture('checkouts')
|
12
|
+
shipping_rates = ShopifyAPI::ShippingRate.find(:all, params: { checkout_id: checkouts.first.id })
|
13
|
+
|
14
|
+
assert_equal 2, shipping_rates.first.shipping_rates.length
|
15
|
+
assert_equal 'canada_post-INT.TP.BOGUS-4.00', shipping_rates.first.shipping_rates.first.id
|
16
|
+
end
|
17
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -30,11 +30,13 @@ class Test::Unit::TestCase < Minitest::Unit::TestCase
|
|
30
30
|
|
31
31
|
def setup
|
32
32
|
ActiveResource::Base.format = :json
|
33
|
-
ShopifyAPI.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
[ShopifyAPI, ShopifyAPI::Ping].each do |mod|
|
34
|
+
mod.constants.each do |const|
|
35
|
+
begin
|
36
|
+
const = mod.const_get(const)
|
37
|
+
const.format = :json if const.respond_to?(:format=)
|
38
|
+
rescue NameError
|
39
|
+
end
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
data/test/variant_test.rb
CHANGED
@@ -5,19 +5,22 @@ class VariantTest < Test::Unit::TestCase
|
|
5
5
|
def test_get_variants
|
6
6
|
fake "products/632910392/variants", :method => :get, :body => load_fixture('variants')
|
7
7
|
|
8
|
-
|
8
|
+
variants = ShopifyAPI::Variant.find(:all, :params => { :product_id => 632910392 })
|
9
|
+
assert_equal variants.map(&:id).sort, [39072856, 49148385, 457924702, 808950810]
|
9
10
|
end
|
10
11
|
|
11
12
|
def test_get_variant_namespaced
|
12
13
|
fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
|
13
14
|
|
14
15
|
v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
|
16
|
+
assert_equal 632910392, v.product_id
|
15
17
|
end
|
16
18
|
|
17
19
|
def test_get_variant
|
18
20
|
fake "variants/808950810", :method => :get, :body => load_fixture('variant')
|
19
21
|
|
20
22
|
v = ShopifyAPI::Variant.find(808950810)
|
23
|
+
assert_equal 632910392, v.product_id
|
21
24
|
end
|
22
25
|
|
23
26
|
def test_product_id_should_be_accessible_if_via_product_endpoint
|
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
|
+
version: 5.0.0
|
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-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: graphql-client
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: mocha
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,7 @@ extra_rdoc_files:
|
|
122
136
|
files:
|
123
137
|
- ".document"
|
124
138
|
- ".gitignore"
|
139
|
+
- ".rubocop.yml"
|
125
140
|
- ".travis.yml"
|
126
141
|
- CHANGELOG
|
127
142
|
- CONTRIBUTING.md
|
@@ -151,9 +166,12 @@ files:
|
|
151
166
|
- lib/shopify_api/limits.rb
|
152
167
|
- lib/shopify_api/metafields.rb
|
153
168
|
- lib/shopify_api/resources.rb
|
169
|
+
- lib/shopify_api/resources/abandoned_checkout.rb
|
170
|
+
- lib/shopify_api/resources/access_scope.rb
|
154
171
|
- lib/shopify_api/resources/access_token.rb
|
155
172
|
- lib/shopify_api/resources/address.rb
|
156
173
|
- lib/shopify_api/resources/announcement.rb
|
174
|
+
- lib/shopify_api/resources/api_permission.rb
|
157
175
|
- lib/shopify_api/resources/application_charge.rb
|
158
176
|
- lib/shopify_api/resources/application_credit.rb
|
159
177
|
- lib/shopify_api/resources/article.rb
|
@@ -171,9 +189,8 @@ files:
|
|
171
189
|
- lib/shopify_api/resources/custom_collection.rb
|
172
190
|
- lib/shopify_api/resources/customer.rb
|
173
191
|
- lib/shopify_api/resources/customer_group.rb
|
174
|
-
- lib/shopify_api/resources/
|
192
|
+
- lib/shopify_api/resources/customer_invite.rb
|
175
193
|
- lib/shopify_api/resources/customer_saved_search.rb
|
176
|
-
- lib/shopify_api/resources/discount.rb
|
177
194
|
- lib/shopify_api/resources/discount_code.rb
|
178
195
|
- lib/shopify_api/resources/draft_order.rb
|
179
196
|
- lib/shopify_api/resources/draft_order_invoice.rb
|
@@ -183,7 +200,10 @@ files:
|
|
183
200
|
- lib/shopify_api/resources/fulfillment_request.rb
|
184
201
|
- lib/shopify_api/resources/fulfillment_service.rb
|
185
202
|
- lib/shopify_api/resources/gift_card.rb
|
203
|
+
- lib/shopify_api/resources/graphql.rb
|
186
204
|
- lib/shopify_api/resources/image.rb
|
205
|
+
- lib/shopify_api/resources/inventory_item.rb
|
206
|
+
- lib/shopify_api/resources/inventory_level.rb
|
187
207
|
- lib/shopify_api/resources/line_item.rb
|
188
208
|
- lib/shopify_api/resources/location.rb
|
189
209
|
- lib/shopify_api/resources/marketing_event.rb
|
@@ -194,7 +214,11 @@ files:
|
|
194
214
|
- lib/shopify_api/resources/order.rb
|
195
215
|
- lib/shopify_api/resources/order_risk.rb
|
196
216
|
- lib/shopify_api/resources/page.rb
|
217
|
+
- lib/shopify_api/resources/payment.rb
|
197
218
|
- lib/shopify_api/resources/payment_details.rb
|
219
|
+
- lib/shopify_api/resources/ping.rb
|
220
|
+
- lib/shopify_api/resources/ping/conversation.rb
|
221
|
+
- lib/shopify_api/resources/ping/message.rb
|
198
222
|
- lib/shopify_api/resources/policy.rb
|
199
223
|
- lib/shopify_api/resources/price_rule.rb
|
200
224
|
- lib/shopify_api/resources/product.rb
|
@@ -210,6 +234,7 @@ files:
|
|
210
234
|
- lib/shopify_api/resources/script_tag.rb
|
211
235
|
- lib/shopify_api/resources/shipping_address.rb
|
212
236
|
- lib/shopify_api/resources/shipping_line.rb
|
237
|
+
- lib/shopify_api/resources/shipping_rate.rb
|
213
238
|
- lib/shopify_api/resources/shipping_zone.rb
|
214
239
|
- lib/shopify_api/resources/shop.rb
|
215
240
|
- lib/shopify_api/resources/smart_collection.rb
|
@@ -226,8 +251,10 @@ files:
|
|
226
251
|
- lib/shopify_api/version.rb
|
227
252
|
- shipit.rubygems.yml
|
228
253
|
- shopify_api.gemspec
|
254
|
+
- test/abandoned_checkouts_test.rb
|
229
255
|
- test/access_token_test.rb
|
230
256
|
- test/active_resource/json_errors_test.rb
|
257
|
+
- test/api_permission_test.rb
|
231
258
|
- test/application_charge_test.rb
|
232
259
|
- test/application_credit_test.rb
|
233
260
|
- test/article_test.rb
|
@@ -245,8 +272,9 @@ files:
|
|
245
272
|
- test/customer_test.rb
|
246
273
|
- test/detailed_log_subscriber_test.rb
|
247
274
|
- test/discount_code_test.rb
|
248
|
-
- test/discount_test.rb
|
249
275
|
- test/draft_order_test.rb
|
276
|
+
- test/fixtures/abandoned_checkout.json
|
277
|
+
- test/fixtures/abandoned_checkouts.json
|
250
278
|
- test/fixtures/access_token_delegate.json
|
251
279
|
- test/fixtures/application_charge.json
|
252
280
|
- test/fixtures/application_charges.json
|
@@ -261,6 +289,7 @@ files:
|
|
261
289
|
- test/fixtures/blogs.json
|
262
290
|
- test/fixtures/carrier_service.json
|
263
291
|
- test/fixtures/carts.json
|
292
|
+
- test/fixtures/checkout.json
|
264
293
|
- test/fixtures/checkouts.json
|
265
294
|
- test/fixtures/collect.json
|
266
295
|
- test/fixtures/collection_listing.json
|
@@ -273,11 +302,8 @@ files:
|
|
273
302
|
- test/fixtures/customers.json
|
274
303
|
- test/fixtures/customers_account_activation_url.json
|
275
304
|
- test/fixtures/customers_search.json
|
276
|
-
- test/fixtures/discount.json
|
277
305
|
- test/fixtures/discount_code.json
|
278
306
|
- test/fixtures/discount_codes.json
|
279
|
-
- test/fixtures/discount_disabled.json
|
280
|
-
- test/fixtures/discounts.json
|
281
307
|
- test/fixtures/draft_order.json
|
282
308
|
- test/fixtures/draft_order_completed.json
|
283
309
|
- test/fixtures/draft_order_invoice.json
|
@@ -292,6 +318,8 @@ files:
|
|
292
318
|
- test/fixtures/gift_card_disabled.json
|
293
319
|
- test/fixtures/image.json
|
294
320
|
- test/fixtures/images.json
|
321
|
+
- test/fixtures/inventory_level.json
|
322
|
+
- test/fixtures/inventory_levels.json
|
295
323
|
- test/fixtures/marketing_event.json
|
296
324
|
- test/fixtures/marketing_events.json
|
297
325
|
- test/fixtures/metafield.json
|
@@ -300,7 +328,12 @@ files:
|
|
300
328
|
- test/fixtures/order.json
|
301
329
|
- test/fixtures/order_risk.json
|
302
330
|
- test/fixtures/order_risks.json
|
331
|
+
- test/fixtures/order_with_properties.json
|
303
332
|
- test/fixtures/orders.json
|
333
|
+
- test/fixtures/payment.json
|
334
|
+
- test/fixtures/payments.json
|
335
|
+
- test/fixtures/ping/conversation.json
|
336
|
+
- test/fixtures/ping/message.json
|
304
337
|
- test/fixtures/policies.json
|
305
338
|
- test/fixtures/price_rule.json
|
306
339
|
- test/fixtures/price_rules.json
|
@@ -317,6 +350,7 @@ files:
|
|
317
350
|
- test/fixtures/reports.json
|
318
351
|
- test/fixtures/script_tag.json
|
319
352
|
- test/fixtures/script_tags.json
|
353
|
+
- test/fixtures/shipping_rates.json
|
320
354
|
- test/fixtures/shipping_zones.json
|
321
355
|
- test/fixtures/shop.json
|
322
356
|
- test/fixtures/smart_collection.json
|
@@ -339,12 +373,16 @@ files:
|
|
339
373
|
- test/fulfillment_test.rb
|
340
374
|
- test/gift_card_test.rb
|
341
375
|
- test/image_test.rb
|
376
|
+
- test/inventory_level_test.rb
|
342
377
|
- test/limits_test.rb
|
378
|
+
- test/location_test.rb
|
343
379
|
- test/marketing_event_test.rb
|
344
380
|
- test/metafield_test.rb
|
345
381
|
- test/o_auth_test.rb
|
346
382
|
- test/order_risk_test.rb
|
347
383
|
- test/order_test.rb
|
384
|
+
- test/payment_test.rb
|
385
|
+
- test/ping/conversation_test.rb
|
348
386
|
- test/policy_test.rb
|
349
387
|
- test/price_rule_test.rb
|
350
388
|
- test/product_listing_test.rb
|
@@ -356,6 +394,7 @@ files:
|
|
356
394
|
- test/resource_feedback_test.rb
|
357
395
|
- test/script_tag_test.rb
|
358
396
|
- test/session_test.rb
|
397
|
+
- test/shipping_rate_test.rb
|
359
398
|
- test/shipping_zone_test.rb
|
360
399
|
- test/shop_test.rb
|
361
400
|
- test/smart_collection_test.rb
|
@@ -380,7 +419,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
380
419
|
requirements:
|
381
420
|
- - ">="
|
382
421
|
- !ruby/object:Gem::Version
|
383
|
-
version: '2.
|
422
|
+
version: '2.1'
|
384
423
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
385
424
|
requirements:
|
386
425
|
- - ">="
|
@@ -388,7 +427,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
388
427
|
version: '0'
|
389
428
|
requirements: []
|
390
429
|
rubyforge_project:
|
391
|
-
rubygems_version: 2.
|
430
|
+
rubygems_version: 2.6.14
|
392
431
|
signing_key:
|
393
432
|
specification_version: 4
|
394
433
|
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
|