shopify_api 9.2.0 → 9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -1
  3. data/.github/ISSUE_TEMPLATE.md +36 -0
  4. data/.github/workflows/build.yml +44 -0
  5. data/.gitignore +0 -1
  6. data/.rubocop.yml +23 -3
  7. data/.rubocop_todo.yml +75 -0
  8. data/CHANGELOG.md +29 -0
  9. data/Gemfile +1 -0
  10. data/Gemfile.lock +153 -0
  11. data/Gemfile_ar51 +1 -1
  12. data/README.md +41 -31
  13. data/RELEASING +10 -6
  14. data/Rakefile +10 -6
  15. data/dev.yml +11 -0
  16. data/docs/graphql.md +1 -1
  17. data/docs/index.md +1 -1
  18. data/lib/active_resource/connection_ext.rb +1 -0
  19. data/lib/active_resource/detailed_log_subscriber.rb +10 -7
  20. data/lib/active_resource/json_errors.rb +8 -2
  21. data/lib/shopify_api/api_access.rb +57 -0
  22. data/lib/shopify_api/api_version.rb +6 -5
  23. data/lib/shopify_api/connection.rb +1 -0
  24. data/lib/shopify_api/countable.rb +3 -2
  25. data/lib/shopify_api/disable_prefix_check.rb +2 -2
  26. data/lib/shopify_api/events.rb +2 -1
  27. data/lib/shopify_api/graphql.rb +8 -6
  28. data/lib/shopify_api/hmac_params.rb +23 -0
  29. data/lib/shopify_api/limits.rb +3 -2
  30. data/lib/shopify_api/message_enricher.rb +11 -9
  31. data/lib/shopify_api/meta.rb +0 -1
  32. data/lib/shopify_api/metafields.rb +5 -4
  33. data/lib/shopify_api/pagination_link_headers.rb +4 -3
  34. data/lib/shopify_api/resources/access_scope.rb +1 -1
  35. data/lib/shopify_api/resources/access_token.rb +1 -0
  36. data/lib/shopify_api/resources/address.rb +1 -0
  37. data/lib/shopify_api/resources/announcement.rb +2 -1
  38. data/lib/shopify_api/resources/application_charge.rb +1 -0
  39. data/lib/shopify_api/resources/application_credit.rb +1 -0
  40. data/lib/shopify_api/resources/article.rb +3 -2
  41. data/lib/shopify_api/resources/asset.rb +6 -5
  42. data/lib/shopify_api/resources/assigned_fulfillment_order.rb +1 -1
  43. data/lib/shopify_api/resources/base.rb +11 -6
  44. data/lib/shopify_api/resources/billing_address.rb +1 -0
  45. data/lib/shopify_api/resources/blog.rb +2 -1
  46. data/lib/shopify_api/resources/carrier_service.rb +1 -0
  47. data/lib/shopify_api/resources/cart.rb +2 -1
  48. data/lib/shopify_api/resources/collect.rb +1 -0
  49. data/lib/shopify_api/resources/collection_listing.rb +1 -0
  50. data/lib/shopify_api/resources/comment.rb +20 -5
  51. data/lib/shopify_api/resources/country.rb +1 -0
  52. data/lib/shopify_api/resources/custom_collection.rb +4 -3
  53. data/lib/shopify_api/resources/customer.rb +2 -1
  54. data/lib/shopify_api/resources/customer_group.rb +1 -0
  55. data/lib/shopify_api/resources/customer_invite.rb +1 -0
  56. data/lib/shopify_api/resources/customer_saved_search.rb +2 -1
  57. data/lib/shopify_api/resources/discount_code.rb +1 -0
  58. data/lib/shopify_api/resources/discount_code_batch.rb +4 -2
  59. data/lib/shopify_api/resources/draft_order.rb +1 -0
  60. data/lib/shopify_api/resources/draft_order_invoice.rb +1 -0
  61. data/lib/shopify_api/resources/event.rb +1 -0
  62. data/lib/shopify_api/resources/fulfillment.rb +12 -3
  63. data/lib/shopify_api/resources/fulfillment_event.rb +1 -0
  64. data/lib/shopify_api/resources/fulfillment_order.rb +30 -16
  65. data/lib/shopify_api/resources/fulfillment_order_locations_for_move.rb +1 -0
  66. data/lib/shopify_api/resources/fulfillment_request.rb +1 -0
  67. data/lib/shopify_api/resources/fulfillment_service.rb +1 -0
  68. data/lib/shopify_api/resources/fulfillment_v2.rb +3 -2
  69. data/lib/shopify_api/resources/gift_card.rb +1 -0
  70. data/lib/shopify_api/resources/image.rb +2 -1
  71. data/lib/shopify_api/resources/inventory_level.rb +2 -3
  72. data/lib/shopify_api/resources/line_item.rb +4 -3
  73. data/lib/shopify_api/resources/location.rb +1 -1
  74. data/lib/shopify_api/resources/marketing_event.rb +1 -0
  75. data/lib/shopify_api/resources/metafield.rb +1 -0
  76. data/lib/shopify_api/resources/note_attribute.rb +1 -0
  77. data/lib/shopify_api/resources/option.rb +1 -0
  78. data/lib/shopify_api/resources/order.rb +2 -1
  79. data/lib/shopify_api/resources/order_risk.rb +1 -0
  80. data/lib/shopify_api/resources/page.rb +1 -0
  81. data/lib/shopify_api/resources/payment_details.rb +1 -0
  82. data/lib/shopify_api/resources/policy.rb +1 -0
  83. data/lib/shopify_api/resources/price_rule.rb +1 -1
  84. data/lib/shopify_api/resources/product.rb +14 -11
  85. data/lib/shopify_api/resources/product_listing.rb +1 -0
  86. data/lib/shopify_api/resources/province.rb +1 -0
  87. data/lib/shopify_api/resources/receipt.rb +1 -0
  88. data/lib/shopify_api/resources/recurring_application_charge.rb +4 -1
  89. data/lib/shopify_api/resources/redirect.rb +1 -0
  90. data/lib/shopify_api/resources/refund.rb +2 -1
  91. data/lib/shopify_api/resources/report.rb +1 -0
  92. data/lib/shopify_api/resources/resource_feedback.rb +1 -1
  93. data/lib/shopify_api/resources/rule.rb +1 -0
  94. data/lib/shopify_api/resources/script_tag.rb +1 -0
  95. data/lib/shopify_api/resources/shipping_address.rb +1 -0
  96. data/lib/shopify_api/resources/shipping_line.rb +1 -0
  97. data/lib/shopify_api/resources/shipping_zone.rb +1 -0
  98. data/lib/shopify_api/resources/shop.rb +2 -1
  99. data/lib/shopify_api/resources/smart_collection.rb +2 -2
  100. data/lib/shopify_api/resources/storefront_access_token.rb +1 -0
  101. data/lib/shopify_api/resources/tax_line.rb +1 -0
  102. data/lib/shopify_api/resources/tax_service.rb +1 -0
  103. data/lib/shopify_api/resources/theme.rb +1 -0
  104. data/lib/shopify_api/resources/transaction.rb +1 -0
  105. data/lib/shopify_api/resources/usage_charge.rb +1 -0
  106. data/lib/shopify_api/resources/user.rb +1 -0
  107. data/lib/shopify_api/resources/variant.rb +16 -18
  108. data/lib/shopify_api/resources/webhook.rb +1 -0
  109. data/lib/shopify_api/resources.rb +1 -0
  110. data/lib/shopify_api/session.rb +29 -19
  111. data/lib/shopify_api/version.rb +2 -1
  112. data/lib/shopify_api.rb +9 -1
  113. data/lib/verify_docs.rb +1 -0
  114. data/service.yml +2 -5
  115. data/shopify_api.gemspec +12 -5
  116. data/test/access_token_test.rb +6 -5
  117. data/test/active_resource/json_errors_test.rb +6 -6
  118. data/test/api_access_test.rb +153 -0
  119. data/test/api_version_test.rb +3 -3
  120. data/test/application_charge_test.rb +30 -27
  121. data/test/application_credit_test.rb +10 -9
  122. data/test/article_test.rb +34 -35
  123. data/test/asset_test.rb +14 -6
  124. data/test/assigned_fulfillment_order_test.rb +5 -4
  125. data/test/base_test.rb +55 -56
  126. data/test/blog_test.rb +4 -3
  127. data/test/carrier_service_test.rb +7 -6
  128. data/test/cart_test.rb +2 -1
  129. data/test/collect_test.rb +4 -3
  130. data/test/collection_listing_test.rb +21 -16
  131. data/test/collection_publication_test.rb +8 -8
  132. data/test/collection_test.rb +20 -19
  133. data/test/countable_test.rb +3 -2
  134. data/test/currency_test.rb +5 -5
  135. data/test/custom_collection_test.rb +4 -3
  136. data/test/customer_saved_search_test.rb +18 -8
  137. data/test/customer_test.rb +22 -14
  138. data/test/detailed_log_subscriber_test.rb +16 -12
  139. data/test/discount_code_batch_test.rb +11 -10
  140. data/test/discount_code_test.rb +21 -15
  141. data/test/draft_order_test.rb +68 -52
  142. data/test/fixtures/assigned_fulfillment_orders.json +2 -0
  143. data/test/fixtures/fulfillment_order.json +1 -0
  144. data/test/fixtures/fulfillment_orders.json +2 -0
  145. data/test/fulfillment_event_test.rb +31 -26
  146. data/test/fulfillment_order_test.rb +217 -149
  147. data/test/fulfillment_order_test_helper.rb +1 -0
  148. data/test/fulfillment_request_test.rb +10 -8
  149. data/test/fulfillment_service_test.rb +13 -12
  150. data/test/fulfillment_test.rb +81 -66
  151. data/test/fulfillment_v2_test.rb +16 -12
  152. data/test/gift_card_test.rb +6 -4
  153. data/test/graphql_test.rb +27 -27
  154. data/test/hmac_params_test.rb +25 -0
  155. data/test/image_test.rb +19 -17
  156. data/test/inventory_level_test.rb +24 -15
  157. data/test/lib/webmock_extensions/last_request.rb +1 -1
  158. data/test/limits_test.rb +2 -1
  159. data/test/location_test.rb +2 -1
  160. data/test/marketing_event_test.rb +20 -20
  161. data/test/message_enricher_test.rb +6 -6
  162. data/test/meta_test.rb +9 -11
  163. data/test/metafield_test.rb +30 -20
  164. data/test/order_risk_test.rb +17 -16
  165. data/test/order_test.rb +43 -28
  166. data/test/pagination_test.rb +89 -56
  167. data/test/policy_test.rb +6 -5
  168. data/test/price_rule_test.rb +20 -15
  169. data/test/product_listing_test.rb +20 -20
  170. data/test/product_publication_test.rb +8 -8
  171. data/test/product_test.rb +44 -32
  172. data/test/publication_test.rb +3 -3
  173. data/test/recurring_application_charge_test.rb +104 -42
  174. data/test/redirect_test.rb +4 -3
  175. data/test/refund_test.rb +22 -17
  176. data/test/report_test.rb +12 -10
  177. data/test/resource_feedback_test.rb +14 -13
  178. data/test/script_tag_test.rb +10 -9
  179. data/test/session_test.rb +159 -48
  180. data/test/shipping_zone_test.rb +4 -3
  181. data/test/shop_test.rb +47 -33
  182. data/test/smart_collection_test.rb +5 -4
  183. data/test/storefront_access_token_test.rb +13 -15
  184. data/test/tax_service_test.rb +7 -4
  185. data/test/tender_transaction_test.rb +3 -3
  186. data/test/test_helper.rb +13 -11
  187. data/test/transaction_test.rb +4 -3
  188. data/test/usage_charge_test.rb +12 -8
  189. data/test/user_test.rb +4 -3
  190. data/test/variant_test.rb +23 -54
  191. data/test/webhook_test.rb +10 -7
  192. metadata +34 -12
  193. data/.rubocop-https---shopify-github-io-ruby-style-guide-rubocop-yml +0 -1027
  194. data/.travis.yml +0 -28
