shopify_api 9.0.3 → 9.0.4

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
  SHA256:
3
- metadata.gz: a9f98c9f7ec2a7834c9b4f69c4dfa346e23b220173a03690cabc753e9d0b4318
4
- data.tar.gz: 5245b531946faf49fc3213e7faadc5b8372ba71ccfa8e26f14d8b2630bff0d36
3
+ metadata.gz: 723b8cdb25dbd053853fe820e298d98d535ee211258c04d511c43712c0e51370
4
+ data.tar.gz: 3306effb209ba7893725cc2b8d56556318db3bea0c7c47916acb58e2df9799e3
5
5
  SHA512:
6
- metadata.gz: a8b09cb70ebd5ff98dfe08bb4adfb6f25cfa2a2f5023b7e9d703a6e97d33dd6beaac6dfbae29780cf6cab8f9de87718c1e3c5e6cdc8fe2b85b1258a9315c1fa9
7
- data.tar.gz: f17ae5b2022d64fe91391dda645e9684b57449dd274f3de0ebbf8c8117072c67d78849646ba914c1432f60b4cfce46ed4b62432e7ecdb00651e1f59210d26c2a
6
+ metadata.gz: f42c91932eac35091ffa52485df0c82718f79a8945668bd72fdb33cbd0c0c3ca8c71daa2296b0166fbf305892a4789cdabef4356ae3b0b582bf85db68def7695
7
+ data.tar.gz: f4f530f8e6af923ccfc199136dc29a6ee0c82539aad6c1eb182f6bcceb1d230aa1690e6ba2043e19f1cb5d7cbd11a62a10b792f38643a9872b50504331bc2a0b
@@ -1,3 +1,7 @@
1
+ ## Version 9.0.4
2
+
3
+ * Contains [#708](https://github.com/Shopify/shopify_api/pull/708) which is a revert for [#655](https://github.com/shopify/shopify_api/pull/655) due to the deprecated inventory parameters not being removed correctly in some cases
4
+
1
5
  ## Version 9.0.3
2
6
 
3
7
  * We now raise a `ShopifyAPI::ValidationException` exception when clients try to use `Product` and `Variant` with deprecated inventory-related fields in API version `2019-10` or later. [#655](https://github.com/shopify/shopify_api/pull/655) Deprecation and migration information can be found in the following documents:
@@ -16,15 +16,6 @@ module ShopifyAPI
16
16
  end
17
17
  end
18
18
 
19
- def total_inventory=(new_value)
20
- raise_deprecated_inventory_call('total_inventory') unless allow_inventory_params?
21
- super
22
- end
23
-
24
- def serializable_hash(options = {})
25
- allow_inventory_params? ? super(options) : super(options).except('total_inventory')
26
- end
27
-
28
19
  def collections
29
20
  CustomCollection.find(:all, :params => {:product_id => self.id})
30
21
  end
@@ -40,17 +31,5 @@ module ShopifyAPI
40
31
  def remove_from_collection(collection)
41
32
  collection.remove_product(self)
42
33
  end
43
-
44
- private
45
-
46
- def raise_deprecated_inventory_call(parameter)
47
- raise(ShopifyAPI::ValidationException,
48
- "'#{parameter}' is deprecated - see https://help.shopify.com/en/api/guides/inventory-migration-guide",
49
- )
50
- end
51
-
52
- def allow_inventory_params?
53
- Base.api_version < ApiVersion.find_version('2019-10')
54
- end
55
34
  end
56
35
  end
@@ -4,36 +4,5 @@ module ShopifyAPI
4
4
  include DisablePrefixCheck
5
5
 
6
6
  conditional_prefix :product
7
-
8
- def inventory_quantity_adjustment=(new_value)
9
- raise_deprecated_inventory_call('inventory_quantity_adjustment') unless allow_inventory_params?
10
- super
11
- end
12
-
13
- def inventory_quantity=(new_value)
14
- raise_deprecated_inventory_call('inventory_quantity') unless allow_inventory_params?
15
- super
16
- end
17
-
18
- def old_inventory_quantity=(new_value)
19
- raise_deprecated_inventory_call('old_inventory_quantity') unless allow_inventory_params?
20
- super
21
- end
22
-
23
- def serializable_hash(options = {})
24
- allow_inventory_params? ? super(options) : super(options).except('inventory_quantity', 'old_inventory_quantity')
25
- end
26
-
27
- private
28
-
29
- def raise_deprecated_inventory_call(parameter)
30
- raise(ShopifyAPI::ValidationException,
31
- "'#{parameter}' is deprecated - see https://help.shopify.com/en/api/guides/inventory-migration-guide",
32
- )
33
- end
34
-
35
- def allow_inventory_params?
36
- Base.api_version < ApiVersion.find_version('2019-10')
37
- end
38
7
  end
39
8
  end
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "9.0.3"
2
+ VERSION = "9.0.4"
3
3
  end
@@ -57,43 +57,4 @@ class ProductTest < Test::Unit::TestCase
57
57
 
58
58
  assert_equal('100.00 - 199.00', @product.price_range)
59
59
  end
60
-
61
- def test_deprecated_variant_inventory_fields_are_included_in_2019_07
62
- ShopifyAPI::Base.api_version = '2019-07'
63
- variant = @product.variants.first
64
- assert variant.as_json.include?('inventory_quantity')
65
- end
66
-
67
- def test_deprecated_variant_inventory_fields_are_removed_in_2020_01
68
- ShopifyAPI::Base.api_version = '2020-01'
69
- variant = @product.variants.first
70
- refute variant.as_json.include?('inventory_quantity')
71
- end
72
-
73
- def test_deprecated_inventory_fields_are_removed_in_2020_01
74
- ShopifyAPI::Base.api_version = '2020-01'
75
- refute @product.as_json.include?('total_inventory')
76
- end
77
-
78
- def test_setting_product_total_inventory_passes_in_api_before_2019_10
79
- ShopifyAPI::Base.api_version = '2019-07'
80
- fake("products/632910392", {:body => load_fixture('product')})
81
- @product.total_inventory = 8
82
- end
83
-
84
- def test_setting_product_total_inventory_fails_in_2019_10_api
85
- ShopifyAPI::Base.api_version = '2019-10'
86
- fake("products/632910392", {:body => load_fixture('product')})
87
- assert_raises(ShopifyAPI::ValidationException) do
88
- @product.total_inventory = 8
89
- end
90
- end
91
-
92
- def test_setting_product_total_inventory_fails_in_the_unstable_api
93
- ShopifyAPI::Base.api_version = :unstable
94
- fake("products/632910392", {:body => load_fixture('product')})
95
- assert_raises(ShopifyAPI::ValidationException) do
96
- @product.total_inventory = 8
97
- end
98
- end
99
60
  end
@@ -96,7 +96,7 @@ module Test
96
96
  body = options.has_key?(:body) ? options.delete(:body) : load_fixture(endpoint)
97
97
  format = options.delete(:format) || :json
98
98
  method = options.delete(:method) || :get
99
- api_version = options.delete(:api_version) || ShopifyAPI::Base.api_version
99
+ api_version = options.delete(:api_version) || ShopifyAPI::ApiVersion.find_version('2019-01')
100
100
  extension = ".#{options.delete(:extension)||'json'}" unless options[:extension]==false
101
101
  status = options.delete(:status) || 200
102
102
  url = if options.has_key?(:url)
@@ -43,93 +43,4 @@ class VariantTest < Test::Unit::TestCase
43
43
  v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
44
44
  assert v.destroy
45
45
  end
46
-
47
- def test_deprecated_inventory_fields_are_included_in_2019_07
48
- ShopifyAPI::Base.api_version = '2019-07'
49
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
50
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
51
- assert variant.as_json.include?('inventory_quantity')
52
- end
53
-
54
- def test_deprecated_inventory_fields_are_removed_in_2020_01
55
- ShopifyAPI::Base.api_version = '2020-01'
56
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
57
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
58
- refute variant.as_json.include?('inventory_quantity')
59
- end
60
-
61
- def test_setting_variant_inventory_quantity_adjustment_passes_in_api_before_2019_10
62
- ShopifyAPI::Base.api_version = '2019-07'
63
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
64
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
65
- variant.inventory_quantity_adjustment = 8
66
- end
67
-
68
- def test_setting_variant_inventory_quantity_adjustment_fails_in_2019_10_api
69
- ShopifyAPI::Base.api_version = '2019-10'
70
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
71
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
72
- assert_raises(ShopifyAPI::ValidationException) do
73
- variant.inventory_quantity_adjustment = 8
74
- end
75
- end
76
-
77
- def test_setting_variant_inventory_quantity_adjustment_fails_in_the_unstable_api
78
- ShopifyAPI::Base.api_version = :unstable
79
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
80
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
81
- assert_raises(ShopifyAPI::ValidationException) do
82
- variant.inventory_quantity_adjustment = 8
83
- end
84
- end
85
-
86
- def test_setting_variant_inventory_quantity_passes_in_api_before_2019_10
87
- ShopifyAPI::Base.api_version = '2019-07'
88
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
89
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
90
- variant.inventory_quantity = 8
91
- end
92
-
93
- def test_setting_variant_inventory_quantity_fails_in_2019_10_api
94
- ShopifyAPI::Base.api_version = '2019-10'
95
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
96
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
97
- assert_raises(ShopifyAPI::ValidationException) do
98
- variant.inventory_quantity = 8
99
- end
100
- end
101
-
102
- def test_setting_variant_inventory_quantity_fails_in_the_unstable_api
103
- ShopifyAPI::Base.api_version = :unstable
104
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
105
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
106
- assert_raises(ShopifyAPI::ValidationException) do
107
- variant.inventory_quantity = 8
108
- end
109
- end
110
-
111
- def test_setting_variant_old_inventory_quantity_passes_in_api_before_2019_10
112
- ShopifyAPI::Base.api_version = '2019-07'
113
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
114
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
115
- variant.old_inventory_quantity = 8
116
- end
117
-
118
- def test_setting_variant_old_inventory_quantity_fails_in_2019_10_api
119
- ShopifyAPI::Base.api_version = '2019-10'
120
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
121
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
122
- assert_raises(ShopifyAPI::ValidationException) do
123
- variant.old_inventory_quantity = 8
124
- end
125
- end
126
-
127
- def test_setting_variant_old_inventory_quantity_fails_in_the_unstable_api
128
- ShopifyAPI::Base.api_version = :unstable
129
- fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
130
- variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
131
- assert_raises(ShopifyAPI::ValidationException) do
132
- variant.old_inventory_quantity = 8
133
- end
134
- end
135
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.0.3
4
+ version: 9.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify