shopify_api 9.5 → 9.5.1

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: 86c73a80fab5607e57486b42ce37c750797bfc5ac391012b0ca4b8ad2e8dee7e
4
- data.tar.gz: 7b4df963e1f9163d23a51623aa845f32a0bf996abf5f447f22a7226f0b6f0b5d
3
+ metadata.gz: 933903ae7a032f32236d6ab88916650e03e4b0288f65208babba3141816454ac
4
+ data.tar.gz: 7260bf183dfe4327d6d94880dd67745bcc0f413576c7c2e95aa143a0e7649721
5
5
  SHA512:
6
- metadata.gz: 87c1fdb069d8f3946eb2136c99eede3f03eb86373ccd60a1e7e46188b7fd141fd418e92a665802949b6b196625aafd6e4065af815cc52f5ff5d437e25517b7d1
7
- data.tar.gz: ca85757c71561e6956f1e7499142a45f44d511e9256fb112fc594302d12bdca3d0071d68534a2e8061e0949251aec1c00cd8c5c977a7cfc040f3419ab7a9a1bb
6
+ metadata.gz: 5a54d8ee191a8fc3bfa8f11a0df12106ba3b1f46d78d17d4168988e6c56563532ebd1225e076d24e19d90925cc17bc59c1d8cf96be40fd009cacd0251965be9b
7
+ data.tar.gz: 6463e8c51171d93d226adab9441530397bc334aaabf36fa00ab8a9b0e6128e46fa768957faa132971bf402fc9e3618d8b87f7f45d3f538f545391fbc3fd1da23
@@ -12,8 +12,6 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  version:
15
- - "2.4"
16
- - "2.5"
17
15
  - "2.6"
18
16
  - "2.7"
19
17
  - "3.0"
@@ -21,7 +19,8 @@ jobs:
21
19
  - Gemfile_ar41
22
20
  - Gemfile_ar50
23
21
  - Gemfile_ar51
24
- - Gemfile_ar_master
22
+ - Gemfile_ar60
23
+ - Gemfile_ar_main
25
24
  exclude:
26
25
  - version: "2.7"