data/test/test_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rubygems'
2
3
  require 'minitest/autorun'
3
4
  require 'webmock/minitest'
@@ -23,7 +24,7 @@ module Test
23
24
  self.test("should_#{string}", &block)
24
25
  end
25
26
 
26
- def self.context(string)
27
+ def self.context(_string)
27
28
  yield
28
29
  end
29
30
 
@@ -34,6 +35,7 @@ module Test
34
35
  const = mod.const_get(const)
35
36
  const.format = :json if const.respond_to?(:format=)
36
37
  rescue NameError
38
+ # Do nothing
37
39
  end
38
40
  end
39
41
 
@@ -68,7 +70,7 @@ module Test
68
70
 
69
71
  # Custom Assertions
70
72
  def assert_not(expression)
71
- refute expression, "Expected <#{expression}> to be false!"
73
+ refute(expression, "Expected <#{expression}> to be false!")
72
74
  end
73
75
 
74
76
  def assert_nothing_raised
@@ -76,30 +78,30 @@ module Test
76
78
  end
77
79
 
78
80
  def assert_not_includes(array, value)
79
- refute array.include?(value)
81
+ refute(array.include?(value))
80
82
  end
81
83
 
82
84
  def assert_includes(array, value)
83
- assert array.include?(value)
85
+ assert(array.include?(value))
84
86
  end
