Skip to content

Commit 70844f9

Browse files
authored
Merge pull request #894 from Shopify/paulo/add_ruby_deprecation_warning
Add Ruby version deprecation warning
2 parents 217687d + c476739 commit 70844f9

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Unreleased
2+
3+
- [#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
4+
15
## Version 9.5
26

37
* [#883](https://github.com/Shopify/shopify_api/pull/883) Add support for Ruby 3.0

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ For more information and detailed documentation about the API visit https://deve
6161

6262
This gem requires Ruby 2.4 as of version 7.0.
6363

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+
6466
## Installation
6567

6668
Add `shopify_api` to your `Gemfile`:
@@ -87,13 +89,13 @@ ShopifyAPI sessions need to be configured with a fully authorized URL of a parti
8789

8890
### 1) Create an app
8991

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.
9193

9294
**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.
9395

9496
**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.
9597

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.
9799

98100
For a private app, you'll need the API_KEY and the PASSWORD; otherwise, you'll need the API_KEY and SHARED_SECRET.
99101

@@ -112,7 +114,7 @@ For a private App you just need to set the base site url as follows:
112114
That's it; you're done! Next, skip to step 6 and start using the API!
113115

114116
### 2B) Public and Custom Apps
115-
117+
116118
For public and custom apps, you will need to supply two parameters to the Session class before you instantiate it:
117119

118120
```ruby
@@ -130,11 +132,11 @@ Public and Custom apps need an access token from each shop to access that shop's
130132
```ruby
131133
# We need to instantiate the session object before using it
132134
shopify_session = ShopifyAPI::Session.new(domain: "#{SHOP_NAME}.myshopify.com", api_version: api_version, token: nil)
133-
135+
134136
# Then, create a permission URL with the session
135137
permission_url = shopify_session.create_permission_url(scope, "https://my_redirect_uri.com", { state: "My Nonce" })
136138
```
137-
139+
138140
After creating the permission URL, the user should be directed to this URL to approve the app.
139141

140142
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
167169
token = shopify_session.request_token(params)
168170
```
169171

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+
172174
If you prefer to exchange the token manually, you can make a POST request to the shop with the following parameters :
173175

174176
```
@@ -198,7 +200,7 @@ Once authorized, the shop redirects the owner to the return URL of your applicat
198200
1) The list of scopes in `shopify_session.extra['scope']` is the same as you requested.
199201
2) If you requested an online-mode access token, `shopify_session.extra['associated_user']` must be present.
200202
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+
202204
### 5) Activating the session
203205

204206
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/
333335

334336
## Bulk Operations
335337

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.
337339

338340
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.
339341

@@ -465,7 +467,7 @@ end
465467

466468
## Pagination
467469

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.
469471

470472
```ruby
471473
products = ShopifyAPI::Product.find(:all, params: { limit: 50 })
@@ -628,9 +630,9 @@ or you can even use our automated rake task for docker:
628630
bundle exec rake docker
629631
```
630632

631-
# Logging
633+
# Logging
632634

633-
Enable ActiveResource's logger with
635+
Enable ActiveResource's logger with
634636

635637
`export SHOPIFY_LOG_PATH={your_log_path}`
636638

lib/shopify_api.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
require 'shopify_api/paginated_collection'
1313
require 'shopify_api/disable_prefix_check'
1414

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+
1519
module ShopifyAPI
1620
include Limits
1721
end

0 commit comments

Comments
 (0)