shopify_api 14.0.1 → 14.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +2 -0
- data/.rubocop.yml +0 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +13 -1
- data/Gemfile.lock +19 -16
- data/dev.yml +1 -1
- data/docs/usage/custom_apps.md +3 -3
- data/docs/usage/graphql_storefront.md +13 -6
- data/docs/usage/rest.md +1 -1
- data/lib/shopify_api/admin_versions.rb +2 -1
- data/lib/shopify_api/auth/session.rb +14 -3
- data/lib/shopify_api/clients/graphql/storefront.rb +26 -4
- data/lib/shopify_api/rest/resources/2022_04/fulfillment_event.rb +5 -8
- data/lib/shopify_api/rest/resources/2022_04/inventory_item.rb +2 -2
- data/lib/shopify_api/rest/resources/2022_04/variant.rb +6 -6
- data/lib/shopify_api/rest/resources/2022_07/fulfillment_event.rb +5 -8
- data/lib/shopify_api/rest/resources/2022_07/inventory_item.rb +2 -2
- data/lib/shopify_api/rest/resources/2022_07/variant.rb +6 -6
- data/lib/shopify_api/rest/resources/2022_10/fulfillment_event.rb +5 -8
- data/lib/shopify_api/rest/resources/2022_10/inventory_item.rb +2 -2
- data/lib/shopify_api/rest/resources/2022_10/variant.rb +4 -4
- data/lib/shopify_api/rest/resources/2023_01/fulfillment_event.rb +5 -8
- data/lib/shopify_api/rest/resources/2023_01/inventory_item.rb +2 -2
- data/lib/shopify_api/rest/resources/2023_01/variant.rb +4 -4
- data/lib/shopify_api/rest/resources/2023_04/fulfillment_event.rb +5 -8
- data/lib/shopify_api/rest/resources/2023_04/inventory_item.rb +2 -2
- data/lib/shopify_api/rest/resources/2023_04/variant.rb +4 -4
- data/lib/shopify_api/rest/resources/2023_07/fulfillment_event.rb +5 -8
- data/lib/shopify_api/rest/resources/2023_07/inventory_item.rb +2 -2
- data/lib/shopify_api/rest/resources/2023_07/variant.rb +4 -4
- data/lib/shopify_api/rest/resources/2023_10/fulfillment_event.rb +5 -8
- data/lib/shopify_api/rest/resources/2023_10/inventory_item.rb +2 -2
- data/lib/shopify_api/rest/resources/2023_10/variant.rb +4 -4
- data/lib/shopify_api/rest/resources/2024_01/fulfillment_event.rb +5 -8
- data/lib/shopify_api/rest/resources/2024_01/inventory_item.rb +2 -2
- data/lib/shopify_api/rest/resources/2024_01/variant.rb +4 -4
- data/lib/shopify_api/rest/resources/2024_04/abandoned_checkout.rb +194 -0
- data/lib/shopify_api/rest/resources/2024_04/access_scope.rb +62 -0
- data/lib/shopify_api/rest/resources/2024_04/apple_pay_certificate.rb +109 -0
- data/lib/shopify_api/rest/resources/2024_04/application_charge.rb +113 -0
- data/lib/shopify_api/rest/resources/2024_04/application_credit.rb +95 -0
- data/lib/shopify_api/rest/resources/2024_04/article.rb +269 -0
- data/lib/shopify_api/rest/resources/2024_04/asset.rb +122 -0
- data/lib/shopify_api/rest/resources/2024_04/assigned_fulfillment_order.rb +92 -0
- data/lib/shopify_api/rest/resources/2024_04/balance.rb +58 -0
- data/lib/shopify_api/rest/resources/2024_04/blog.rb +166 -0
- data/lib/shopify_api/rest/resources/2024_04/cancellation_request.rb +87 -0
- data/lib/shopify_api/rest/resources/2024_04/carrier_service.rb +120 -0
- data/lib/shopify_api/rest/resources/2024_04/checkout.rb +213 -0
- data/lib/shopify_api/rest/resources/2024_04/collect.rb +146 -0
- data/lib/shopify_api/rest/resources/2024_04/collection.rb +114 -0
- data/lib/shopify_api/rest/resources/2024_04/collection_listing.rb +159 -0
- data/lib/shopify_api/rest/resources/2024_04/comment.rb +287 -0
- data/lib/shopify_api/rest/resources/2024_04/country.rb +141 -0
- data/lib/shopify_api/rest/resources/2024_04/currency.rb +61 -0
- data/lib/shopify_api/rest/resources/2024_04/custom_collection.rb +191 -0
- data/lib/shopify_api/rest/resources/2024_04/customer.rb +333 -0
- data/lib/shopify_api/rest/resources/2024_04/customer_address.rb +215 -0
- data/lib/shopify_api/rest/resources/2024_04/deprecated_api_call.rb +61 -0
- data/lib/shopify_api/rest/resources/2024_04/discount_code.rb +226 -0
- data/lib/shopify_api/rest/resources/2024_04/dispute.rb +115 -0
- data/lib/shopify_api/rest/resources/2024_04/dispute_evidence.rb +121 -0
- data/lib/shopify_api/rest/resources/2024_04/dispute_file_upload.rb +85 -0
- data/lib/shopify_api/rest/resources/2024_04/draft_order.rb +279 -0
- data/lib/shopify_api/rest/resources/2024_04/event.rb +152 -0
- data/lib/shopify_api/rest/resources/2024_04/fulfillment.rb +235 -0
- data/lib/shopify_api/rest/resources/2024_04/fulfillment_event.rb +167 -0
- data/lib/shopify_api/rest/resources/2024_04/fulfillment_order.rb +326 -0
- data/lib/shopify_api/rest/resources/2024_04/fulfillment_request.rb +101 -0
- data/lib/shopify_api/rest/resources/2024_04/fulfillment_service.rb +134 -0
- data/lib/shopify_api/rest/resources/2024_04/gift_card.rb +222 -0
- data/lib/shopify_api/rest/resources/2024_04/gift_card_adjustment.rb +122 -0
- data/lib/shopify_api/rest/resources/2024_04/image.rb +161 -0
- data/lib/shopify_api/rest/resources/2024_04/inventory_item.rb +112 -0
- data/lib/shopify_api/rest/resources/2024_04/inventory_level.rb +183 -0
- data/lib/shopify_api/rest/resources/2024_04/location.rb +171 -0
- data/lib/shopify_api/rest/resources/2024_04/locations_for_move.rb +60 -0
- data/lib/shopify_api/rest/resources/2024_04/marketing_event.rb +213 -0
- data/lib/shopify_api/rest/resources/2024_04/metafield.rb +348 -0
- data/lib/shopify_api/rest/resources/2024_04/mobile_platform_application.rb +114 -0
- data/lib/shopify_api/rest/resources/2024_04/order.rb +489 -0
- data/lib/shopify_api/rest/resources/2024_04/order_risk.rb +148 -0
- data/lib/shopify_api/rest/resources/2024_04/page.rb +198 -0
- data/lib/shopify_api/rest/resources/2024_04/payment.rb +144 -0
- data/lib/shopify_api/rest/resources/2024_04/payment_gateway.rb +147 -0
- data/lib/shopify_api/rest/resources/2024_04/payment_transaction.rb +114 -0
- data/lib/shopify_api/rest/resources/2024_04/payout.rb +101 -0
- data/lib/shopify_api/rest/resources/2024_04/policy.rb +73 -0
- data/lib/shopify_api/rest/resources/2024_04/price_rule.rb +227 -0
- data/lib/shopify_api/rest/resources/2024_04/product.rb +227 -0
- data/lib/shopify_api/rest/resources/2024_04/product_listing.rb +200 -0
- data/lib/shopify_api/rest/resources/2024_04/product_resource_feedback.rb +92 -0
- data/lib/shopify_api/rest/resources/2024_04/province.rb +136 -0
- data/lib/shopify_api/rest/resources/2024_04/recurring_application_charge.rb +176 -0
- data/lib/shopify_api/rest/resources/2024_04/redirect.rb +143 -0
- data/lib/shopify_api/rest/resources/2024_04/refund.rb +155 -0
- data/lib/shopify_api/rest/resources/2024_04/resource_feedback.rb +77 -0
- data/lib/shopify_api/rest/resources/2024_04/script_tag.rb +159 -0
- data/lib/shopify_api/rest/resources/2024_04/shipping_zone.rb +87 -0
- data/lib/shopify_api/rest/resources/2024_04/shop.rb +222 -0
- data/lib/shopify_api/rest/resources/2024_04/smart_collection.rb +220 -0
- data/lib/shopify_api/rest/resources/2024_04/storefront_access_token.rb +91 -0
- data/lib/shopify_api/rest/resources/2024_04/tender_transaction.rb +97 -0
- data/lib/shopify_api/rest/resources/2024_04/theme.rb +127 -0
- data/lib/shopify_api/rest/resources/2024_04/transaction.rb +188 -0
- data/lib/shopify_api/rest/resources/2024_04/usage_charge.rb +106 -0
- data/lib/shopify_api/rest/resources/2024_04/user.rb +142 -0
- data/lib/shopify_api/rest/resources/2024_04/variant.rb +212 -0
- data/lib/shopify_api/rest/resources/2024_04/webhook.rb +172 -0
- data/lib/shopify_api/version.rb +1 -1
- data/shopify_api.gemspec +0 -8
- metadata +77 -101
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58a7734df66af05601ae989f099fa50ad862bc60ded39ee711ec17a72e4ab1c5
|
4
|
+
data.tar.gz: ad5c4b5724ce8defa5058df1b59f743cebf834e425f75620070e304d9d274655
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29330b758a67691c6724cd78adfabf9b23466eccf6030510b0035d7e2ca0ea39fbc2eead5b6e2d53f8047aa137373ce8f2c402b71e06bd622208ccc24a34fb7d
|
7
|
+
data.tar.gz: 761253df5dbecfda0b33f4b4eb891d33536cc9489398bb0cb64f637912cdd346e2ab48fb8490e5e32d5e7c837c69dded7fb17af1eef412ed3253dba4446ea1b7
|
data/.github/workflows/build.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.6
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,17 @@ Note: For changes to the API, see https://shopify.dev/changelog?filter=api
|
|
4
4
|
|
5
5
|
## Unreleased
|
6
6
|
|
7
|
+
## 14.2.0
|
8
|
+
- [#1309](https://github.com/Shopify/shopify-api-ruby/pull/1309) Add `Session#copy_attributes_from` method
|
9
|
+
|
10
|
+
## 14.1.0
|
11
|
+
- [#1071](https://github.com/Shopify/shopify-api-ruby/issues/1071) Fix FulfillmentEvent class types
|
12
|
+
- Fix: InventoryItem class `harmonized_system_code` attribute type which can be either integer, string or nil
|
13
|
+
- Fix: Variant class `inventory_quantity` attribute type which can be either integer, string or nil
|
14
|
+
- [1293](https://github.com/Shopify/shopify-api-ruby/issues/1293) Add support for using Storefront private access tokens.
|
15
|
+
- [1302](https://github.com/Shopify/shopify-api-ruby/pull/1302) Deprecated passing the public Storefront access token as a positional parameter to the Storefront GraphQL client in favor of using the named parameter. (You probably want to use the private access token for this client anyway.)
|
16
|
+
- [1305](https://github.com/Shopify/shopify-api-ruby/pull/1305/) Adds support for the `2024-04` API version.
|
17
|
+
|
7
18
|
## 14.0.1
|
8
19
|
- [#1288](https://github.com/Shopify/shopify-api-ruby/pull/1288) Fix FeatureDeprecatedError being raised without a message.
|
9
20
|
- [1290](https://github.com/Shopify/shopify-api-ruby/pull/1290) Move deprecation of `ShopifyAPI::Webhooks::Handler#handle` to version 15.0.0
|
data/Gemfile
CHANGED
@@ -4,10 +4,22 @@ source "https://rubygems.org"
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
+
group :test, :development do
|
8
|
+
gem "pry-byebug"
|
9
|
+
end
|
10
|
+
|
11
|
+
group :development do
|
12
|
+
gem "rake"
|
13
|
+
gem "rubocop"
|
14
|
+
gem "rubocop-shopify"
|
15
|
+
gem "rubocop-sorbet"
|
16
|
+
gem "sorbet"
|
17
|
+
gem "tapioca"
|
18
|
+
end
|
19
|
+
|
7
20
|
group :test do
|
8
21
|
gem "minitest"
|
9
22
|
gem "fakefs", require: false
|
10
23
|
gem "webmock"
|
11
24
|
gem "mocha"
|
12
|
-
gem "pry-byebug"
|
13
25
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shopify_api (14.0
|
4
|
+
shopify_api (14.2.0)
|
5
5
|
activesupport
|
6
6
|
concurrent-ruby
|
7
7
|
hash_diff
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
public_suffix (>= 2.0.2, < 5.0)
|
31
31
|
ast (2.4.2)
|
32
32
|
base64 (0.2.0)
|
33
|
-
bigdecimal (3.1.
|
33
|
+
bigdecimal (3.1.7)
|
34
34
|
byebug (11.1.3)
|
35
35
|
coderay (1.1.3)
|
36
36
|
concurrent-ruby (1.2.3)
|
@@ -47,9 +47,10 @@ GEM
|
|
47
47
|
multi_xml (>= 0.5.2)
|
48
48
|
i18n (1.14.4)
|
49
49
|
concurrent-ruby (~> 1.0)
|
50
|
-
json (2.
|
50
|
+
json (2.7.1)
|
51
51
|
jwt (2.8.1)
|
52
52
|
base64
|
53
|
+
language_server-protocol (3.17.0.3)
|
53
54
|
method_source (1.0.0)
|
54
55
|
mini_mime (1.1.5)
|
55
56
|
minitest (5.15.0)
|
@@ -79,25 +80,26 @@ GEM
|
|
79
80
|
rbi (0.1.8)
|
80
81
|
prism (>= 0.18.0, < 0.22)
|
81
82
|
sorbet-runtime (>= 0.5.9204)
|
82
|
-
regexp_parser (2.
|
83
|
-
rexml (3.2.
|
84
|
-
rubocop (1.
|
83
|
+
regexp_parser (2.9.0)
|
84
|
+
rexml (3.2.6)
|
85
|
+
rubocop (1.62.1)
|
85
86
|
json (~> 2.3)
|
87
|
+
language_server-protocol (>= 3.17.0)
|
86
88
|
parallel (~> 1.10)
|
87
|
-
parser (>= 3.
|
89
|
+
parser (>= 3.3.0.2)
|
88
90
|
rainbow (>= 2.2.2, < 4.0)
|
89
91
|
regexp_parser (>= 1.8, < 3.0)
|
90
92
|
rexml (>= 3.2.5, < 4.0)
|
91
|
-
rubocop-ast (>= 1.
|
93
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
92
94
|
ruby-progressbar (~> 1.7)
|
93
|
-
unicode-display_width (>=
|
94
|
-
rubocop-ast (1.
|
95
|
-
parser (>= 3.
|
95
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
96
|
+
rubocop-ast (1.31.2)
|
97
|
+
parser (>= 3.3.0.4)
|
96
98
|
rubocop-shopify (2.10.1)
|
97
99
|
rubocop (~> 1.35)
|
98
100
|
rubocop-sorbet (0.6.11)
|
99
101
|
rubocop (>= 0.90.0)
|
100
|
-
ruby-progressbar (1.
|
102
|
+
ruby-progressbar (1.13.0)
|
101
103
|
securerandom (0.3.1)
|
102
104
|
sorbet (0.5.11230)
|
103
105
|
sorbet-static (= 0.5.11230)
|
@@ -114,19 +116,19 @@ GEM
|
|
114
116
|
thor (>= 0.19.2)
|
115
117
|
syntax_tree (6.2.0)
|
116
118
|
prettier_print (>= 1.2.0)
|
117
|
-
tapioca (0.
|
119
|
+
tapioca (0.13.3)
|
118
120
|
bundler (>= 2.2.25)
|
119
121
|
netrc (>= 0.11.0)
|
120
122
|
parallel (>= 1.21.0)
|
121
123
|
rbi (>= 0.1.4, < 0.2)
|
122
|
-
sorbet-static-and-runtime (>= 0.5.
|
123
|
-
spoom (
|
124
|
+
sorbet-static-and-runtime (>= 0.5.11087)
|
125
|
+
spoom (>= 1.2.0)
|
124
126
|
thor (>= 1.2.0)
|
125
127
|
yard-sorbet
|
126
128
|
thor (1.3.0)
|
127
129
|
tzinfo (2.0.6)
|
128
130
|
concurrent-ruby (~> 1.0)
|
129
|
-
unicode-display_width (2.
|
131
|
+
unicode-display_width (2.5.0)
|
130
132
|
webmock (3.14.0)
|
131
133
|
addressable (>= 2.8.0)
|
132
134
|
crack (>= 0.3.2)
|
@@ -139,6 +141,7 @@ GEM
|
|
139
141
|
|
140
142
|
PLATFORMS
|
141
143
|
arm64-darwin-21
|
144
|
+
arm64-darwin-23
|
142
145
|
universal-darwin-22
|
143
146
|
x86_64-linux
|
144
147
|
|
data/dev.yml
CHANGED
data/docs/usage/custom_apps.md
CHANGED
@@ -10,7 +10,7 @@ You can follow instructions for [initializing the session object](#initializing-
|
|
10
10
|
Following is a basic example to construct a simple Session object. You can see full list of parameters for this object in the [class definition](https://github.com/Shopify/shopify-api-ruby/blob/main/lib/shopify_api/auth/session.rb)
|
11
11
|
```ruby
|
12
12
|
session = ShopifyAPI::Auth::Session.new(
|
13
|
-
shop: "#{your_shop_name}.myshopify.com"
|
13
|
+
shop: "#{your_shop_name}.myshopify.com",
|
14
14
|
access_token: "the_token_for_your_custom_app_found_in_admin"
|
15
15
|
)
|
16
16
|
|
@@ -23,7 +23,7 @@ Example:
|
|
23
23
|
def make_api_request(shop)
|
24
24
|
# 1. create session object
|
25
25
|
session = ShopifyAPI::Auth::Session.new(
|
26
|
-
shop: "#{your_shop_name}.myshopify.com"
|
26
|
+
shop: "#{your_shop_name}.myshopify.com",
|
27
27
|
access_token: "the_token_for_your_custom_app_found_in_admin"
|
28
28
|
)
|
29
29
|
|
@@ -49,7 +49,7 @@ Example:
|
|
49
49
|
def configure_app
|
50
50
|
# This method is called before making authenticated API calls
|
51
51
|
session = ShopifyAPI::Auth::Session.new(
|
52
|
-
shop: "#{your_shop_name}.myshopify.com"
|
52
|
+
shop: "#{your_shop_name}.myshopify.com",
|
53
53
|
access_token: "the_token_for_your_custom_app_found_in_admin"
|
54
54
|
)
|
55
55
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Make a Storefront API call
|
2
2
|
|
3
|
-
The library also allows you to send GraphQL requests to the [Shopify Storefront API](https://shopify.dev/docs/api/storefront). To do that, you can use `ShopifyAPI::Clients::Graphql::Storefront` with
|
3
|
+
The library also allows you to send GraphQL requests to the [Shopify Storefront API](https://shopify.dev/docs/api/storefront). To do that, you can use `ShopifyAPI::Clients::Graphql::Storefront` with either a [private or public Storefront access token](https://shopify.dev/docs/api/usage/authentication#access-tokens-for-the-storefront-api).
|
4
4
|
|
5
5
|
You can obtain Storefront API access tokens for both private apps and sales channels. Please read [our documentation](https://shopify.dev/docs/custom-storefronts/building-with-the-storefront-api/getting-started) to learn more about Storefront Access Tokens.
|
6
6
|
|
@@ -8,12 +8,14 @@ Below is an example of how you may query the Storefront API:
|
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
# Load the access token as per instructions above
|
11
|
-
|
11
|
+
storefront_private_access_token = ''
|
12
12
|
# your shop domain
|
13
13
|
shop_url = 'shop.myshopify.com'
|
14
14
|
|
15
|
-
# initialize the client with session and
|
16
|
-
client = ShopifyAPI::Clients::Graphql::Storefront.new(shop_url,
|
15
|
+
# initialize the client with session and a private Storefront access token
|
16
|
+
client = ShopifyAPI::Clients::Graphql::Storefront.new(shop_url, private_token: storefront_private_access_token)
|
17
|
+
# or, alternatively with a public Storefront access token:
|
18
|
+
# client = ShopifyAPI::Clients::Graphql::Storefront.new(shop_url, public_token: storefront_public_access_token)
|
17
19
|
|
18
20
|
query = <<~QUERY
|
19
21
|
{
|
@@ -35,14 +37,19 @@ query = <<~QUERY
|
|
35
37
|
}
|
36
38
|
QUERY
|
37
39
|
|
38
|
-
|
40
|
+
# You may not need the "Shopify-Storefront-Buyer-IP" header, see its documentation:
|
41
|
+
# https://shopify.dev/docs/api/usage/authentication#making-server-side-requests
|
42
|
+
response = client.query(query: query, headers: { "Shopify-Storefront-Buyer-IP": request.ip })
|
39
43
|
# do something with the returned data
|
40
44
|
```
|
41
45
|
|
42
46
|
By default, the client uses the API version configured in `ShopifyAPI`. To use a different API version, set the optional `api_version` parameter. To experiment with prerelease API features, use `"unstable"` for the API version.
|
43
47
|
|
44
48
|
```ruby
|
45
|
-
client = ShopifyAPI::Clients::Graphql::Storefront.new(shop_url,
|
49
|
+
client = ShopifyAPI::Clients::Graphql::Storefront.new(shop_url,
|
50
|
+
private_token: storefront_private_access_token,
|
51
|
+
api_version: "unstable"
|
52
|
+
)
|
46
53
|
```
|
47
54
|
|
48
55
|
Want to make calls to the Admin API? Click [here](graphql.md)
|
data/docs/usage/rest.md
CHANGED
@@ -218,7 +218,7 @@ If the request is successful these methods will all return a [`ShopifyAPI::Clien
|
|
218
218
|
| Methods | Type | Notes |
|
219
219
|
|---------|------|-------|
|
220
220
|
| `code` |`Integer`| HTTP Response code, e.g. `200`|
|
221
|
-
| `
|
221
|
+
| `headers` |`Hash{String, [String]}` | HTTP Response headers |
|
222
222
|
| `body` | `Hash{String, Untyped}` | HTTP Response body |
|
223
223
|
| `prev_page_info` | `String` | See [Pagination](#pagination)|
|
224
224
|
| `next_page_info` | `String` | See [Pagination](#pagination)|
|
@@ -5,6 +5,7 @@ module ShopifyAPI
|
|
5
5
|
module AdminVersions
|
6
6
|
SUPPORTED_ADMIN_VERSIONS = T.let([
|
7
7
|
"unstable",
|
8
|
+
"2024-04",
|
8
9
|
"2024-01",
|
9
10
|
"2023-10",
|
10
11
|
"2023-07",
|
@@ -16,7 +17,7 @@ module ShopifyAPI
|
|
16
17
|
"2022-01",
|
17
18
|
], T::Array[String])
|
18
19
|
|
19
|
-
LATEST_SUPPORTED_ADMIN_VERSION = T.let("2024-
|
20
|
+
LATEST_SUPPORTED_ADMIN_VERSION = T.let("2024-04", String)
|
20
21
|
end
|
21
22
|
|
22
23
|
SUPPORTED_ADMIN_VERSIONS = ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS
|
@@ -121,6 +121,17 @@ module ShopifyAPI
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
+
sig { params(other: Session).returns(Session) }
|
125
|
+
def copy_attributes_from(other)
|
126
|
+
JSON.parse(other.serialize).keys.each do |key|
|
127
|
+
next if key.include?("^")
|
128
|
+
|
129
|
+
variable_name = "@#{key}"
|
130
|
+
instance_variable_set(variable_name, other.instance_variable_get(variable_name))
|
131
|
+
end
|
132
|
+
self
|
133
|
+
end
|
134
|
+
|
124
135
|
sig { returns(String) }
|
125
136
|
def serialize
|
126
137
|
Oj.dump(self)
|
@@ -130,8 +141,8 @@ module ShopifyAPI
|
|
130
141
|
sig { params(other: T.nilable(Session)).returns(T::Boolean) }
|
131
142
|
def ==(other)
|
132
143
|
if other
|
133
|
-
|
134
|
-
|
144
|
+
|
145
|
+
id == other.id &&
|
135
146
|
shop == other.shop &&
|
136
147
|
state == other.state &&
|
137
148
|
scope == other.scope &&
|
@@ -140,7 +151,7 @@ module ShopifyAPI
|
|
140
151
|
online? == other.online? &&
|
141
152
|
associated_user == other.associated_user &&
|
142
153
|
shopify_session_id == other.shopify_session_id
|
143
|
-
|
154
|
+
|
144
155
|
else
|
145
156
|
false
|
146
157
|
end
|
@@ -5,8 +5,26 @@ module ShopifyAPI
|
|
5
5
|
module Clients
|
6
6
|
module Graphql
|
7
7
|
class Storefront < Client
|
8
|
-
sig
|
9
|
-
|
8
|
+
sig do
|
9
|
+
params(
|
10
|
+
shop: String,
|
11
|
+
storefront_access_token: T.nilable(String),
|
12
|
+
private_token: T.nilable(String),
|
13
|
+
public_token: T.nilable(String),
|
14
|
+
api_version: T.nilable(String),
|
15
|
+
).void
|
16
|
+
end
|
17
|
+
def initialize(shop, storefront_access_token = nil, private_token: nil, public_token: nil, api_version: nil)
|
18
|
+
unless storefront_access_token.nil?
|
19
|
+
warning = <<~WARNING
|
20
|
+
DEPRECATED: Use the named parameters for the Storefront token instead of passing
|
21
|
+
the public token as the second argument. Also, you may want to look into using
|
22
|
+
the Storefront private access token instead:
|
23
|
+
https://shopify.dev/docs/api/usage/authentication#getting-started-with-private-access
|
24
|
+
WARNING
|
25
|
+
ShopifyAPI::Logger.deprecated(warning, "15.0.0")
|
26
|
+
end
|
27
|
+
|
10
28
|
session = Auth::Session.new(
|
11
29
|
id: shop,
|
12
30
|
shop: shop,
|
@@ -14,7 +32,11 @@ module ShopifyAPI
|
|
14
32
|
is_online: false,
|
15
33
|
)
|
16
34
|
super(session: session, base_path: "/api", api_version: api_version)
|
17
|
-
@storefront_access_token = storefront_access_token
|
35
|
+
@storefront_access_token = T.let(T.must(private_token || public_token || storefront_access_token), String)
|
36
|
+
@storefront_auth_header = T.let(
|
37
|
+
private_token.nil? ? "X-Shopify-Storefront-Access-Token" : "Shopify-Storefront-Private-Token",
|
38
|
+
String,
|
39
|
+
)
|
18
40
|
end
|
19
41
|
|
20
42
|
sig do
|
@@ -26,7 +48,7 @@ module ShopifyAPI
|
|
26
48
|
).returns(HttpResponse)
|
27
49
|
end
|
28
50
|
def query(query:, variables: nil, headers: {}, tries: 1)
|
29
|
-
T.must(headers).merge!({
|
51
|
+
T.must(headers).merge!({ @storefront_auth_header => @storefront_access_token })
|
30
52
|
super(query: query, variables: variables, headers: headers, tries: tries)
|
31
53
|
end
|
32
54
|
end
|
@@ -20,7 +20,7 @@ module ShopifyAPI
|
|
20
20
|
|
21
21
|
@address1 = T.let(nil, T.nilable(String))
|
22
22
|
@city = T.let(nil, T.nilable(String))
|
23
|
-
@country = T.let(nil, T.nilable(
|
23
|
+
@country = T.let(nil, T.nilable(String))
|
24
24
|
@created_at = T.let(nil, T.nilable(String))
|
25
25
|
@estimated_delivery_at = T.let(nil, T.nilable(String))
|
26
26
|
@fulfillment_id = T.let(nil, T.nilable(Integer))
|
@@ -30,7 +30,7 @@ module ShopifyAPI
|
|
30
30
|
@longitude = T.let(nil, T.nilable(Float))
|
31
31
|
@message = T.let(nil, T.nilable(String))
|
32
32
|
@order_id = T.let(nil, T.nilable(Integer))
|
33
|
-
@province = T.let(nil, T.nilable(
|
33
|
+
@province = T.let(nil, T.nilable(String))
|
34
34
|
@shop_id = T.let(nil, T.nilable(Integer))
|
35
35
|
@status = T.let(nil, T.nilable(String))
|
36
36
|
@updated_at = T.let(nil, T.nilable(String))
|
@@ -39,10 +39,7 @@ module ShopifyAPI
|
|
39
39
|
super(session: session, from_hash: from_hash)
|
40
40
|
end
|
41
41
|
|
42
|
-
@has_one = T.let({
|
43
|
-
country: Country,
|
44
|
-
province: Province
|
45
|
-
}, T::Hash[Symbol, Class])
|
42
|
+
@has_one = T.let({}, T::Hash[Symbol, Class])
|
46
43
|
@has_many = T.let({}, T::Hash[Symbol, Class])
|
47
44
|
@paths = T.let([
|
48
45
|
{http_method: :delete, operation: :delete, ids: [:order_id, :fulfillment_id, :id], path: "orders/<order_id>/fulfillments/<fulfillment_id>/events/<id>.json"},
|
@@ -55,7 +52,7 @@ module ShopifyAPI
|
|
55
52
|
attr_reader :address1
|
56
53
|
sig { returns(T.nilable(String)) }
|
57
54
|
attr_reader :city
|
58
|
-
sig { returns(T.nilable(
|
55
|
+
sig { returns(T.nilable(String)) }
|
59
56
|
attr_reader :country
|
60
57
|
sig { returns(T.nilable(String)) }
|
61
58
|
attr_reader :created_at
|
@@ -75,7 +72,7 @@ module ShopifyAPI
|
|
75
72
|
attr_reader :message
|
76
73
|
sig { returns(T.nilable(Integer)) }
|
77
74
|
attr_reader :order_id
|
78
|
-
sig { returns(T.nilable(
|
75
|
+
sig { returns(T.nilable(String)) }
|
79
76
|
attr_reader :province
|
80
77
|
sig { returns(T.nilable(Integer)) }
|
81
78
|
attr_reader :shop_id
|
@@ -22,7 +22,7 @@ module ShopifyAPI
|
|
22
22
|
@country_code_of_origin = T.let(nil, T.nilable(String))
|
23
23
|
@country_harmonized_system_codes = T.let(nil, T.nilable(T::Array[T.untyped]))
|
24
24
|
@created_at = T.let(nil, T.nilable(String))
|
25
|
-
@harmonized_system_code = T.let(nil, T.nilable(Integer))
|
25
|
+
@harmonized_system_code = T.let(nil, T.nilable(T.any(Integer, String)))
|
26
26
|
@id = T.let(nil, T.nilable(Integer))
|
27
27
|
@province_code_of_origin = T.let(nil, T.nilable(String))
|
28
28
|
@requires_shipping = T.let(nil, T.nilable(T::Boolean))
|
@@ -49,7 +49,7 @@ module ShopifyAPI
|
|
49
49
|
attr_reader :country_harmonized_system_codes
|
50
50
|
sig { returns(T.nilable(String)) }
|
51
51
|
attr_reader :created_at
|
52
|
-
sig { returns(T.nilable(Integer)) }
|
52
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
53
53
|
attr_reader :harmonized_system_code
|
54
54
|
sig { returns(T.nilable(Integer)) }
|
55
55
|
attr_reader :id
|
@@ -28,9 +28,9 @@ module ShopifyAPI
|
|
28
28
|
@inventory_item_id = T.let(nil, T.nilable(Integer))
|
29
29
|
@inventory_management = T.let(nil, T.nilable(String))
|
30
30
|
@inventory_policy = T.let(nil, T.nilable(String))
|
31
|
-
@inventory_quantity = T.let(nil, T.nilable(Integer))
|
32
|
-
@inventory_quantity_adjustment = T.let(nil, T.nilable(Integer))
|
33
|
-
@old_inventory_quantity = T.let(nil, T.nilable(Integer))
|
31
|
+
@inventory_quantity = T.let(nil, T.nilable(T.any(Integer, String)))
|
32
|
+
@inventory_quantity_adjustment = T.let(nil, T.nilable(T.any(Integer, String)))
|
33
|
+
@old_inventory_quantity = T.let(nil, T.nilable(T.any(Integer, String)))
|
34
34
|
@option = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
|
35
35
|
@position = T.let(nil, T.nilable(Integer))
|
36
36
|
@presentment_prices = T.let(nil, T.nilable(T::Array[T.untyped]))
|
@@ -83,11 +83,11 @@ module ShopifyAPI
|
|
83
83
|
attr_reader :inventory_management
|
84
84
|
sig { returns(T.nilable(String)) }
|
85
85
|
attr_reader :inventory_policy
|
86
|
-
sig { returns(T.nilable(Integer)) }
|
86
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
87
87
|
attr_reader :inventory_quantity
|
88
|
-
sig { returns(T.nilable(Integer)) }
|
88
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
89
89
|
attr_reader :inventory_quantity_adjustment
|
90
|
-
sig { returns(T.nilable(Integer)) }
|
90
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
91
91
|
attr_reader :old_inventory_quantity
|
92
92
|
sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
|
93
93
|
attr_reader :option
|
@@ -20,7 +20,7 @@ module ShopifyAPI
|
|
20
20
|
|
21
21
|
@address1 = T.let(nil, T.nilable(String))
|
22
22
|
@city = T.let(nil, T.nilable(String))
|
23
|
-
@country = T.let(nil, T.nilable(
|
23
|
+
@country = T.let(nil, T.nilable(String))
|
24
24
|
@created_at = T.let(nil, T.nilable(String))
|
25
25
|
@estimated_delivery_at = T.let(nil, T.nilable(String))
|
26
26
|
@fulfillment_id = T.let(nil, T.nilable(Integer))
|
@@ -30,7 +30,7 @@ module ShopifyAPI
|
|
30
30
|
@longitude = T.let(nil, T.nilable(Float))
|
31
31
|
@message = T.let(nil, T.nilable(String))
|
32
32
|
@order_id = T.let(nil, T.nilable(Integer))
|
33
|
-
@province = T.let(nil, T.nilable(
|
33
|
+
@province = T.let(nil, T.nilable(String))
|
34
34
|
@shop_id = T.let(nil, T.nilable(Integer))
|
35
35
|
@status = T.let(nil, T.nilable(String))
|
36
36
|
@updated_at = T.let(nil, T.nilable(String))
|
@@ -39,10 +39,7 @@ module ShopifyAPI
|
|
39
39
|
super(session: session, from_hash: from_hash)
|
40
40
|
end
|
41
41
|
|
42
|
-
@has_one = T.let({
|
43
|
-
country: Country,
|
44
|
-
province: Province
|
45
|
-
}, T::Hash[Symbol, Class])
|
42
|
+
@has_one = T.let({}, T::Hash[Symbol, Class])
|
46
43
|
@has_many = T.let({}, T::Hash[Symbol, Class])
|
47
44
|
@paths = T.let([
|
48
45
|
{http_method: :delete, operation: :delete, ids: [:order_id, :fulfillment_id, :id], path: "orders/<order_id>/fulfillments/<fulfillment_id>/events/<id>.json"},
|
@@ -55,7 +52,7 @@ module ShopifyAPI
|
|
55
52
|
attr_reader :address1
|
56
53
|
sig { returns(T.nilable(String)) }
|
57
54
|
attr_reader :city
|
58
|
-
sig { returns(T.nilable(
|
55
|
+
sig { returns(T.nilable(String)) }
|
59
56
|
attr_reader :country
|
60
57
|
sig { returns(T.nilable(String)) }
|
61
58
|
attr_reader :created_at
|
@@ -75,7 +72,7 @@ module ShopifyAPI
|
|
75
72
|
attr_reader :message
|
76
73
|
sig { returns(T.nilable(Integer)) }
|
77
74
|
attr_reader :order_id
|
78
|
-
sig { returns(T.nilable(
|
75
|
+
sig { returns(T.nilable(String)) }
|
79
76
|
attr_reader :province
|
80
77
|
sig { returns(T.nilable(Integer)) }
|
81
78
|
attr_reader :shop_id
|
@@ -22,7 +22,7 @@ module ShopifyAPI
|
|
22
22
|
@country_code_of_origin = T.let(nil, T.nilable(String))
|
23
23
|
@country_harmonized_system_codes = T.let(nil, T.nilable(T::Array[T.untyped]))
|
24
24
|
@created_at = T.let(nil, T.nilable(String))
|
25
|
-
@harmonized_system_code = T.let(nil, T.nilable(Integer))
|
25
|
+
@harmonized_system_code = T.let(nil, T.nilable(T.any(Integer, String)))
|
26
26
|
@id = T.let(nil, T.nilable(Integer))
|
27
27
|
@province_code_of_origin = T.let(nil, T.nilable(String))
|
28
28
|
@requires_shipping = T.let(nil, T.nilable(T::Boolean))
|
@@ -49,7 +49,7 @@ module ShopifyAPI
|
|
49
49
|
attr_reader :country_harmonized_system_codes
|
50
50
|
sig { returns(T.nilable(String)) }
|
51
51
|
attr_reader :created_at
|
52
|
-
sig { returns(T.nilable(Integer)) }
|
52
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
53
53
|
attr_reader :harmonized_system_code
|
54
54
|
sig { returns(T.nilable(Integer)) }
|
55
55
|
attr_reader :id
|
@@ -28,9 +28,9 @@ module ShopifyAPI
|
|
28
28
|
@inventory_item_id = T.let(nil, T.nilable(Integer))
|
29
29
|
@inventory_management = T.let(nil, T.nilable(String))
|
30
30
|
@inventory_policy = T.let(nil, T.nilable(String))
|
31
|
-
@inventory_quantity = T.let(nil, T.nilable(Integer))
|
32
|
-
@inventory_quantity_adjustment = T.let(nil, T.nilable(Integer))
|
33
|
-
@old_inventory_quantity = T.let(nil, T.nilable(Integer))
|
31
|
+
@inventory_quantity = T.let(nil, T.nilable(T.any(Integer, String)))
|
32
|
+
@inventory_quantity_adjustment = T.let(nil, T.nilable(T.any(Integer, String)))
|
33
|
+
@old_inventory_quantity = T.let(nil, T.nilable(T.any(Integer, String)))
|
34
34
|
@option = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
|
35
35
|
@position = T.let(nil, T.nilable(Integer))
|
36
36
|
@presentment_prices = T.let(nil, T.nilable(T::Array[T.untyped]))
|
@@ -83,11 +83,11 @@ module ShopifyAPI
|
|
83
83
|
attr_reader :inventory_management
|
84
84
|
sig { returns(T.nilable(String)) }
|
85
85
|
attr_reader :inventory_policy
|
86
|
-
sig { returns(T.nilable(Integer)) }
|
86
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
87
87
|
attr_reader :inventory_quantity
|
88
|
-
sig { returns(T.nilable(Integer)) }
|
88
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
89
89
|
attr_reader :inventory_quantity_adjustment
|
90
|
-
sig { returns(T.nilable(Integer)) }
|
90
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
91
91
|
attr_reader :old_inventory_quantity
|
92
92
|
sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
|
93
93
|
attr_reader :option
|
@@ -20,7 +20,7 @@ module ShopifyAPI
|
|
20
20
|
|
21
21
|
@address1 = T.let(nil, T.nilable(String))
|
22
22
|
@city = T.let(nil, T.nilable(String))
|
23
|
-
@country = T.let(nil, T.nilable(
|
23
|
+
@country = T.let(nil, T.nilable(String))
|
24
24
|
@created_at = T.let(nil, T.nilable(String))
|
25
25
|
@estimated_delivery_at = T.let(nil, T.nilable(String))
|
26
26
|
@fulfillment_id = T.let(nil, T.nilable(Integer))
|
@@ -30,7 +30,7 @@ module ShopifyAPI
|
|
30
30
|
@longitude = T.let(nil, T.nilable(Float))
|
31
31
|
@message = T.let(nil, T.nilable(String))
|
32
32
|
@order_id = T.let(nil, T.nilable(Integer))
|
33
|
-
@province = T.let(nil, T.nilable(
|
33
|
+
@province = T.let(nil, T.nilable(String))
|
34
34
|
@shop_id = T.let(nil, T.nilable(Integer))
|
35
35
|
@status = T.let(nil, T.nilable(String))
|
36
36
|
@updated_at = T.let(nil, T.nilable(String))
|
@@ -39,10 +39,7 @@ module ShopifyAPI
|
|
39
39
|
super(session: session, from_hash: from_hash)
|
40
40
|
end
|
41
41
|
|
42
|
-
@has_one = T.let({
|
43
|
-
country: Country,
|
44
|
-
province: Province
|
45
|
-
}, T::Hash[Symbol, Class])
|
42
|
+
@has_one = T.let({}, T::Hash[Symbol, Class])
|
46
43
|
@has_many = T.let({}, T::Hash[Symbol, Class])
|
47
44
|
@paths = T.let([
|
48
45
|
{http_method: :delete, operation: :delete, ids: [:order_id, :fulfillment_id, :id], path: "orders/<order_id>/fulfillments/<fulfillment_id>/events/<id>.json"},
|
@@ -55,7 +52,7 @@ module ShopifyAPI
|
|
55
52
|
attr_reader :address1
|
56
53
|
sig { returns(T.nilable(String)) }
|
57
54
|
attr_reader :city
|
58
|
-
sig { returns(T.nilable(
|
55
|
+
sig { returns(T.nilable(String)) }
|
59
56
|
attr_reader :country
|
60
57
|
sig { returns(T.nilable(String)) }
|
61
58
|
attr_reader :created_at
|
@@ -75,7 +72,7 @@ module ShopifyAPI
|
|
75
72
|
attr_reader :message
|
76
73
|
sig { returns(T.nilable(Integer)) }
|
77
74
|
attr_reader :order_id
|
78
|
-
sig { returns(T.nilable(
|
75
|
+
sig { returns(T.nilable(String)) }
|
79
76
|
attr_reader :province
|
80
77
|
sig { returns(T.nilable(Integer)) }
|
81
78
|
attr_reader :shop_id
|
@@ -22,7 +22,7 @@ module ShopifyAPI
|
|
22
22
|
@country_code_of_origin = T.let(nil, T.nilable(String))
|
23
23
|
@country_harmonized_system_codes = T.let(nil, T.nilable(T::Array[T.untyped]))
|
24
24
|
@created_at = T.let(nil, T.nilable(String))
|
25
|
-
@harmonized_system_code = T.let(nil, T.nilable(Integer))
|
25
|
+
@harmonized_system_code = T.let(nil, T.nilable(T.any(Integer, String)))
|
26
26
|
@id = T.let(nil, T.nilable(Integer))
|
27
27
|
@province_code_of_origin = T.let(nil, T.nilable(String))
|
28
28
|
@requires_shipping = T.let(nil, T.nilable(T::Boolean))
|
@@ -49,7 +49,7 @@ module ShopifyAPI
|
|
49
49
|
attr_reader :country_harmonized_system_codes
|
50
50
|
sig { returns(T.nilable(String)) }
|
51
51
|
attr_reader :created_at
|
52
|
-
sig { returns(T.nilable(Integer)) }
|
52
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
53
53
|
attr_reader :harmonized_system_code
|
54
54
|
sig { returns(T.nilable(Integer)) }
|
55
55
|
attr_reader :id
|
@@ -28,8 +28,8 @@ module ShopifyAPI
|
|
28
28
|
@inventory_item_id = T.let(nil, T.nilable(Integer))
|
29
29
|
@inventory_management = T.let(nil, T.nilable(String))
|
30
30
|
@inventory_policy = T.let(nil, T.nilable(String))
|
31
|
-
@inventory_quantity = T.let(nil, T.nilable(Integer))
|
32
|
-
@old_inventory_quantity = T.let(nil, T.nilable(Integer))
|
31
|
+
@inventory_quantity = T.let(nil, T.nilable(T.any(Integer, String)))
|
32
|
+
@old_inventory_quantity = T.let(nil, T.nilable(T.any(Integer, String)))
|
33
33
|
@option = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
|
34
34
|
@position = T.let(nil, T.nilable(Integer))
|
35
35
|
@presentment_prices = T.let(nil, T.nilable(T::Array[T.untyped]))
|
@@ -81,9 +81,9 @@ module ShopifyAPI
|
|
81
81
|
attr_reader :inventory_management
|
82
82
|
sig { returns(T.nilable(String)) }
|
83
83
|
attr_reader :inventory_policy
|
84
|
-
sig { returns(T.nilable(Integer)) }
|
84
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
85
85
|
attr_reader :inventory_quantity
|
86
|
-
sig { returns(T.nilable(Integer)) }
|
86
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
87
87
|
attr_reader :old_inventory_quantity
|
88
88
|
sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
|
89
89
|
attr_reader :option
|