85
87
 
86
- def load_fixture(name, format=:json)
88
+ def load_fixture(name, format = :json)
87
89
  File.read(File.dirname(__FILE__) + "/fixtures/#{name}.#{format}")
88
90
  end
89
91
 
90
92
  def assert_request_body(expected)
91
- assert_equal expected, WebMock.last_request.body
93
+ assert_equal(expected, WebMock.last_request.body)
92
94
  end
93
95
 
94
- def fake(endpoint, options={})
95
- request_body = options.has_key?(:request_body) ? options.delete(:request_body) : nil
96
- body = options.has_key?(:body) ? options.delete(:body) : load_fixture(endpoint)
96
+ def fake(endpoint, options = {})
97
+ request_body = options.key?(:request_body) ? options.delete(:request_body) : nil
98
+ body = options.key?(:body) ? options.delete(:body) : load_fixture(endpoint)
97
99
  format = options.delete(:format) || :json
98
100
  method = options.delete(:method) || :get
99
101
  api_version = options.delete(:api_version) || ShopifyAPI::ApiVersion.find_version('2019-01')
100
- extension = ".#{options.delete(:extension)||'json'}" unless options[:extension]==false
102
+ extension = ".#{options.delete(:extension) || 'json'}" unless options[:extension] == false
101
103
  status = options.delete(:status) || 200
