shopify_api 9.2.0 → 9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -1
- data/.github/ISSUE_TEMPLATE.md +36 -0
- data/.github/workflows/build.yml +44 -0
- data/.gitignore +0 -1
- data/.rubocop.yml +23 -3
- data/.rubocop_todo.yml +75 -0
- data/CHANGELOG.md +29 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +153 -0
- data/Gemfile_ar51 +1 -1
- data/README.md +41 -31
- data/RELEASING +10 -6
- data/Rakefile +10 -6
- data/dev.yml +11 -0
- data/docs/graphql.md +1 -1
- data/docs/index.md +1 -1
- data/lib/active_resource/connection_ext.rb +1 -0
- data/lib/active_resource/detailed_log_subscriber.rb +10 -7
- data/lib/active_resource/json_errors.rb +8 -2
- data/lib/shopify_api/api_access.rb +57 -0
- data/lib/shopify_api/api_version.rb +6 -5
- data/lib/shopify_api/connection.rb +1 -0
- data/lib/shopify_api/countable.rb +3 -2
- data/lib/shopify_api/disable_prefix_check.rb +2 -2
- data/lib/shopify_api/events.rb +2 -1
- data/lib/shopify_api/graphql.rb +8 -6
- data/lib/shopify_api/hmac_params.rb +23 -0
- data/lib/shopify_api/limits.rb +3 -2
- data/lib/shopify_api/message_enricher.rb +11 -9
- data/lib/shopify_api/meta.rb +0 -1
- data/lib/shopify_api/metafields.rb +5 -4
- data/lib/shopify_api/pagination_link_headers.rb +4 -3
- data/lib/shopify_api/resources/access_scope.rb +1 -1
- data/lib/shopify_api/resources/access_token.rb +1 -0
- data/lib/shopify_api/resources/address.rb +1 -0
- data/lib/shopify_api/resources/announcement.rb +2 -1
- data/lib/shopify_api/resources/application_charge.rb +1 -0
- data/lib/shopify_api/resources/application_credit.rb +1 -0
- data/lib/shopify_api/resources/article.rb +3 -2
- data/lib/shopify_api/resources/asset.rb +6 -5
- data/lib/shopify_api/resources/assigned_fulfillment_order.rb +1 -1
- data/lib/shopify_api/resources/base.rb +11 -6
- data/lib/shopify_api/resources/billing_address.rb +1 -0
- data/lib/shopify_api/resources/blog.rb +2 -1
- data/lib/shopify_api/resources/carrier_service.rb +1 -0
- data/lib/shopify_api/resources/cart.rb +2 -1
- data/lib/shopify_api/resources/collect.rb +1 -0
- data/lib/shopify_api/resources/collection_listing.rb +1 -0
- data/lib/shopify_api/resources/comment.rb +20 -5
- data/lib/shopify_api/resources/country.rb +1 -0
- data/lib/shopify_api/resources/custom_collection.rb +4 -3
- data/lib/shopify_api/resources/customer.rb +2 -1
- data/lib/shopify_api/resources/customer_group.rb +1 -0
- data/lib/shopify_api/resources/customer_invite.rb +1 -0
- data/lib/shopify_api/resources/customer_saved_search.rb +2 -1
- data/lib/shopify_api/resources/discount_code.rb +1 -0
- data/lib/shopify_api/resources/discount_code_batch.rb +4 -2
- data/lib/shopify_api/resources/draft_order.rb +1 -0
- data/lib/shopify_api/resources/draft_order_invoice.rb +1 -0
- data/lib/shopify_api/resources/event.rb +1 -0
- data/lib/shopify_api/resources/fulfillment.rb +12 -3
- data/lib/shopify_api/resources/fulfillment_event.rb +1 -0
- data/lib/shopify_api/resources/fulfillment_order.rb +30 -16
- data/lib/shopify_api/resources/fulfillment_order_locations_for_move.rb +1 -0
- data/lib/shopify_api/resources/fulfillment_request.rb +1 -0
- data/lib/shopify_api/resources/fulfillment_service.rb +1 -0
- data/lib/shopify_api/resources/fulfillment_v2.rb +3 -2
- data/lib/shopify_api/resources/gift_card.rb +1 -0
- data/lib/shopify_api/resources/image.rb +2 -1
- data/lib/shopify_api/resources/inventory_level.rb +2 -3
- data/lib/shopify_api/resources/line_item.rb +4 -3
- data/lib/shopify_api/resources/location.rb +1 -1
- data/lib/shopify_api/resources/marketing_event.rb +1 -0
- data/lib/shopify_api/resources/metafield.rb +1 -0
- data/lib/shopify_api/resources/note_attribute.rb +1 -0
- data/lib/shopify_api/resources/option.rb +1 -0
- data/lib/shopify_api/resources/order.rb +2 -1
- data/lib/shopify_api/resources/order_risk.rb +1 -0
- data/lib/shopify_api/resources/page.rb +1 -0
- data/lib/shopify_api/resources/payment_details.rb +1 -0
- data/lib/shopify_api/resources/policy.rb +1 -0
- data/lib/shopify_api/resources/price_rule.rb +1 -1
- data/lib/shopify_api/resources/product.rb +14 -11
- data/lib/shopify_api/resources/product_listing.rb +1 -0
- data/lib/shopify_api/resources/province.rb +1 -0
- data/lib/shopify_api/resources/receipt.rb +1 -0
- data/lib/shopify_api/resources/recurring_application_charge.rb +4 -1
- data/lib/shopify_api/resources/redirect.rb +1 -0
- data/lib/shopify_api/resources/refund.rb +2 -1
- data/lib/shopify_api/resources/report.rb +1 -0
- data/lib/shopify_api/resources/resource_feedback.rb +1 -1
- data/lib/shopify_api/resources/rule.rb +1 -0
- data/lib/shopify_api/resources/script_tag.rb +1 -0
- data/lib/shopify_api/resources/shipping_address.rb +1 -0
- data/lib/shopify_api/resources/shipping_line.rb +1 -0
- data/lib/shopify_api/resources/shipping_zone.rb +1 -0
- data/lib/shopify_api/resources/shop.rb +2 -1
- data/lib/shopify_api/resources/smart_collection.rb +2 -2
- data/lib/shopify_api/resources/storefront_access_token.rb +1 -0
- data/lib/shopify_api/resources/tax_line.rb +1 -0
- data/lib/shopify_api/resources/tax_service.rb +1 -0
- data/lib/shopify_api/resources/theme.rb +1 -0
- data/lib/shopify_api/resources/transaction.rb +1 -0
- data/lib/shopify_api/resources/usage_charge.rb +1 -0
- data/lib/shopify_api/resources/user.rb +1 -0
- data/lib/shopify_api/resources/variant.rb +16 -18
- data/lib/shopify_api/resources/webhook.rb +1 -0
- data/lib/shopify_api/resources.rb +1 -0
- data/lib/shopify_api/session.rb +29 -19
- data/lib/shopify_api/version.rb +2 -1
- data/lib/shopify_api.rb +9 -1
- data/lib/verify_docs.rb +1 -0
- data/service.yml +2 -5
- data/shopify_api.gemspec +12 -5
- data/test/access_token_test.rb +6 -5
- data/test/active_resource/json_errors_test.rb +6 -6
- data/test/api_access_test.rb +153 -0
- data/test/api_version_test.rb +3 -3
- data/test/application_charge_test.rb +30 -27
- data/test/application_credit_test.rb +10 -9
- data/test/article_test.rb +34 -35
- data/test/asset_test.rb +14 -6
- data/test/assigned_fulfillment_order_test.rb +5 -4
- data/test/base_test.rb +55 -56
- data/test/blog_test.rb +4 -3
- data/test/carrier_service_test.rb +7 -6
- data/test/cart_test.rb +2 -1
- data/test/collect_test.rb +4 -3
- data/test/collection_listing_test.rb +21 -16
- data/test/collection_publication_test.rb +8 -8
- data/test/collection_test.rb +20 -19
- data/test/countable_test.rb +3 -2
- data/test/currency_test.rb +5 -5
- data/test/custom_collection_test.rb +4 -3
- data/test/customer_saved_search_test.rb +18 -8
- data/test/customer_test.rb +22 -14
- data/test/detailed_log_subscriber_test.rb +16 -12
- data/test/discount_code_batch_test.rb +11 -10
- data/test/discount_code_test.rb +21 -15
- data/test/draft_order_test.rb +68 -52
- data/test/fixtures/assigned_fulfillment_orders.json +2 -0
- data/test/fixtures/fulfillment_order.json +1 -0
- data/test/fixtures/fulfillment_orders.json +2 -0
- data/test/fulfillment_event_test.rb +31 -26
- data/test/fulfillment_order_test.rb +217 -149
- data/test/fulfillment_order_test_helper.rb +1 -0
- data/test/fulfillment_request_test.rb +10 -8
- data/test/fulfillment_service_test.rb +13 -12
- data/test/fulfillment_test.rb +81 -66
- data/test/fulfillment_v2_test.rb +16 -12
- data/test/gift_card_test.rb +6 -4
- data/test/graphql_test.rb +27 -27
- data/test/hmac_params_test.rb +25 -0
- data/test/image_test.rb +19 -17
- data/test/inventory_level_test.rb +24 -15
- data/test/lib/webmock_extensions/last_request.rb +1 -1
- data/test/limits_test.rb +2 -1
- data/test/location_test.rb +2 -1
- data/test/marketing_event_test.rb +20 -20
- data/test/message_enricher_test.rb +6 -6
- data/test/meta_test.rb +9 -11
- data/test/metafield_test.rb +30 -20
- data/test/order_risk_test.rb +17 -16
- data/test/order_test.rb +43 -28
- data/test/pagination_test.rb +89 -56
- data/test/policy_test.rb +6 -5
- data/test/price_rule_test.rb +20 -15
- data/test/product_listing_test.rb +20 -20
- data/test/product_publication_test.rb +8 -8
- data/test/product_test.rb +44 -32
- data/test/publication_test.rb +3 -3
- data/test/recurring_application_charge_test.rb +104 -42
- data/test/redirect_test.rb +4 -3
- data/test/refund_test.rb +22 -17
- data/test/report_test.rb +12 -10
- data/test/resource_feedback_test.rb +14 -13
- data/test/script_tag_test.rb +10 -9
- data/test/session_test.rb +159 -48
- data/test/shipping_zone_test.rb +4 -3
- data/test/shop_test.rb +47 -33
- data/test/smart_collection_test.rb +5 -4
- data/test/storefront_access_token_test.rb +13 -15
- data/test/tax_service_test.rb +7 -4
- data/test/tender_transaction_test.rb +3 -3
- data/test/test_helper.rb +13 -11
- data/test/transaction_test.rb +4 -3
- data/test/usage_charge_test.rb +12 -8
- data/test/user_test.rb +4 -3
- data/test/variant_test.rb +23 -54
- data/test/webhook_test.rb +10 -7
- metadata +34 -12
- data/.rubocop-https---shopify-github-io-ruby-style-guide-rubocop-yml +0 -1027
- data/.travis.yml +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86c73a80fab5607e57486b42ce37c750797bfc5ac391012b0ca4b8ad2e8dee7e
|
4
|
+
data.tar.gz: 7b4df963e1f9163d23a51623aa845f32a0bf996abf5f447f22a7226f0b6f0b5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87c1fdb069d8f3946eb2136c99eede3f03eb86373ccd60a1e7e46188b7fd141fd418e92a665802949b6b196625aafd6e4065af815cc52f5ff5d437e25517b7d1
|
7
|
+
data.tar.gz: ca85757c71561e6956f1e7499142a45f44d511e9256fb112fc594302d12bdca3d0071d68534a2e8061e0949251aec1c00cd8c5c977a7cfc040f3419ab7a9a1bb
|
data/.github/CODEOWNERS
CHANGED
@@ -1 +1 @@
|
|
1
|
-
* @shopify/
|
1
|
+
* @shopify/core-build-learn
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Issue summary
|
2
|
+
|
3
|
+
Write a short description of the issue here ↓
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
## Expected behavior
|
8
|
+
|
9
|
+
What do you think should happen?
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## Actual behavior
|
14
|
+
|
15
|
+
What actually happens?
|
16
|
+
|
17
|
+
Tip: include an error message (in a `<details></details>` tag) if your issue is related to an error
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
## Steps to reproduce the problem
|
22
|
+
|
23
|
+
1.
|
24
|
+
1.
|
25
|
+
1.
|
26
|
+
|
27
|
+
## Logs
|
28
|
+
If applicable, enable the logs as described in the README, and paste the relevant portion here.
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
## Specifications
|
33
|
+
|
34
|
+
- `shopify_api` version:
|
35
|
+
- `activeresource` version:
|
36
|
+
- Shopify API version used (example: `2020-07`):
|
@@ -0,0 +1,44 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
name: Ruby ${{ matrix.version }} ${{ matrix.gemfile }}
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
env:
|
11
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
version:
|
15
|
+
- "2.4"
|
16
|
+
- "2.5"
|
17
|
+
- "2.6"
|
18
|
+
- "2.7"
|
19
|
+
- "3.0"
|
20
|
+
gemfile:
|
21
|
+
- Gemfile_ar41
|
22
|
+
- Gemfile_ar50
|
23
|
+
- Gemfile_ar51
|
24
|
+
- Gemfile_ar_master
|
25
|
+
exclude:
|
26
|
+
- version: "2.7"
|
27
|
+
gemfile: Gemfile_ar41
|
28
|
+
- version: "3.0"
|
29
|
+
gemfile: Gemfile_ar41
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- name: Remove Gemfile.lock
|
33
|
+
run: |
|
34
|
+
rm -f ${GITHUB_WORKSPACE}/Gemfile.lock
|
35
|
+
- name: Set up Ruby ${{ matrix.version }}
|
36
|
+
uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
ruby-version: ${{ matrix.version }}
|
39
|
+
- name: Run Tests
|
40
|
+
run: |
|
41
|
+
bundle config set --with docs
|
42
|
+
bundle config set ignore_messages true
|
43
|
+
bundle
|
44
|
+
bundle exec rake test
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,8 +1,28 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-shopify: rubocop.yml
|
3
|
+
|
1
4
|
inherit_from:
|
2
|
-
-
|
5
|
+
- .rubocop_todo.yml
|
3
6
|
|
4
7
|
AllCops:
|
5
8
|
TargetRubyVersion: 2.4
|
6
9
|
|
7
|
-
|
8
|
-
|
10
|
+
Lint/SuppressedException:
|
11
|
+
Exclude:
|
12
|
+
# Warning on test setup, the exception is expected
|
13
|
+
- 'test/test_helper.rb'
|
14
|
+
|
15
|
+
Lint/MissingSuper:
|
16
|
+
Exclude:
|
17
|
+
# We explicitly do not want to call super here
|
18
|
+
- 'lib/shopify_api/graphql/http_client.rb'
|
19
|
+
|
20
|
+
Lint/UnderscorePrefixedVariableName:
|
21
|
+
Exclude:
|
22
|
+
# This is an internal attribute and we want to make sure it's called _headers
|
23
|
+
- 'lib/shopify_api/resources/base.rb'
|
24
|
+
|
25
|
+
Naming/AccessorMethodName:
|
26
|
+
Exclude:
|
27
|
+
# This comes from activesupport, so we can't rename it
|
28
|
+
- 'test/detailed_log_subscriber_test.rb'
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2020-10-15 20:32:09 UTC using RuboCop version 0.93.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 6
|
10
|
+
# Configuration parameters: EnforcedStyle.
|
11
|
+
# SupportedStyles: snake_case, camelCase
|
12
|
+
Naming/VariableName:
|
13
|
+
Exclude:
|
14
|
+
- 'lib/shopify_api/resources/fulfillment.rb'
|
15
|
+
|
16
|
+
# Offense count: 2
|
17
|
+
# Cop supports --auto-correct.
|
18
|
+
Style/ColonMethodCall:
|
19
|
+
Exclude:
|
20
|
+
- 'test/base_test.rb'
|
21
|
+
|
22
|
+
# Offense count: 2
|
23
|
+
# Cop supports --auto-correct.
|
24
|
+
# Configuration parameters: EnforcedStyle, AllowInnerBackticks.
|
25
|
+
# SupportedStyles: backticks, percent_x, mixed
|
26
|
+
Style/CommandLiteral:
|
27
|
+
Exclude:
|
28
|
+
- 'shopify_api.gemspec'
|
29
|
+
|
30
|
+
# Offense count: 1
|
31
|
+
Style/MissingRespondToMissing:
|
32
|
+
Exclude:
|
33
|
+
- 'lib/shopify_api/resources/asset.rb'
|
34
|
+
|
35
|
+
# Offense count: 5
|
36
|
+
# Cop supports --auto-correct.
|
37
|
+
Style/RedundantPercentQ:
|
38
|
+
Exclude:
|
39
|
+
- 'shopify_api.gemspec'
|
40
|
+
|
41
|
+
# Offense count: 12
|
42
|
+
# Cop supports --auto-correct.
|
43
|
+
Style/RedundantSelf:
|
44
|
+
Exclude:
|
45
|
+
- 'lib/shopify_api/resources/base.rb'
|
46
|
+
- 'lib/shopify_api/resources/custom_collection.rb'
|
47
|
+
- 'lib/shopify_api/resources/customer.rb'
|
48
|
+
- 'lib/shopify_api/resources/customer_saved_search.rb'
|
49
|
+
- 'lib/shopify_api/resources/product.rb'
|
50
|
+
- 'lib/shopify_api/resources/recurring_application_charge.rb'
|
51
|
+
|
52
|
+
# Offense count: 1
|
53
|
+
# Cop supports --auto-correct.
|
54
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
|
55
|
+
# AllowedMethods: present?, blank?, presence, try, try!
|
56
|
+
Style/SafeNavigation:
|
57
|
+
Exclude:
|
58
|
+
- 'lib/shopify_api/resources/custom_collection.rb'
|
59
|
+
|
60
|
+
# Offense count: 2
|
61
|
+
# Cop supports --auto-correct.
|
62
|
+
# Configuration parameters: EnforcedStyle.
|
63
|
+
# SupportedStyles: use_perl_names, use_english_names
|
64
|
+
Style/SpecialGlobalVars:
|
65
|
+
Exclude:
|
66
|
+
- 'lib/shopify_api.rb'
|
67
|
+
- 'shopify_api.gemspec'
|
68
|
+
|
69
|
+
# Offense count: 2
|
70
|
+
# Cop supports --auto-correct.
|
71
|
+
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods.
|
72
|
+
# AllowedMethods: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym
|
73
|
+
Style/TrivialAccessors:
|
74
|
+
Exclude:
|
75
|
+
- 'lib/shopify_api/graphql.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
## Version 9.5
|
2
|
+
|
3
|
+
* [#883](https://github.com/Shopify/shopify_api/pull/883) Add support for Ruby 3.0
|
4
|
+
|
5
|
+
## Version 9.4.1
|
6
|
+
|
7
|
+
* [#847](https://github.com/Shopify/shopify_api/pull/847) Update `create_permission_url` method to use grant_options
|
8
|
+
* [#852](https://github.com/Shopify/shopify_api/pull/852) Bumping kramdown to fix a security vulnerability
|
9
|
+
|
10
|
+
## Version 9.4.0
|
11
|
+
|
12
|
+
* [#843](https://github.com/Shopify/shopify_api/pull/843) Introduce a new `access_scopes` attribute on the Session class.
|
13
|
+
* Specifying this in the Session constructor is optional. By default, this attribute returns `nil`.
|
14
|
+
|
15
|
+
## Version 9.3.0
|
16
|
+
|
17
|
+
* [#797](https://github.com/Shopify/shopify_api/pull/797) Release new Endpoint `fulfillment_order.open` and `fulfillment_order.reschedule`.
|
18
|
+
|
19
|
+
* [#818](https://github.com/Shopify/shopify_api/pull/818) Avoid depending on ActiveSupport in Sesssion class.
|
20
|
+
|
21
|
+
* Freeze all string literals. This should have no impact unless your application is modifying ('monkeypatching') the internals of the library in an unusual way.
|
22
|
+
|
23
|
+
* [#802](https://github.com/Shopify/shopify_api/pull/802) Made `inventory_quantity` a read-only field in Variant
|
24
|
+
|
25
|
+
* [#821](https://github.com/Shopify/shopify_api/pull/821) Add logging based on environment variable, move log subscriber out of `detailed_log_subscriber`.
|
26
|
+
The `ActiveResource::DetailedLogSubscriber` no longer automatically attaches when the class is loaded. If you were previously relying on that behaviour, you'll now need to call `ActiveResource::DetailedLogSubscriber.attach_to(:active_resource_detailed)`. (If using the new `SHOPIFY_LOG_PATH` environment setting then this is handled for you).
|
27
|
+
|
28
|
+
* Provide `ApiAccess` value object to encapsulate scope operations [#829](https://github.com/Shopify/shopify_api/pull/829)
|
29
|
+
|
1
30
|
## Version 9.2.0
|
2
31
|
|
3
32
|
* Removes the `shopify` binary which will be used by the Shopify CLI
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
shopify_api (9.5)
|
5
|
+
activeresource (>= 4.1.0, < 6.0.0)
|
6
|
+
graphql-client
|
7
|
+
rack
|
8
|
+
webrick
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activemodel (6.0.3.1)
|
14
|
+
activesupport (= 6.0.3.1)
|
15
|
+
activemodel-serializers-xml (1.0.2)
|
16
|
+
activemodel (> 5.x)
|
17
|
+
activesupport (> 5.x)
|
18
|
+
builder (~> 3.1)
|
19
|
+
activeresource (5.1.1)
|
20
|
+
activemodel (>= 5.0, < 7)
|
21
|
+
activemodel-serializers-xml (~> 1.0)
|
22
|
+
activesupport (>= 5.0, < 7)
|
23
|
+
activesupport (6.0.3.1)
|
24
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
|
+
i18n (>= 0.7, < 2)
|
26
|
+
minitest (~> 5.1)
|
27
|
+
tzinfo (~> 1.1)
|
28
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
29
|
+
addressable (2.8.0)
|
30
|
+
public_suffix (>= 2.0.2, < 5.0)
|
31
|
+
ast (2.4.1)
|
32
|
+
builder (3.2.4)
|
33
|
+
byebug (11.1.3)
|
34
|
+
coderay (1.1.2)
|
35
|
+
colorator (1.1.0)
|
36
|
+
concurrent-ruby (1.1.6)
|
37
|
+
crack (0.4.3)
|
38
|
+
safe_yaml (~> 1.0.0)
|
39
|
+
em-websocket (0.5.1)
|
40
|
+
eventmachine (>= 0.12.9)
|
41
|
+
http_parser.rb (~> 0.6.0)
|
42
|
+
eventmachine (1.2.7)
|
43
|
+
ffi (1.12.2)
|
44
|
+
forwardable-extended (2.6.0)
|
45
|
+
graphql (1.12.16)
|
46
|
+
graphql-client (0.17.0)
|
47
|
+
activesupport (>= 3.0)
|
48
|
+
graphql (~> 1.10)
|
49
|
+
hashdiff (1.0.1)
|
50
|
+
http_parser.rb (0.6.0)
|
51
|
+
i18n (1.8.2)
|
52
|
+
concurrent-ruby (~> 1.0)
|
53
|
+
jekyll (4.1.0)
|
54
|
+
addressable (~> 2.4)
|
55
|
+
colorator (~> 1.0)
|
56
|
+
em-websocket (~> 0.5)
|
57
|
+
i18n (~> 1.0)
|
58
|
+
jekyll-sass-converter (~> 2.0)
|
59
|
+
jekyll-watch (~> 2.0)
|
60
|
+
kramdown (~> 2.1)
|
61
|
+
kramdown-parser-gfm (~> 1.0)
|
62
|
+
liquid (~> 4.0)
|
63
|
+
mercenary (~> 0.4.0)
|
64
|
+
pathutil (~> 0.9)
|
65
|
+
rouge (~> 3.0)
|
66
|
+
safe_yaml (~> 1.0)
|
67
|
+
terminal-table (~> 1.8)
|
68
|
+
jekyll-sass-converter (2.1.0)
|
69
|
+
sassc (> 2.0.1, < 3.0)
|
70
|
+
jekyll-watch (2.2.1)
|
71
|
+
listen (~> 3.0)
|
72
|
+
kramdown (2.3.1)
|
73
|
+
rexml
|
74
|
+
kramdown-parser-gfm (1.1.0)
|
75
|
+
kramdown (~> 2.0)
|
76
|
+
liquid (4.0.3)
|
77
|
+
listen (3.2.1)
|
78
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
79
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
80
|
+
mercenary (0.4.0)
|
81
|
+
method_source (1.0.0)
|
82
|
+
minitest (5.14.4)
|
83
|
+
mocha (1.11.2)
|
84
|
+
parallel (1.19.2)
|
85
|
+
parser (2.7.2.0)
|
86
|
+
ast (~> 2.4.1)
|
87
|
+
pathutil (0.16.2)
|
88
|
+
forwardable-extended (~> 2.6)
|
89
|
+
pry (0.13.1)
|
90
|
+
coderay (~> 1.1)
|
91
|
+
method_source (~> 1.0)
|
92
|
+
pry-byebug (3.9.0)
|
93
|
+
byebug (~> 11.0)
|
94
|
+
pry (~> 0.13.0)
|
95
|
+
public_suffix (4.0.6)
|
96
|
+
rack (2.2.3)
|
97
|
+
rainbow (3.0.0)
|
98
|
+
rake (13.0.1)
|
99
|
+
rb-fsevent (0.10.4)
|
100
|
+
rb-inotify (0.10.1)
|
101
|
+
ffi (~> 1.0)
|
102
|
+
regexp_parser (1.8.2)
|
103
|
+
rexml (3.2.5)
|
104
|
+
rouge (3.19.0)
|
105
|
+
rubocop (0.93.1)
|
106
|
+
parallel (~> 1.10)
|
107
|
+
parser (>= 2.7.1.5)
|
108
|
+
rainbow (>= 2.2.2, < 4.0)
|
109
|
+
regexp_parser (>= 1.8)
|
110
|
+
rexml
|
111
|
+
rubocop-ast (>= 0.6.0)
|
112
|
+
ruby-progressbar (~> 1.7)
|
113
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
114
|
+
rubocop-ast (0.8.0)
|
115
|
+
parser (>= 2.7.1.5)
|
116
|
+
rubocop-shopify (1.0.6)
|
117
|
+
rubocop (>= 0.92, < 0.94)
|
118
|
+
ruby-progressbar (1.10.1)
|
119
|
+
safe_yaml (1.0.5)
|
120
|
+
sassc (2.3.0)
|
121
|
+
ffi (~> 1.9)
|
122
|
+
terminal-table (1.8.0)
|
123
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
124
|
+
thread_safe (0.3.6)
|
125
|
+
timecop (0.9.1)
|
126
|
+
tzinfo (1.2.7)
|
127
|
+
thread_safe (~> 0.1)
|
128
|
+
unicode-display_width (1.7.0)
|
129
|
+
webmock (3.8.3)
|
130
|
+
addressable (>= 2.3.6)
|
131
|
+
crack (>= 0.3.2)
|
132
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
133
|
+
webrick (1.7.0)
|
134
|
+
zeitwerk (2.3.0)
|
135
|
+
|
136
|
+
PLATFORMS
|
137
|
+
ruby
|
138
|
+
|
139
|
+
DEPENDENCIES
|
140
|
+
activeresource (~> 5.1)
|
141
|
+
jekyll
|
142
|
+
minitest (>= 5.14)
|
143
|
+
mocha (>= 1.4.0)
|
144
|
+
pry
|
145
|
+
pry-byebug
|
146
|
+
rake
|
147
|
+
rubocop-shopify
|
148
|
+
shopify_api!
|
149
|
+
timecop
|
150
|
+
webmock
|
151
|
+
|
152
|
+
BUNDLED WITH
|
153
|
+
2.2.22
|
data/Gemfile_ar51
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Shopify API
|
2
2
|
===========
|
3
|
-
[![Version][gem]][gem_url] [![Build Status](https://
|
3
|
+
[![Version][gem]][gem_url] [![Build Status](https://github.com/Shopify/shopify_api/workflows/CI/badge.svg?branch=master)](https://github.com/Shopify/shopify_api/actions)
|
4
4
|
|
5
5
|
[gem]: https://img.shields.io/gem/v/shopify_api.svg
|
6
6
|
[gem_url]: https://rubygems.org/gems/shopify_api
|
@@ -13,34 +13,36 @@ The REST API is implemented as JSON over HTTP using all four verbs (GET/POST/PUT
|
|
13
13
|
|
14
14
|
- [Shopify API](#shopify-api)
|
15
15
|
- [Usage](#usage)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
- [Requirements](#requirements)
|
17
|
+
- [Ruby version](#ruby-version)
|
18
|
+
- [Installation](#installation)
|
19
|
+
- [Getting Started](#getting-started)
|
20
|
+
- [1) Create an app](#1-create-an-app)
|
21
|
+
- [2A) Private Apps](#2a-private-apps)
|
22
|
+
- [2B) Public and Custom Apps](#2b-public-and-custom-apps)
|
23
|
+
- [3) Requesting access from a shop](#3-requesting-access-from-a-shop)
|
24
|
+
- [4) Trading your `code` for an access token.](#4-trading-your-code-for-an-access-token)
|
25
|
+
- [5) Activating the session](#5-activating-the-session)
|
26
|
+
- [6A) Making requests to the GraphQL API](#6a-making-requests-to-the-graphql-api)
|
27
|
+
- [Note: the GraphQL client has improved and changed in version 9.0. See the client documentation for full usage details and a [migration guide](docs/graphql.md#migration-guide).](#note-the-graphql-client-has-improved-and-changed-in-version-90-see-the-client-documentation-for-full-usage-details-and-a-migration-guide)
|
28
|
+
- [6B) Making requests to the REST API](#6b-making-requests-to-the-rest-api)
|
29
|
+
- [Console](#console)
|
30
|
+
- [Thread safety](#thread-safety)
|
31
|
+
- [Bulk Operations](#bulk-operations)
|
32
|
+
- [Example](#example)
|
32
33
|
- [1) Start the bulk operation](#1-start-the-bulk-operation)
|
33
|
-
- [2) Poll the status of the bulk operation](#2-poll-the-status-of-the-bulk-operation)
|
34
|
-
- [3) Retrieve your data](#3-retrieve-your-data)
|
35
|
-
|
34
|
+
- [Step 2) Poll the status of the bulk operation](#step-2-poll-the-status-of-the-bulk-operation)
|
35
|
+
- [Step 3) Retrieve your data](#step-3-retrieve-your-data)
|
36
|
+
- [Pagination](#pagination)
|
36
37
|
- [Breaking Change Notices](#breaking-change-notices)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
- [Breaking change notice for version 8.0.0](#breaking-change-notice-for-version-800)
|
39
|
+
- [Breaking change notice for version 7.0.0](#breaking-change-notice-for-version-700)
|
40
|
+
- [Changes to ShopifyAPI::Session](#changes-to-shopifyapisession)
|
41
|
+
- [Changes to how to define resources](#changes-to-how-to-define-resources)
|
42
|
+
- [URL construction](#url-construction)
|
43
|
+
- [URLs that have not changed](#urls-that-have-not-changed)
|
43
44
|
- [Using Development Version](#using-development-version)
|
45
|
+
- [Logging](#logging)
|
44
46
|
- [Additional Resources](#additional-resources)
|
45
47
|
- [Copyright](#copyright)
|
46
48
|
|
@@ -127,7 +129,7 @@ Public and Custom apps need an access token from each shop to access that shop's
|
|
127
129
|
|
128
130
|
```ruby
|
129
131
|
# We need to instantiate the session object before using it
|
130
|
-
shopify_session = ShopifyAPI::Session.new(domain: "SHOP_NAME.myshopify.com", api_version: api_version, token: nil)
|
132
|
+
shopify_session = ShopifyAPI::Session.new(domain: "#{SHOP_NAME}.myshopify.com", api_version: api_version, token: nil)
|
131
133
|
|
132
134
|
# Then, create a permission URL with the session
|
133
135
|
permission_url = shopify_session.create_permission_url(scope, "https://my_redirect_uri.com", { state: "My Nonce" })
|
@@ -147,7 +149,7 @@ Under the hood, the `create_permission_url` method is preparing the app to make
|
|
147
149
|
* ``scope`` – Required – The list of required scopes (explained here: https://shopify.dev/tutorials/authenticate-with-oauth#scopes)
|
148
150
|
* ``redirect_uri`` – Required – The URL where you want to redirect the users after they authorize the client. The complete URL specified here must be identical to one of the Application Redirect URLs set in the app's section of the Partners dashboard.
|
149
151
|
* ``state`` – Optional – A randomly selected value provided by your application, which is unique for each authorization request. During the OAuth callback phase, your application must check that this value matches the one you provided during authorization. [This mechanism is essential for the security of your application](https://tools.ietf.org/html/rfc6819#section-3.6).
|
150
|
-
* ``grant_options
|
152
|
+
* ``grant_options`` - Optional - Set this parameter to `per-user` to receive an access token that respects the user's permission level when making API requests (called online access). We strongly recommend using this parameter for embedded apps.
|
151
153
|
|
152
154
|
### 4) Trading your `code` for an access token.
|
153
155
|
|
@@ -202,7 +204,7 @@ Once authorized, the shop redirects the owner to the return URL of your applicat
|
|
202
204
|
Once you have a token, simply pass in the `token` and `extra` hash (optional) when creating the session object:
|
203
205
|
|
204
206
|
```ruby
|
205
|
-
shopify_session = ShopifyAPI::Session.new(domain: "SHOP_NAME.myshopify.com", token: token, api_version: api_version, extra: extra)
|
207
|
+
shopify_session = ShopifyAPI::Session.new(domain: "#{SHOP_NAME}.myshopify.com", token: token, api_version: api_version, extra: extra)
|
206
208
|
```
|
207
209
|
|
208
210
|
The session must be activated before use:
|
@@ -266,7 +268,7 @@ Responses to REST requests are returned as ActiveResource instances:
|
|
266
268
|
Alternatively, you can use #temp to initialize a Session and execute a command which also handles temporarily setting ActiveResource::Base.site:
|
267
269
|
|
268
270
|
```ruby
|
269
|
-
products = ShopifyAPI::Session.temp(domain: "SHOP_NAME.myshopify.com", token: token, api_version: api_version) do
|
271
|
+
products = ShopifyAPI::Session.temp(domain: "#{SHOP_NAME}.myshopify.com", token: token, api_version: api_version) do
|
270
272
|
ShopifyAPI::Product.find(:all)
|
271
273
|
end
|
272
274
|
```
|
@@ -274,7 +276,7 @@ Responses to REST requests are returned as ActiveResource instances:
|
|
274
276
|
If you would like to run a small number of calls against a different API version you can use this block syntax:
|
275
277
|
|
276
278
|
```ruby
|
277
|
-
ShopifyAPI::Session.temp(domain: "SHOP_NAME.myshopify.com", token: token, api_version: '2019-04') do
|
279
|
+
ShopifyAPI::Session.temp(domain: "#{SHOP_NAME}.myshopify.com", token: token, api_version: '2019-04') do
|
278
280
|
ShopifyAPI::Product.find(:all) # find call against version `2019-04`
|
279
281
|
|
280
282
|
ShopifyAPI::Session.with_version(:unstable) do
|
@@ -626,6 +628,14 @@ or you can even use our automated rake task for docker:
|
|
626
628
|
bundle exec rake docker
|
627
629
|
```
|
628
630
|
|
631
|
+
# Logging
|
632
|
+
|
633
|
+
Enable ActiveResource's logger with
|
634
|
+
|
635
|
+
`export SHOPIFY_LOG_PATH={your_log_path}`
|
636
|
+
|
637
|
+
This will log to a file at the given path, relative to the current project directory.
|
638
|
+
|
629
639
|
# Additional Resources
|
630
640
|
|
631
641
|
* [GraphQL API Reference](https://shopify.dev/docs/admin-api/graphql/reference)
|
data/RELEASING
CHANGED
@@ -2,12 +2,16 @@ Releasing ShopifyAPI
|
|
2
2
|
|
3
3
|
1. Check the Semantic Versioning page for info on how to version the new release: http://semver.org
|
4
4
|
2. Update the version of ShopifyAPI in lib/shopify_api/version.rb
|
5
|
-
3.
|
6
|
-
4.
|
7
|
-
5.
|
5
|
+
3. Run `bundle`
|
6
|
+
4. Add a CHANGELOG entry for the new release
|
7
|
+
5. Commit the changes with a commit message like "Packaging for release X.Y.Z"
|
8
|
+
6. Tag the release with the version (Leave REV blank for HEAD or provide a SHA)
|
8
9
|
$ git tag vX.Y.Z REV
|
9
|
-
|
10
|
+
7. Push out the changes
|
10
11
|
$ git push
|
11
|
-
|
12
|
+
8. Push out the tags
|
12
13
|
$ git push --tags
|
13
|
-
|
14
|
+
9. Publish the gem using Shipit
|
15
|
+
10. Consider if the dependency in Shopify/shopify needs updated. It's used only by the tests so is a low risk change.
|
16
|
+
Also consider Shopify/shopify_app whose gemspec depends on this.
|
17
|
+
We don't need to do this for every release, but we should try to keep them relatively up to date.
|
data/Rakefile
CHANGED
@@ -1,13 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'rake'
|
2
3
|
require "bundler/gem_tasks"
|
3
|
-
|
4
4
|
require 'rake/testtask'
|
5
|
+
require 'rubocop/rake_task'
|
6
|
+
|
5
7
|
Rake::TestTask.new(:test) do |test|
|
6
8
|
test.libs << 'lib' << 'test'
|
7
9
|
test.pattern = 'test/**/*_test.rb'
|
8
10
|
test.warning = false
|
9
11
|
end
|
10
12
|
|
13
|
+
RuboCop::RakeTask.new
|
14
|
+
|
11
15
|
begin
|
12
16
|
require 'rcov/rcovtask'
|
13
17
|
Rcov::RcovTask.new do |test|
|
@@ -16,15 +20,15 @@ begin
|
|
16
20
|
test.verbose = true
|
17
21
|
end
|
18
22
|
rescue LoadError
|
19
|
-
task
|
20
|
-
abort
|
23
|
+
task(:rcov) do
|
24
|
+
abort("RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov")
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
24
|
-
task
|
28
|
+
task(default: [:test, :rubocop, :verify_docs])
|
25
29
|
|
26
30
|
require 'verify_docs'
|
27
|
-
task
|
31
|
+
task(:verify_docs) do
|
28
32
|
unless VerifyDocs.call
|
29
33
|
abort("\nWARNING: docs/index.md and README.md no longer have identical content. Please correct this.")
|
30
34
|
end
|
@@ -45,7 +49,7 @@ Rake::RDocTask.new do |rdoc|
|
|
45
49
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
50
|
end
|
47
51
|
|
48
|
-
task
|
52
|
+
task(:docker) do
|
49
53
|
cmd = "docker-compose up -d && docker exec -i -t shopify_api bash"
|
50
54
|
exec(cmd, err: File::NULL)
|
51
55
|
end
|
data/dev.yml
ADDED
data/docs/graphql.md
CHANGED
@@ -32,7 +32,7 @@ result.data.shop.name
|
|
32
32
|
## Getting started
|
33
33
|
|
34
34
|
1. [Dump the schema](#dump-the-schema)
|
35
|
-
2. [Configure session/
|
35
|
+
2. [Configure session/authentication](#sessions-and-authentication)
|
36
36
|
3. [Make queries](#make-queries)
|
37
37
|
|
38
38
|
### Dump the schema
|
data/docs/index.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
layout: index
|
3
3
|
---
|
4
4
|
|
5
|
-
[![Version][gem]][gem_url] [![Build Status](https://
|
5
|
+
[![Version][gem]][gem_url] [![Build Status](https://github.com/Shopify/shopify_api/workflows/CI/badge.svg?branch=master)](https://github.com/Shopify/shopify_api/actions)
|
6
6
|
|
7
7
|
[gem]: https://img.shields.io/gem/v/shopify_api.svg
|
8
8
|
[gem_url]: https://rubygems.org/gems/shopify_api
|