shopify_api 9.1.0 → 9.2.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/.gitignore +2 -0
- data/.travis.yml +12 -6
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +4 -0
- data/README.md +1 -1
- data/Rakefile +8 -1
- data/SECURITY.md +59 -0
- data/docs/_config.yml +1 -0
- data/docs/_includes/footer.html +28 -0
- data/docs/_includes/head.html +28 -0
- data/docs/_layouts/index.html +57 -0
- data/docs/graphql.md +46 -1
- data/docs/index.md +639 -0
- data/lib/shopify_api/graphql.rb +20 -2
- data/lib/shopify_api/pagination_link_headers.rb +1 -1
- data/lib/shopify_api/resources/base.rb +1 -2
- data/lib/shopify_api/resources/inventory_level.rb +1 -1
- data/lib/shopify_api/resources/product.rb +21 -0
- data/lib/shopify_api/resources/smart_collection.rb +2 -6
- data/lib/shopify_api/resources/variant.rb +37 -0
- data/lib/shopify_api/session.rb +7 -2
- data/lib/shopify_api/version.rb +1 -1
- data/lib/verify_docs.rb +7 -0
- data/shopify_api.gemspec +0 -1
- data/test/base_test.rb +16 -0
- data/test/graphql_test.rb +32 -0
- data/test/product_test.rb +39 -0
- data/test/session_test.rb +44 -2
- data/test/smart_collection_test.rb +0 -25
- data/test/variant_test.rb +77 -19
- metadata +10 -5
- data/bin/shopify +0 -3
data/test/variant_test.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class VariantTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
super
|
6
|
+
fake "products/632910392/variants/808950810", method: :get, body: load_fixture('variant')
|
7
|
+
@variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
|
8
|
+
end
|
4
9
|
|
5
10
|
def test_get_variants
|
6
11
|
fake "products/632910392/variants", :method => :get, :body => load_fixture('variants')
|
@@ -10,37 +15,90 @@ class VariantTest < Test::Unit::TestCase
|
|
10
15
|
end
|
11
16
|
|
12
17
|
def test_get_variant_namespaced
|
13
|
-
|
14
|
-
|
15
|
-
v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
|
16
|
-
assert_equal 632910392, v.product_id
|
18
|
+
assert_equal 632910392, @variant.product_id
|
17
19
|
end
|
18
20
|
|
19
21
|
def test_get_variant
|
20
|
-
|
21
|
-
|
22
|
-
v = ShopifyAPI::Variant.find(808950810)
|
23
|
-
assert_equal 632910392, v.product_id
|
22
|
+
assert_equal 632910392, @variant.product_id
|
24
23
|
end
|
25
24
|
|
26
25
|
def test_product_id_should_be_accessible_if_via_product_endpoint
|
27
|
-
|
28
|
-
|
29
|
-
v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
|
30
|
-
assert_equal 632910392, v.product_id
|
26
|
+
assert_equal 632910392, @variant.product_id
|
31
27
|
end
|
32
28
|
|
33
29
|
def test_product_id_should_be_accessible_if_via_variant_endpoint
|
34
|
-
|
35
|
-
|
36
|
-
v = ShopifyAPI::Variant.find(808950810)
|
37
|
-
assert_equal 632910392, v.product_id
|
30
|
+
assert_equal 632910392, @variant.product_id
|
38
31
|
end
|
39
32
|
|
40
33
|
def test_delete_variant
|
41
|
-
fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
|
42
34
|
fake "products/632910392/variants/808950810", :method => :delete, :body => 'destroyed'
|
43
|
-
|
44
|
-
|
35
|
+
assert @variant.destroy
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_deprecated_inventory_fields_are_included_in_2019_07
|
39
|
+
ShopifyAPI::Base.api_version = '2019-07'
|
40
|
+
assert @variant.as_json.include?('inventory_quantity')
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_deprecated_inventory_fields_are_removed_in_2020_01
|
44
|
+
ShopifyAPI::Base.api_version = '2020-01'
|
45
|
+
refute @variant.as_json.include?('inventory_quantity')
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_setting_variant_inventory_quantity_adjustment_passes_in_api_before_2019_10
|
49
|
+
ShopifyAPI::Base.api_version = '2019-07'
|
50
|
+
@variant.inventory_quantity_adjustment = 8
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_setting_variant_inventory_quantity_adjustment_fails_in_2019_10_api
|
54
|
+
ShopifyAPI::Base.api_version = '2019-10'
|
55
|
+
assert_raises(ShopifyAPI::ValidationException) do
|
56
|
+
@variant.inventory_quantity_adjustment = 8
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_setting_variant_inventory_quantity_adjustment_fails_in_the_unstable_api
|
61
|
+
ShopifyAPI::Base.api_version = :unstable
|
62
|
+
assert_raises(ShopifyAPI::ValidationException) do
|
63
|
+
@variant.inventory_quantity_adjustment = 8
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_setting_variant_inventory_quantity_passes_in_api_before_2019_10
|
68
|
+
ShopifyAPI::Base.api_version = '2019-07'
|
69
|
+
@variant.inventory_quantity = 8
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_setting_variant_inventory_quantity_fails_in_2019_10_api
|
73
|
+
ShopifyAPI::Base.api_version = '2019-10'
|
74
|
+
assert_raises(ShopifyAPI::ValidationException) do
|
75
|
+
@variant.inventory_quantity = 8
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_setting_variant_inventory_quantity_fails_in_the_unstable_api
|
80
|
+
ShopifyAPI::Base.api_version = :unstable
|
81
|
+
assert_raises(ShopifyAPI::ValidationException) do
|
82
|
+
@variant.inventory_quantity = 8
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_setting_variant_old_inventory_quantity_passes_in_api_before_2019_10
|
87
|
+
ShopifyAPI::Base.api_version = '2019-07'
|
88
|
+
@variant.old_inventory_quantity = 8
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_setting_variant_old_inventory_quantity_fails_in_2019_10_api
|
92
|
+
ShopifyAPI::Base.api_version = '2019-10'
|
93
|
+
assert_raises(ShopifyAPI::ValidationException) do
|
94
|
+
@variant.old_inventory_quantity = 8
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_setting_variant_old_inventory_quantity_fails_in_the_unstable_api
|
99
|
+
ShopifyAPI::Base.api_version = :unstable
|
100
|
+
assert_raises(ShopifyAPI::ValidationException) do
|
101
|
+
@variant.old_inventory_quantity = 8
|
102
|
+
end
|
45
103
|
end
|
46
104
|
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: 9.
|
4
|
+
version: 9.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -175,8 +175,7 @@ description: The Shopify API gem allows Ruby developers to programmatically acce
|
|
175
175
|
HTTP using all four verbs (GET/POST/PUT/DELETE). Each resource, like Order, Product,
|
176
176
|
or Collection, has its own URL and is manipulated in isolation.
|
177
177
|
email: developers@jadedpixel.com
|
178
|
-
executables:
|
179
|
-
- shopify
|
178
|
+
executables: []
|
180
179
|
extensions: []
|
181
180
|
extra_rdoc_files:
|
182
181
|
- LICENSE
|
@@ -201,9 +200,14 @@ files:
|
|
201
200
|
- README.md
|
202
201
|
- RELEASING
|
203
202
|
- Rakefile
|
204
|
-
-
|
203
|
+
- SECURITY.md
|
205
204
|
- docker-compose.yml
|
205
|
+
- docs/_config.yml
|
206
|
+
- docs/_includes/footer.html
|
207
|
+
- docs/_includes/head.html
|
208
|
+
- docs/_layouts/index.html
|
206
209
|
- docs/graphql.md
|
210
|
+
- docs/index.md
|
207
211
|
- lib/active_resource/connection_ext.rb
|
208
212
|
- lib/active_resource/detailed_log_subscriber.rb
|
209
213
|
- lib/active_resource/json_errors.rb
|
@@ -315,6 +319,7 @@ files:
|
|
315
319
|
- lib/shopify_api/resources/webhook.rb
|
316
320
|
- lib/shopify_api/session.rb
|
317
321
|
- lib/shopify_api/version.rb
|
322
|
+
- lib/verify_docs.rb
|
318
323
|
- service.yml
|
319
324
|
- shipit.rubygems.yml
|
320
325
|
- shopify_api.gemspec
|
data/bin/shopify
DELETED