102
- url = if options.has_key?(:url)
104
+ url = if options.key?(:url)
103
105
  options[:url]
104
106
  else
105
107
  "https://this-is-my-test-shop.myshopify.com#{api_version.construct_api_path("#{endpoint}#{extension}")}"
@@ -1,16 +1,17 @@
1
+ # frozen_string_literal: true
1
2
  require 'test_helper'
2
3
 
3
4
  class TransactionTest < Test::Unit::TestCase
4
5
  def setup
5
6
  super
6
- fake "orders/450789469/transactions/389404469", :method => :get, :body => load_fixture('transaction')
7
+ fake("orders/450789469/transactions/389404469", method: :get, body: load_fixture('transaction'))
7
8
  end
8
9
 
9
10
  context "Transaction" do
10
11
  context "#find" do
11
12
  should "find a specific transaction" do
12
- transaction = ShopifyAPI::Transaction.find(389404469, :params => {:order_id => 450789469})
13
- assert_equal "409.94", transaction.amount
13
+ transaction = ShopifyAPI::Transaction.find(389404469, params: { order_id: 450789469 })
14
+ assert_equal("409.94", transaction.amount)
14
15
  end
15
16
  end
16
17
  end
@@ -1,21 +1,25 @@
1
+ # frozen_string_literal: true
1
2
  require 'test_helper'
2
3
 
3
4
  class UsageChargeTest < Test::Unit::TestCase
4
-
5
5
  def test_create_usage_charges
6
- fake "recurring_application_charges/654381177/usage_charges", method: :post, body: load_fixture('usage_charge')
6
+ fake("recurring_application_charges/654381177/usage_charges", method: :post, body: load_fixture('usage_charge'))
7
7
 
8
8
  usage_charge = ShopifyAPI::UsageCharge.new(description: '1000 emails', price: 1.0)