27
26
  gemfile: Gemfile_ar41
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## Unreleased
2
+
3
+ ## Version 9.5.1
4
+
5
+ - [#891](https://github.com/Shopify/shopify_api/pull/891) Removed the upper bound on the `activeresource` dependency to allow apps to use the latest version
6
+
1
7
  ## Version 9.5
2
8
 
3
9
  * [#883](https://github.com/Shopify/shopify_api/pull/883) Add support for Ruby 3.0
data/Gemfile.lock CHANGED
@@ -1,11 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (9.5)
5
- activeresource (>= 4.1.0, < 6.0.0)
4
+ shopify_api (9.5.1)
5
+ activeresource (>= 4.1.0)
6
6
  graphql-client
7
7
  rack
8
- webrick
9
8
 
10
9
  GEM
11
10
  remote: https://rubygems.org/
@@ -42,7 +41,7 @@ GEM
42
41
  eventmachine (1.2.7)
43
42
  ffi (1.12.2)
44
43
  forwardable-extended (2.6.0)
45
- graphql (1.12.16)
44
+ graphql (1.13.4)
46
45
  graphql-client (0.17.0)
47
46
  activesupport (>= 3.0)
48
47
  graphql (~> 1.10)
@@ -130,7 +129,6 @@ GEM
130
129
  addressable (>= 2.3.6)
131
130
  crack (>= 0.3.2)
132
131
  hashdiff (>= 0.4.0, < 2.0.0)
133
- webrick (1.7.0)
134
132
  zeitwerk (2.3.0)
135
133
 
136
134
  PLATFORMS
data/Gemfile_ar60 ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "activeresource", "~> 6.0"
File without changes
data/README.md CHANGED
@@ -61,6 +61,8 @@ For more information and detailed documentation about the API visit https://deve
61
61
 
62
62
  This gem requires Ruby 2.4 as of version 7.0.
63
63
 
64
+ **Note**: when we release the next major version, we will be dropping support for Ruby 2.4 and 2.5, which have now reached EOL, as per [the releases page](https://www.ruby-lang.org/en/downloads/branches/).
65
+
64
66
  ## Installation
65
67
 
66
68
  Add `shopify_api` to your `Gemfile`:
@@ -87,13 +89,13 @@ ShopifyAPI sessions need to be configured with a fully authorized URL of a parti
87
89
 
88
90
  ### 1) Create an app
89
91
 
90
- First, create a new application in either the partners admin or your store admin.
92
+ First, create a new application in either the partners admin or your store admin.
91
93
 
92
94
  **Private apps** are used for merchant-owned scripts and apps that run silently in the background on a single shop. Private apps aren't able to render any content in the admin. Private apps are created through the store admin.
93
95
 
94
96
  **Custom apps** are also used for a single shop, but they have access to [app extensions](https://shopify.dev/docs/app-extensions) that allow the app to render content in the admin and are managed and created through the partners dashboard.
95
97
 
96
- **Public apps** can be installed on many stores, and can be added to the Shopify App Store to generate revenue for the developer.
98
+ **Public apps** can be installed on many stores, and can be added to the Shopify App Store to generate revenue for the developer.
97
99
 
98
100
  For a private app, you'll need the API_KEY and the PASSWORD; otherwise, you'll need the API_KEY and SHARED_SECRET.
99
101
 
@@ -112,7 +114,7 @@ For a private App you just need to set the base site url as follows:
112
114
  That's it; you're done! Next, skip to step 6 and start using the API!
113
115
 
114
116
  ### 2B) Public and Custom Apps
115
-
117
+
116
118
  For public and custom apps, you will need to supply two parameters to the Session class before you instantiate it:
117
119
 
118
120
  ```ruby
@@ -130,11 +132,11 @@ Public and Custom apps need an access token from each shop to access that shop's
130
132
  ```ruby
131
133
  # We need to instantiate the session object before using it
132
134
  shopify_session = ShopifyAPI::Session.new(domain: "#{SHOP_NAME}.myshopify.com", api_version: api_version, token: nil)
133
-
135
+
134
136
  # Then, create a permission URL with the session
135
137
  permission_url = shopify_session.create_permission_url(scope, "https://my_redirect_uri.com", { state: "My Nonce" })
136
138
  ```
137
-
139
+
138
140
  After creating the permission URL, the user should be directed to this URL to approve the app.
139
141
 
140
142
  Under the hood, the `create_permission_url` method is preparing the app to make the following request :
@@ -167,8 +169,8 @@ Once authorized, the shop redirects the owner to the return URL of your applicat
167
169
  token = shopify_session.request_token(params)
168
170
  ```
169
171
 
170
- This method will save the token to the session object and return it. All fields returned by Shopify, other than the access token itself, are stored in the session's `extra` attribute. For a list of all fields returned by Shopify, read [our OAuth documentation](https://shopify.dev/tutorials/authenticate-with-oauth#confirming-installation).
171
-
172
+ This method will save the token to the session object and return it. All fields returned by Shopify, other than the access token itself, are stored in the session's `extra` attribute. For a list of all fields returned by Shopify, read [our OAuth documentation](https://shopify.dev/tutorials/authenticate-with-oauth#confirming-installation).
173
+
172
174
  If you prefer to exchange the token manually, you can make a POST request to the shop with the following parameters :
173
175
 
174
176
  ```
@@ -198,7 +200,7 @@ Once authorized, the shop redirects the owner to the return URL of your applicat
198
200
  1) The list of scopes in `shopify_session.extra['scope']` is the same as you requested.
199
201
  2) If you requested an online-mode access token, `shopify_session.extra['associated_user']` must be present.
200
202
  Failing either of these tests means the end-user may have tampered with the URL parameters during the OAuth authentication phase. You should avoid using this access token and revoke it immediately. If you use the [`omniauth-shopify-oauth2`](https://github.com/Shopify/omniauth-shopify-oauth2) gem, these checks are done automatically for you.
201
-
203
+
202
204
  ### 5) Activating the session
203
205
 
204
206
  Once you have a token, simply pass in the `token` and `extra` hash (optional) when creating the session object:
@@ -333,7 +335,7 @@ If you were previously using Shopify's [activeresource fork](https://github.com/
333
335
 
334
336
  ## Bulk Operations
335
337
 
336
- With the GraphQL Admin API, you can use bulk operations to asynchronously fetch data in bulk. The API is designed to reduce complexity and improve performance when dealing with large volumes of data.
338
+ With the GraphQL Admin API, you can use bulk operations to asynchronously fetch data in bulk. The API is designed to reduce complexity and improve performance when dealing with large volumes of data.
337
339
 
338
340
  Instead of manually paginating results and managing a client-side throttle, you can instead run a bulk query operation. Shopify’s infrastructure does the hard work of executing your query, and then provides you with a URL where you can download all of the data.
339
341
 
@@ -465,7 +467,7 @@ end
465
467
 
466
468
  ## Pagination
467
469
 
468
- Shopify uses [Relative cursor-based pagination](https://shopify.dev/tutorials/make-paginated-requests-to-rest-admin-api) to provide more than a single page of results.
470
+ Shopify uses [Relative cursor-based pagination](https://shopify.dev/tutorials/make-paginated-requests-to-rest-admin-api) to provide more than a single page of results.
469
471
 
470
472
  ```ruby
471
473
  products = ShopifyAPI::Product.find(:all, params: { limit: 50 })
@@ -628,9 +630,9 @@ or you can even use our automated rake task for docker:
628
630
  bundle exec rake docker
629
631
  ```
630
632
 
631
- # Logging
633
+ # Logging
632
634
 
633
- Enable ActiveResource's logger with
635
+ Enable ActiveResource's logger with
634
636
 
635
637
  `export SHOPIFY_LOG_PATH={your_log_path}`
636
638
 
@@ -1,23 +1,33 @@
1
1
  # frozen_string_literal: true
2
- require 'webrick/httputils'
3
2
 
4
3
  module ShopifyAPI
5
4
  module HmacParams
6
- extend WEBrick::HTTPUtils
5
+ class << self
6
+ def encode(params)
7
+ params
8
+ .except(:signature, :hmac, :action, :controller)
9
+ .map { |k,v| sprintf("%s=%s", encode_key(k), encode_value(v)) }
10
+ .sort.join("&")
11
+ end
7
12
 
8
- def self.encode(params)
9
- params
10
- .except(:signature, :hmac, :action, :controller)
11
- .map { |k,v| sprintf("%s=%s", encode_key(k), encode_value(v)) }
12
- .sort.join("&")
13
- end
13
+ KEY_REGEXP = /([#{Regexp.escape("&=%")}])/n
14
+ def encode_key(key)
15
+ _escape(key.to_s, KEY_REGEXP)
16
+ end
14
17
 
15
- def self.encode_key(key)
16
- _escape(key.to_s, _make_regex('&=%'))
17
- end
18
+ VALUE_REGEXP = /([#{Regexp.escape("&%")}])/n
19
+ def encode_value(value)
20
+ _escape(value.to_s, VALUE_REGEXP)
21
+ end
22
+
23
+ private
18
24
 
19
- def self.encode_value(value)
20
- _escape(value.to_s, _make_regex('&%'))
25
+ def _escape(str, regex)
26
+ str = str.b
27
+ str.gsub!(regex) {"%%%02X" % $1.ord}
28
+ # %-escaped string should contain US-ASCII only
29
+ str.force_encoding(Encoding::US_ASCII)
30
+ end
21
31
  end
22
32
  end
23
33
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ShopifyAPI
3
- VERSION = "9.5"
3
+ VERSION = "9.5.1"
4
4
  end
data/lib/shopify_api.rb CHANGED
@@ -12,6 +12,10 @@ require 'active_resource/json_errors'
12
12
  require 'shopify_api/paginated_collection'
13
13
  require 'shopify_api/disable_prefix_check'
14
14
 
15
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
16
+ puts("\nshopify_api: NOTE: Support for Ruby #{RUBY_VERSION} will be dropped in the next major release. Please update to Ruby 2.6 or newer before updating this gem.\n\n")
17
+ end
18
+
15
19
  module ShopifyAPI
16
20
  include Limits
17
21
  end
data/shopify_api.gemspec CHANGED
@@ -32,10 +32,9 @@ Gem::Specification.new do |s|
32
32
 
33
33
  s.required_ruby_version = ">= 2.4"
34
34
 
35
- s.add_runtime_dependency("activeresource", ">= 4.1.0", "< 6.0.0")
35
+ s.add_runtime_dependency("activeresource", ">= 4.1.0")
36
36
  s.add_runtime_dependency("rack")
37
37
  s.add_runtime_dependency("graphql-client")
38
- s.add_runtime_dependency("webrick")
39
38
 
40
39
  s.add_development_dependency("mocha", ">= 1.4.0")
41
40
  s.add_development_dependency("webmock")
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.5'
4
+ version: 9.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-07 00:00:00.000000000 Z
11
+ date: 2022-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.1.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 6.0.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 4.1.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: 6.0.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: rack
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,20 +52,6 @@ dependencies:
58
52
  - - ">="
59
53
  - !ruby/object:Gem::Version
60
54
  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'
75
55
  - !ruby/object:Gem::Dependency
76
56
  name: mocha
77
57
  requirement: !ruby/object:Gem::Requirement
@@ -212,7 +192,8 @@ files:
212
192
  - Gemfile_ar41
213
193
  - Gemfile_ar50
214
194
  - Gemfile_ar51
215
- - Gemfile_ar_master
195
+ - Gemfile_ar60
196
+ - Gemfile_ar_main
216
197
  - LICENSE
217
198
  - README.md
218
199
  - RELEASING