9
- usage_charge.prefix_options = {recurring_application_charge_id: 654381177}
10
- assert usage_charge.save
9
+ usage_charge.prefix_options = { recurring_application_charge_id: 654381177 }
10
+ assert(usage_charge.save)
11
11
  end
12
12
 
13
13
  def test_get_usage_charges
14
- fake "recurring_application_charges/654381177/usage_charges/359376002", method: :get, status: 201, body: load_fixture('usage_charge')
14
+ fake(
15
+ "recurring_application_charges/654381177/usage_charges/359376002",
16
+ method: :get,
17
+ status: 201,
18
+ body: load_fixture('usage_charge')
19
+ )
15
20
 
16
- usage_charge = ShopifyAPI::UsageCharge.find(359376002, params: {recurring_application_charge_id: 654381177})
21
+ usage_charge = ShopifyAPI::UsageCharge.find(359376002, params: { recurring_application_charge_id: 654381177 })
17
22
 
18
- assert_equal "1000 emails", usage_charge.description
23
+ assert_equal("1000 emails", usage_charge.description)
19
24
  end
20
-
21
25
  end
data/test/user_test.rb CHANGED
@@ -1,16 +1,17 @@
1
+ # frozen_string_literal: true
1
2
  require 'test_helper'
2
3
 
3
4
  class UserTest < Test::Unit::TestCase
4
5
  test 'get should get a user' do
5
6
  fake 'users/799407056', method: :get, status: 200, body: load_fixture('user')
6
-
7
+
7
8
  user = ShopifyAPI::User.find(799407056)
8
9
  assert_equal 799407056, user.id
9
10
  end
10
-
11
+
11
12
  test 'get should get all users' do
12
13
  fake 'users', method: :get, status: 200, body: load_fixture('users')
13
-
14
+
14
15
  users = ShopifyAPI::User.all
15
16
  assert_equal 799407056, users.first.id
16
17
  end
data/test/variant_test.rb CHANGED
@@ -1,60 +1,44 @@
1
+ # frozen_string_literal: true
1
2
  require 'test_helper'
2
3
 
3
4
  class VariantTest < Test::Unit::TestCase
4
5
  def setup
5
6
  super
6
- fake "products/632910392/variants/808950810", method: :get, body: load_fixture('variant')
7
- @variant = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
7
+ refresh_variant
8
8
  end
9
9
 
10
10
  def test_get_variants
11
- fake "products/632910392/variants", :method => :get, :body => load_fixture('variants')
11
+ fake("products/632910392/variants", method: :get, body: load_fixture('variants'))
12
12
 
13
- variants = ShopifyAPI::Variant.find(:all, :params => { :product_id => 632910392 })
14
- assert_equal variants.map(&:id).sort, [39072856, 49148385, 457924702, 808950810]
13
+ variants = ShopifyAPI::Variant.find(:all, params: { product_id: 632910392 })
14
+ assert_equal(variants.map(&:id).sort, [39072856, 49148385, 457924702, 808950810])
15
15
  end
16
16
 
17
17
  def test_get_variant_namespaced
18
- assert_equal 632910392, @variant.product_id
18
+ assert_equal(632910392, @variant.product_id)
19
19
  end
20
20
 
21
21
  def test_get_variant
22
- assert_equal 632910392, @variant.product_id
22
+ assert_equal(632910392, @variant.product_id)
23
23
  end
24
24
 
25
25
  def test_product_id_should_be_accessible_if_via_product_endpoint
26
- assert_equal 632910392, @variant.product_id
26
+ assert_equal(632910392, @variant.product_id)
27
27
  end
28
28
 
29
29
  def test_product_id_should_be_accessible_if_via_variant_endpoint
30
- assert_equal 632910392, @variant.product_id
30
+ assert_equal(632910392, @variant.product_id)
31
31
  end
32
32
 
33
33
  def test_delete_variant
34
- fake "products/632910392/variants/808950810", :method => :delete, :body => 'destroyed'
35
- assert @variant.destroy
34
+ fake("products/632910392/variants/808950810", method: :delete, body: 'destroyed')
35
+ assert(@variant.destroy)
36
36
  end
37
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
38
+ def test_read_only_inventory_quantity
44
39
  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
40
+ refresh_variant(api_version: ShopifyAPI::Base.api_version)
41
+ assert_equal(10, @variant.inventory_quantity)
58
42
  end
59
43
 
60
44
  def test_setting_variant_inventory_quantity_adjustment_fails_in_the_unstable_api
@@ -64,18 +48,6 @@ class VariantTest < Test::Unit::TestCase
64
48
  end
65
49
  end
66
50
 
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
51
  def test_setting_variant_inventory_quantity_fails_in_the_unstable_api
80
52
  ShopifyAPI::Base.api_version = :unstable
81
53
  assert_raises(ShopifyAPI::ValidationException) do
@@ -83,22 +55,19 @@ class VariantTest < Test::Unit::TestCase
83
55
  end
84
56
  end
85
57
 
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
58
  def test_setting_variant_old_inventory_quantity_fails_in_the_unstable_api
99
59
  ShopifyAPI::Base.api_version = :unstable
100
60
  assert_raises(ShopifyAPI::ValidationException) do
101
61
  @variant.old_inventory_quantity = 8
102
62
  end
103
63
  end
64
+
65
+ private
66
+
67
+ def refresh_variant(api_version: nil)
68
+ fake(
69
+ "products/632910392/variants/808950810", method: :get, body: load_fixture('variant'), api_version: api_version
70
+ )
71
+ @variant = ShopifyAPI::Variant.find(808950810, params: { product_id: 632910392 })
72
+ end
104
73
  end
data/test/webhook_test.rb CHANGED
@@ -1,21 +1,24 @@
1
+ # frozen_string_literal: true
1
2
  require 'test_helper'
2
3
 
3
4
  class WebhookTest < Test::Unit::TestCase
4
5
  test 'create should create a webhook' do
5
- fake 'webhooks', :method => :post, :status => 201, :body => load_fixture('webhook')
6
- webhook = ShopifyAPI::Webhook.create(address: "http://www.yoloship.it/webhook", topic: "orders/create", format: "json")
7
- assert_equal "http://www.yoloship.it/webhook", webhook.address
6
+ fake('webhooks', method: :post, status: 201, body: load_fixture('webhook'))
7
+ webhook = ShopifyAPI::Webhook.create(
8
+ address: "http://www.yoloship.it/webhook", topic: "orders/create", format: "json"
9
+ )
10
+ assert_equal("http://www.yoloship.it/webhook", webhook.address)
8
11
  end
9
12
 
10
13
  test 'get should retrieve a webhook' do
11
- fake 'webhooks/123456', :method => :get, :status => 200, :body => load_fixture('webhook')
14
+ fake('webhooks/123456', method: :get, status: 200, body: load_fixture('webhook'))
12
15
  webhook = ShopifyAPI::Webhook.find(123456)
13
- assert_equal "http://www.yoloship.it/webhook", webhook.address
16
+ assert_equal("http://www.yoloship.it/webhook", webhook.address)
14
17
  end
15
18
 
16
19
  test 'find all should return all webhooks' do
17
- fake 'webhooks', :method => :get, :status => 200, :body => load_fixture('webhooks')
20
+ fake('webhooks', method: :get, status: 200, body: load_fixture('webhooks'))
18
21
  webhook = ShopifyAPI::Webhook.all
19
- assert_equal 123456, webhook.first.id
22
+ assert_equal(123456, webhook.first.id)
20
23
  end
21
24
  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.2.0
4
+ version: '9.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-14 00:00:00.000000000 Z
11
+ date: 2021-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: webrick
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: mocha
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +106,14 @@ dependencies:
92
106
  requirements:
93
107
  - - ">="
94
108
  - !ruby/object:Gem::Version
95
- version: '4.0'
109
+ version: '5.14'
96
110
  type: :development
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - ">="
101
115
  - !ruby/object:Gem::Version
102
- version: '4.0'
116
+ version: '5.14'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: rake
105
119
  requirement: !ruby/object:Gem::Requirement
@@ -129,7 +143,7 @@ dependencies:
129
143
  - !ruby/object:Gem::Version
130
144
  version: '0'
131
145
  - !ruby/object:Gem::Dependency
132
- name: rubocop
146
+ name: rubocop-shopify
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - ">="
@@ -170,10 +184,11 @@ dependencies:
170
184
  - - ">="
171
185
  - !ruby/object:Gem::Version
172
186
  version: '0'
173
- description: The Shopify API gem allows Ruby developers to programmatically access
174
- the admin section of Shopify stores. The API is implemented as JSON or XML over
175
- HTTP using all four verbs (GET/POST/PUT/DELETE). Each resource, like Order, Product,
176
- or Collection, has its own URL and is manipulated in isolation.
187
+ description: |
188
+ The Shopify API gem allows Ruby developers to programmatically access the admin
189
+ section of Shopify stores. The API is implemented as JSON or XML over HTTP using
190
+ all four verbs (GET/POST/PUT/DELETE). Each resource, like Order, Product, or
191
+ Collection, has its own URL and is manipulated in isolation.
177
192
  email: developers@jadedpixel.com
178
193
  executables: []
179
194
  extensions: []
@@ -183,15 +198,17 @@ extra_rdoc_files:
183
198
  files:
184
199
  - ".document"
185
200
  - ".github/CODEOWNERS"
201
+ - ".github/ISSUE_TEMPLATE.md"
186
202
  - ".github/probots.yml"
203
+ - ".github/workflows/build.yml"
187
204
  - ".gitignore"
188
- - ".rubocop-https---shopify-github-io-ruby-style-guide-rubocop-yml"
189
205
  - ".rubocop.yml"
190
- - ".travis.yml"
206
+ - ".rubocop_todo.yml"
191
207
  - CHANGELOG.md
192
208
  - CONTRIBUTING.md
193
209
  - CONTRIBUTORS
194
210
  - Gemfile
211
+ - Gemfile.lock
195
212
  - Gemfile_ar41
196
213
  - Gemfile_ar50
197
214
  - Gemfile_ar51
@@ -201,6 +218,7 @@ files:
201
218
  - RELEASING
202
219
  - Rakefile
203
220
  - SECURITY.md
221
+ - dev.yml
204
222
  - docker-compose.yml
205
223
  - docs/_config.yml
206
224
  - docs/_includes/footer.html
@@ -212,6 +230,7 @@ files:
212
230
  - lib/active_resource/detailed_log_subscriber.rb
213
231
  - lib/active_resource/json_errors.rb
214
232
  - lib/shopify_api.rb
233
+ - lib/shopify_api/api_access.rb
215
234
  - lib/shopify_api/api_version.rb
216
235
  - lib/shopify_api/connection.rb
217
236
  - lib/shopify_api/countable.rb
@@ -221,6 +240,7 @@ files:
221
240
  - lib/shopify_api/graphql/http_client.rb
222
241
  - lib/shopify_api/graphql/railtie.rb
223
242
  - lib/shopify_api/graphql/task.rake
243
+ - lib/shopify_api/hmac_params.rb
224
244
  - lib/shopify_api/limits.rb
225
245
  - lib/shopify_api/message_enricher.rb
226
246
  - lib/shopify_api/meta.rb
@@ -327,6 +347,7 @@ files:
327
347
  - test/access_scope_test.rb
328
348
  - test/access_token_test.rb
329
349
  - test/active_resource/json_errors_test.rb
350
+ - test/api_access_test.rb
330
351
  - test/api_permission_test.rb
331
352
  - test/api_version_test.rb
332
353
  - test/application_charge_test.rb
@@ -482,6 +503,7 @@ files:
482
503
  - test/gift_card_test.rb
483
504
  - test/graphql/http_client_test.rb
484
505
  - test/graphql_test.rb
506
+ - test/hmac_params_test.rb
485
507
  - test/image_test.rb
486
508
  - test/inventory_level_test.rb
487
509
  - test/lib/webmock_extensions/last_request.rb
@@ -542,7 +564,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
542
564
  - !ruby/object:Gem::Version
543
565
  version: '0'
544
566
  requirements: []
545
- rubygems_version: 3.0.3
567
+ rubygems_version: 3.2.20
546
568
  signing_key:
547
569
  specification_version: 4
548
570
  summary: ShopifyAPI is a lightweight gem for accessing the Shopify admin REST web