shopify_api 14.3.0 → 14.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/BREAKING_CHANGES_FOR_V15.md +42 -0
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +2 -2
- data/README.md +3 -0
- data/docs/usage/custom_apps.md +32 -1
- data/docs/usage/oauth.md +88 -16
- data/docs/usage/webhooks.md +3 -2
- data/lib/shopify_api/admin_versions.rb +2 -1
- data/lib/shopify_api/clients/graphql/client.rb +14 -3
- data/lib/shopify_api/clients/graphql/storefront.rb +12 -2
- data/lib/shopify_api/rest/base.rb +7 -1
- data/lib/shopify_api/rest/resources/2022_04/customer.rb +1 -0
- data/lib/shopify_api/rest/resources/2022_04/recurring_application_charge.rb +9 -0
- data/lib/shopify_api/rest/resources/2022_04/shop.rb +12 -2
- data/lib/shopify_api/rest/resources/2022_07/customer.rb +1 -0
- data/lib/shopify_api/rest/resources/2022_07/recurring_application_charge.rb +9 -0
- data/lib/shopify_api/rest/resources/2022_07/shop.rb +12 -2
- data/lib/shopify_api/rest/resources/2022_10/customer.rb +1 -0
- data/lib/shopify_api/rest/resources/2022_10/recurring_application_charge.rb +9 -0
- data/lib/shopify_api/rest/resources/2022_10/shop.rb +12 -2
- data/lib/shopify_api/rest/resources/2023_01/customer.rb +1 -0
- data/lib/shopify_api/rest/resources/2023_01/recurring_application_charge.rb +9 -0
- data/lib/shopify_api/rest/resources/2023_01/shop.rb +12 -2
- data/lib/shopify_api/rest/resources/2023_04/customer.rb +1 -0
- data/lib/shopify_api/rest/resources/2023_04/recurring_application_charge.rb +9 -0
- data/lib/shopify_api/rest/resources/2023_04/shop.rb +12 -2
- data/lib/shopify_api/rest/resources/2023_07/customer.rb +1 -0
- data/lib/shopify_api/rest/resources/2023_07/recurring_application_charge.rb +9 -0
- data/lib/shopify_api/rest/resources/2023_07/shop.rb +12 -2
- data/lib/shopify_api/rest/resources/2023_10/customer.rb +1 -0
- data/lib/shopify_api/rest/resources/2023_10/recurring_application_charge.rb +9 -0
- data/lib/shopify_api/rest/resources/2023_10/shop.rb +12 -2
- data/lib/shopify_api/rest/resources/2024_01/customer.rb +1 -0
- data/lib/shopify_api/rest/resources/2024_01/recurring_application_charge.rb +9 -0
- data/lib/shopify_api/rest/resources/2024_01/shop.rb +12 -2
- data/lib/shopify_api/rest/resources/2024_04/customer.rb +1 -0
- data/lib/shopify_api/rest/resources/2024_04/recurring_application_charge.rb +9 -0
- data/lib/shopify_api/rest/resources/2024_04/shop.rb +12 -2
- data/lib/shopify_api/rest/resources/2024_07/abandoned_checkout.rb +194 -0
- data/lib/shopify_api/rest/resources/2024_07/access_scope.rb +62 -0
- data/lib/shopify_api/rest/resources/2024_07/apple_pay_certificate.rb +109 -0
- data/lib/shopify_api/rest/resources/2024_07/application_charge.rb +113 -0
- data/lib/shopify_api/rest/resources/2024_07/application_credit.rb +95 -0
- data/lib/shopify_api/rest/resources/2024_07/article.rb +269 -0
- data/lib/shopify_api/rest/resources/2024_07/asset.rb +122 -0
- data/lib/shopify_api/rest/resources/2024_07/assigned_fulfillment_order.rb +92 -0
- data/lib/shopify_api/rest/resources/2024_07/balance.rb +58 -0
- data/lib/shopify_api/rest/resources/2024_07/blog.rb +166 -0
- data/lib/shopify_api/rest/resources/2024_07/cancellation_request.rb +87 -0
- data/lib/shopify_api/rest/resources/2024_07/carrier_service.rb +120 -0
- data/lib/shopify_api/rest/resources/2024_07/checkout.rb +213 -0
- data/lib/shopify_api/rest/resources/2024_07/collect.rb +146 -0
- data/lib/shopify_api/rest/resources/2024_07/collection.rb +114 -0
- data/lib/shopify_api/rest/resources/2024_07/collection_listing.rb +159 -0
- data/lib/shopify_api/rest/resources/2024_07/comment.rb +287 -0
- data/lib/shopify_api/rest/resources/2024_07/country.rb +141 -0
- data/lib/shopify_api/rest/resources/2024_07/currency.rb +61 -0
- data/lib/shopify_api/rest/resources/2024_07/custom_collection.rb +191 -0
- data/lib/shopify_api/rest/resources/2024_07/customer.rb +335 -0
- data/lib/shopify_api/rest/resources/2024_07/customer_address.rb +215 -0
- data/lib/shopify_api/rest/resources/2024_07/deprecated_api_call.rb +61 -0
- data/lib/shopify_api/rest/resources/2024_07/discount_code.rb +226 -0
- data/lib/shopify_api/rest/resources/2024_07/dispute.rb +115 -0
- data/lib/shopify_api/rest/resources/2024_07/dispute_evidence.rb +121 -0
- data/lib/shopify_api/rest/resources/2024_07/dispute_file_upload.rb +85 -0
- data/lib/shopify_api/rest/resources/2024_07/draft_order.rb +279 -0
- data/lib/shopify_api/rest/resources/2024_07/event.rb +152 -0
- data/lib/shopify_api/rest/resources/2024_07/fulfillment.rb +235 -0
- data/lib/shopify_api/rest/resources/2024_07/fulfillment_event.rb +167 -0
- data/lib/shopify_api/rest/resources/2024_07/fulfillment_order.rb +326 -0
- data/lib/shopify_api/rest/resources/2024_07/fulfillment_request.rb +101 -0
- data/lib/shopify_api/rest/resources/2024_07/fulfillment_service.rb +134 -0
- data/lib/shopify_api/rest/resources/2024_07/gift_card.rb +222 -0
- data/lib/shopify_api/rest/resources/2024_07/gift_card_adjustment.rb +122 -0
- data/lib/shopify_api/rest/resources/2024_07/image.rb +161 -0
- data/lib/shopify_api/rest/resources/2024_07/inventory_item.rb +112 -0
- data/lib/shopify_api/rest/resources/2024_07/inventory_level.rb +183 -0
- data/lib/shopify_api/rest/resources/2024_07/location.rb +171 -0
- data/lib/shopify_api/rest/resources/2024_07/locations_for_move.rb +60 -0
- data/lib/shopify_api/rest/resources/2024_07/marketing_event.rb +213 -0
- data/lib/shopify_api/rest/resources/2024_07/metafield.rb +348 -0
- data/lib/shopify_api/rest/resources/2024_07/mobile_platform_application.rb +114 -0
- data/lib/shopify_api/rest/resources/2024_07/order.rb +489 -0
- data/lib/shopify_api/rest/resources/2024_07/order_risk.rb +148 -0
- data/lib/shopify_api/rest/resources/2024_07/page.rb +198 -0
- data/lib/shopify_api/rest/resources/2024_07/payment.rb +144 -0
- data/lib/shopify_api/rest/resources/2024_07/payment_gateway.rb +147 -0
- data/lib/shopify_api/rest/resources/2024_07/payment_transaction.rb +114 -0
- data/lib/shopify_api/rest/resources/2024_07/payout.rb +101 -0
- data/lib/shopify_api/rest/resources/2024_07/policy.rb +73 -0
- data/lib/shopify_api/rest/resources/2024_07/price_rule.rb +227 -0
- data/lib/shopify_api/rest/resources/2024_07/product.rb +227 -0
- data/lib/shopify_api/rest/resources/2024_07/product_listing.rb +200 -0
- data/lib/shopify_api/rest/resources/2024_07/product_resource_feedback.rb +92 -0
- data/lib/shopify_api/rest/resources/2024_07/province.rb +136 -0
- data/lib/shopify_api/rest/resources/2024_07/recurring_application_charge.rb +184 -0
- data/lib/shopify_api/rest/resources/2024_07/redirect.rb +143 -0
- data/lib/shopify_api/rest/resources/2024_07/refund.rb +155 -0
- data/lib/shopify_api/rest/resources/2024_07/resource_feedback.rb +77 -0
- data/lib/shopify_api/rest/resources/2024_07/script_tag.rb +159 -0
- data/lib/shopify_api/rest/resources/2024_07/shipping_zone.rb +87 -0
- data/lib/shopify_api/rest/resources/2024_07/shop.rb +232 -0
- data/lib/shopify_api/rest/resources/2024_07/smart_collection.rb +220 -0
- data/lib/shopify_api/rest/resources/2024_07/storefront_access_token.rb +91 -0
- data/lib/shopify_api/rest/resources/2024_07/tender_transaction.rb +97 -0
- data/lib/shopify_api/rest/resources/2024_07/theme.rb +127 -0
- data/lib/shopify_api/rest/resources/2024_07/transaction.rb +188 -0
- data/lib/shopify_api/rest/resources/2024_07/usage_charge.rb +106 -0
- data/lib/shopify_api/rest/resources/2024_07/user.rb +142 -0
- data/lib/shopify_api/rest/resources/2024_07/variant.rb +212 -0
- data/lib/shopify_api/rest/resources/2024_07/webhook.rb +172 -0
- data/lib/shopify_api/utils/attributes_comparator.rb +21 -4
- data/lib/shopify_api/version.rb +1 -1
- data/lib/shopify_api/webhooks/registry.rb +5 -4
- data/sorbet/rbi/shims/hash.rb +3 -0
- metadata +81 -6
@@ -0,0 +1,212 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
########################################################################################################################
|
5
|
+
# This file is auto-generated. If you have an issue, please create a GitHub issue. #
|
6
|
+
########################################################################################################################
|
7
|
+
|
8
|
+
module ShopifyAPI
|
9
|
+
class Variant < ShopifyAPI::Rest::Base
|
10
|
+
extend T::Sig
|
11
|
+
|
12
|
+
@prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
|
13
|
+
@next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
|
14
|
+
|
15
|
+
@api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
|
16
|
+
@retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
|
17
|
+
|
18
|
+
sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
|
19
|
+
def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
|
20
|
+
|
21
|
+
@barcode = T.let(nil, T.nilable(String))
|
22
|
+
@compare_at_price = T.let(nil, T.nilable(String))
|
23
|
+
@created_at = T.let(nil, T.nilable(String))
|
24
|
+
@fulfillment_service = T.let(nil, T.nilable(String))
|
25
|
+
@grams = T.let(nil, T.nilable(Integer))
|
26
|
+
@id = T.let(nil, T.nilable(Integer))
|
27
|
+
@image_id = T.let(nil, T.nilable(Integer))
|
28
|
+
@inventory_item_id = T.let(nil, T.nilable(Integer))
|
29
|
+
@inventory_management = T.let(nil, T.nilable(String))
|
30
|
+
@inventory_policy = T.let(nil, T.nilable(String))
|
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
|
+
@option = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
|
34
|
+
@position = T.let(nil, T.nilable(Integer))
|
35
|
+
@presentment_prices = T.let(nil, T.nilable(T::Array[T.untyped]))
|
36
|
+
@price = T.let(nil, T.nilable(String))
|
37
|
+
@product_id = T.let(nil, T.nilable(Integer))
|
38
|
+
@requires_shipping = T.let(nil, T.nilable(T::Boolean))
|
39
|
+
@sku = T.let(nil, T.nilable(String))
|
40
|
+
@tax_code = T.let(nil, T.nilable(String))
|
41
|
+
@taxable = T.let(nil, T.nilable(T::Boolean))
|
42
|
+
@title = T.let(nil, T.nilable(String))
|
43
|
+
@updated_at = T.let(nil, T.nilable(String))
|
44
|
+
@weight = T.let(nil, T.nilable(Float))
|
45
|
+
@weight_unit = T.let(nil, T.nilable(String))
|
46
|
+
|
47
|
+
super(session: session, from_hash: from_hash)
|
48
|
+
end
|
49
|
+
|
50
|
+
@has_one = T.let({}, T::Hash[Symbol, Class])
|
51
|
+
@has_many = T.let({}, T::Hash[Symbol, Class])
|
52
|
+
@paths = T.let([
|
53
|
+
{http_method: :delete, operation: :delete, ids: [:product_id, :id], path: "products/<product_id>/variants/<id>.json"},
|
54
|
+
{http_method: :get, operation: :count, ids: [:product_id], path: "products/<product_id>/variants/count.json"},
|
55
|
+
{http_method: :get, operation: :get, ids: [:product_id], path: "products/<product_id>/variants.json"},
|
56
|
+
{http_method: :get, operation: :get, ids: [:id], path: "variants/<id>.json"},
|
57
|
+
{http_method: :post, operation: :post, ids: [:product_id], path: "products/<product_id>/variants.json"},
|
58
|
+
{http_method: :put, operation: :put, ids: [:id], path: "variants/<id>.json"}
|
59
|
+
], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
|
60
|
+
@read_only_attributes = T.let([
|
61
|
+
:inventory_quantity
|
62
|
+
], T::Array[Symbol])
|
63
|
+
|
64
|
+
sig { returns(T.nilable(String)) }
|
65
|
+
attr_reader :barcode
|
66
|
+
sig { returns(T.nilable(String)) }
|
67
|
+
attr_reader :compare_at_price
|
68
|
+
sig { returns(T.nilable(String)) }
|
69
|
+
attr_reader :created_at
|
70
|
+
sig { returns(T.nilable(String)) }
|
71
|
+
attr_reader :fulfillment_service
|
72
|
+
sig { returns(T.nilable(Integer)) }
|
73
|
+
attr_reader :grams
|
74
|
+
sig { returns(T.nilable(Integer)) }
|
75
|
+
attr_reader :id
|
76
|
+
sig { returns(T.nilable(Integer)) }
|
77
|
+
attr_reader :image_id
|
78
|
+
sig { returns(T.nilable(Integer)) }
|
79
|
+
attr_reader :inventory_item_id
|
80
|
+
sig { returns(T.nilable(String)) }
|
81
|
+
attr_reader :inventory_management
|
82
|
+
sig { returns(T.nilable(String)) }
|
83
|
+
attr_reader :inventory_policy
|
84
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
85
|
+
attr_reader :inventory_quantity
|
86
|
+
sig { returns(T.nilable(T.any(Integer, String))) }
|
87
|
+
attr_reader :old_inventory_quantity
|
88
|
+
sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
|
89
|
+
attr_reader :option
|
90
|
+
sig { returns(T.nilable(Integer)) }
|
91
|
+
attr_reader :position
|
92
|
+
sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
|
93
|
+
attr_reader :presentment_prices
|
94
|
+
sig { returns(T.nilable(String)) }
|
95
|
+
attr_reader :price
|
96
|
+
sig { returns(T.nilable(Integer)) }
|
97
|
+
attr_reader :product_id
|
98
|
+
sig { returns(T.nilable(T::Boolean)) }
|
99
|
+
attr_reader :requires_shipping
|
100
|
+
sig { returns(T.nilable(String)) }
|
101
|
+
attr_reader :sku
|
102
|
+
sig { returns(T.nilable(String)) }
|
103
|
+
attr_reader :tax_code
|
104
|
+
sig { returns(T.nilable(T::Boolean)) }
|
105
|
+
attr_reader :taxable
|
106
|
+
sig { returns(T.nilable(String)) }
|
107
|
+
attr_reader :title
|
108
|
+
sig { returns(T.nilable(String)) }
|
109
|
+
attr_reader :updated_at
|
110
|
+
sig { returns(T.nilable(Float)) }
|
111
|
+
attr_reader :weight
|
112
|
+
sig { returns(T.nilable(String)) }
|
113
|
+
attr_reader :weight_unit
|
114
|
+
|
115
|
+
class << self
|
116
|
+
sig do
|
117
|
+
params(
|
118
|
+
id: T.any(Integer, String),
|
119
|
+
fields: T.untyped,
|
120
|
+
session: Auth::Session
|
121
|
+
).returns(T.nilable(Variant))
|
122
|
+
end
|
123
|
+
def find(
|
124
|
+
id:,
|
125
|
+
fields: nil,
|
126
|
+
session: ShopifyAPI::Context.active_session
|
127
|
+
)
|
128
|
+
result = base_find(
|
129
|
+
session: session,
|
130
|
+
ids: {id: id},
|
131
|
+
params: {fields: fields},
|
132
|
+
)
|
133
|
+
T.cast(result[0], T.nilable(Variant))
|
134
|
+
end
|
135
|
+
|
136
|
+
sig do
|
137
|
+
params(
|
138
|
+
id: T.any(Integer, String),
|
139
|
+
product_id: T.nilable(T.any(Integer, String)),
|
140
|
+
session: Auth::Session
|
141
|
+
).returns(T.untyped)
|
142
|
+
end
|
143
|
+
def delete(
|
144
|
+
id:,
|
145
|
+
product_id: nil,
|
146
|
+
session: ShopifyAPI::Context.active_session
|
147
|
+
)
|
148
|
+
request(
|
149
|
+
http_method: :delete,
|
150
|
+
operation: :delete,
|
151
|
+
session: session,
|
152
|
+
ids: {id: id, product_id: product_id},
|
153
|
+
params: {},
|
154
|
+
)
|
155
|
+
end
|
156
|
+
|
157
|
+
sig do
|
158
|
+
params(
|
159
|
+
product_id: T.nilable(T.any(Integer, String)),
|
160
|
+
limit: T.untyped,
|
161
|
+
presentment_currencies: T.untyped,
|
162
|
+
since_id: T.untyped,
|
163
|
+
fields: T.untyped,
|
164
|
+
session: Auth::Session,
|
165
|
+
kwargs: T.untyped
|
166
|
+
).returns(T::Array[Variant])
|
167
|
+
end
|
168
|
+
def all(
|
169
|
+
product_id: nil,
|
170
|
+
limit: nil,
|
171
|
+
presentment_currencies: nil,
|
172
|
+
since_id: nil,
|
173
|
+
fields: nil,
|
174
|
+
session: ShopifyAPI::Context.active_session,
|
175
|
+
**kwargs
|
176
|
+
)
|
177
|
+
response = base_find(
|
178
|
+
session: session,
|
179
|
+
ids: {product_id: product_id},
|
180
|
+
params: {limit: limit, presentment_currencies: presentment_currencies, since_id: since_id, fields: fields}.merge(kwargs).compact,
|
181
|
+
)
|
182
|
+
|
183
|
+
T.cast(response, T::Array[Variant])
|
184
|
+
end
|
185
|
+
|
186
|
+
sig do
|
187
|
+
params(
|
188
|
+
product_id: T.nilable(T.any(Integer, String)),
|
189
|
+
session: Auth::Session,
|
190
|
+
kwargs: T.untyped
|
191
|
+
).returns(T.untyped)
|
192
|
+
end
|
193
|
+
def count(
|
194
|
+
product_id: nil,
|
195
|
+
session: ShopifyAPI::Context.active_session,
|
196
|
+
**kwargs
|
197
|
+
)
|
198
|
+
request(
|
199
|
+
http_method: :get,
|
200
|
+
operation: :count,
|
201
|
+
session: session,
|
202
|
+
ids: {product_id: product_id},
|
203
|
+
params: {}.merge(kwargs).compact,
|
204
|
+
body: {},
|
205
|
+
entity: nil,
|
206
|
+
)
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
########################################################################################################################
|
5
|
+
# This file is auto-generated. If you have an issue, please create a GitHub issue. #
|
6
|
+
########################################################################################################################
|
7
|
+
|
8
|
+
module ShopifyAPI
|
9
|
+
class Webhook < ShopifyAPI::Rest::Base
|
10
|
+
extend T::Sig
|
11
|
+
|
12
|
+
@prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
|
13
|
+
@next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
|
14
|
+
|
15
|
+
@api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
|
16
|
+
@retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
|
17
|
+
|
18
|
+
sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
|
19
|
+
def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
|
20
|
+
|
21
|
+
@address = T.let(nil, T.nilable(String))
|
22
|
+
@topic = T.let(nil, T.nilable(String))
|
23
|
+
@api_version = T.let(nil, T.nilable(String))
|
24
|
+
@created_at = T.let(nil, T.nilable(String))
|
25
|
+
@fields = T.let(nil, T.nilable(T::Array[T.untyped]))
|
26
|
+
@format = T.let(nil, T.nilable(String))
|
27
|
+
@id = T.let(nil, T.nilable(Integer))
|
28
|
+
@metafield_namespaces = T.let(nil, T.nilable(T::Array[T.untyped]))
|
29
|
+
@private_metafield_namespaces = T.let(nil, T.nilable(T::Array[T.untyped]))
|
30
|
+
@updated_at = T.let(nil, T.nilable(String))
|
31
|
+
|
32
|
+
super(session: session, from_hash: from_hash)
|
33
|
+
end
|
34
|
+
|
35
|
+
@has_one = T.let({}, T::Hash[Symbol, Class])
|
36
|
+
@has_many = T.let({}, T::Hash[Symbol, Class])
|
37
|
+
@paths = T.let([
|
38
|
+
{http_method: :delete, operation: :delete, ids: [:id], path: "webhooks/<id>.json"},
|
39
|
+
{http_method: :get, operation: :count, ids: [], path: "webhooks/count.json"},
|
40
|
+
{http_method: :get, operation: :get, ids: [], path: "webhooks.json"},
|
41
|
+
{http_method: :get, operation: :get, ids: [:id], path: "webhooks/<id>.json"},
|
42
|
+
{http_method: :post, operation: :post, ids: [], path: "webhooks.json"},
|
43
|
+
{http_method: :put, operation: :put, ids: [:id], path: "webhooks/<id>.json"}
|
44
|
+
], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
|
45
|
+
|
46
|
+
sig { returns(T.nilable(String)) }
|
47
|
+
attr_reader :address
|
48
|
+
sig { returns(T.nilable(String)) }
|
49
|
+
attr_reader :topic
|
50
|
+
sig { returns(T.nilable(String)) }
|
51
|
+
attr_reader :api_version
|
52
|
+
sig { returns(T.nilable(String)) }
|
53
|
+
attr_reader :created_at
|
54
|
+
sig { returns(T.nilable(T::Array[String])) }
|
55
|
+
attr_reader :fields
|
56
|
+
sig { returns(T.nilable(String)) }
|
57
|
+
attr_reader :format
|
58
|
+
sig { returns(T.nilable(Integer)) }
|
59
|
+
attr_reader :id
|
60
|
+
sig { returns(T.nilable(T::Array[String])) }
|
61
|
+
attr_reader :metafield_namespaces
|
62
|
+
sig { returns(T.nilable(T::Array[String])) }
|
63
|
+
attr_reader :private_metafield_namespaces
|
64
|
+
sig { returns(T.nilable(String)) }
|
65
|
+
attr_reader :updated_at
|
66
|
+
|
67
|
+
class << self
|
68
|
+
sig do
|
69
|
+
params(
|
70
|
+
id: T.any(Integer, String),
|
71
|
+
fields: T.untyped,
|
72
|
+
session: Auth::Session
|
73
|
+
).returns(T.nilable(Webhook))
|
74
|
+
end
|
75
|
+
def find(
|
76
|
+
id:,
|
77
|
+
fields: nil,
|
78
|
+
session: ShopifyAPI::Context.active_session
|
79
|
+
)
|
80
|
+
result = base_find(
|
81
|
+
session: session,
|
82
|
+
ids: {id: id},
|
83
|
+
params: {fields: fields},
|
84
|
+
)
|
85
|
+
T.cast(result[0], T.nilable(Webhook))
|
86
|
+
end
|
87
|
+
|
88
|
+
sig do
|
89
|
+
params(
|
90
|
+
id: T.any(Integer, String),
|
91
|
+
session: Auth::Session
|
92
|
+
).returns(T.untyped)
|
93
|
+
end
|
94
|
+
def delete(
|
95
|
+
id:,
|
96
|
+
session: ShopifyAPI::Context.active_session
|
97
|
+
)
|
98
|
+
request(
|
99
|
+
http_method: :delete,
|
100
|
+
operation: :delete,
|
101
|
+
session: session,
|
102
|
+
ids: {id: id},
|
103
|
+
params: {},
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
107
|
+
sig do
|
108
|
+
params(
|
109
|
+
address: T.untyped,
|
110
|
+
created_at_max: T.untyped,
|
111
|
+
created_at_min: T.untyped,
|
112
|
+
fields: T.untyped,
|
113
|
+
limit: T.untyped,
|
114
|
+
since_id: T.untyped,
|
115
|
+
topic: T.untyped,
|
116
|
+
updated_at_min: T.untyped,
|
117
|
+
updated_at_max: T.untyped,
|
118
|
+
session: Auth::Session,
|
119
|
+
kwargs: T.untyped
|
120
|
+
).returns(T::Array[Webhook])
|
121
|
+
end
|
122
|
+
def all(
|
123
|
+
address: nil,
|
124
|
+
created_at_max: nil,
|
125
|
+
created_at_min: nil,
|
126
|
+
fields: nil,
|
127
|
+
limit: nil,
|
128
|
+
since_id: nil,
|
129
|
+
topic: nil,
|
130
|
+
updated_at_min: nil,
|
131
|
+
updated_at_max: nil,
|
132
|
+
session: ShopifyAPI::Context.active_session,
|
133
|
+
**kwargs
|
134
|
+
)
|
135
|
+
response = base_find(
|
136
|
+
session: session,
|
137
|
+
ids: {},
|
138
|
+
params: {address: address, created_at_max: created_at_max, created_at_min: created_at_min, fields: fields, limit: limit, since_id: since_id, topic: topic, updated_at_min: updated_at_min, updated_at_max: updated_at_max}.merge(kwargs).compact,
|
139
|
+
)
|
140
|
+
|
141
|
+
T.cast(response, T::Array[Webhook])
|
142
|
+
end
|
143
|
+
|
144
|
+
sig do
|
145
|
+
params(
|
146
|
+
address: T.untyped,
|
147
|
+
topic: T.untyped,
|
148
|
+
session: Auth::Session,
|
149
|
+
kwargs: T.untyped
|
150
|
+
).returns(T.untyped)
|
151
|
+
end
|
152
|
+
def count(
|
153
|
+
address: nil,
|
154
|
+
topic: nil,
|
155
|
+
session: ShopifyAPI::Context.active_session,
|
156
|
+
**kwargs
|
157
|
+
)
|
158
|
+
request(
|
159
|
+
http_method: :get,
|
160
|
+
operation: :count,
|
161
|
+
session: session,
|
162
|
+
ids: {},
|
163
|
+
params: {address: address, topic: topic}.merge(kwargs).compact,
|
164
|
+
body: {},
|
165
|
+
entity: nil,
|
166
|
+
)
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
end
|
@@ -13,9 +13,10 @@ module ShopifyAPI
|
|
13
13
|
params(
|
14
14
|
original_attributes: T::Hash[String, T.untyped],
|
15
15
|
updated_attributes: T::Hash[String, T.untyped],
|
16
|
+
atomic_hash_attributes: T::Array[Symbol],
|
16
17
|
).returns(T::Hash[String, T.untyped])
|
17
18
|
end
|
18
|
-
def compare(original_attributes, updated_attributes)
|
19
|
+
def compare(original_attributes, updated_attributes, atomic_hash_attributes: [])
|
19
20
|
attributes_diff = HashDiff::Comparison.new(
|
20
21
|
original_attributes,
|
21
22
|
updated_attributes,
|
@@ -24,6 +25,7 @@ module ShopifyAPI
|
|
24
25
|
update_value = build_update_value(
|
25
26
|
attributes_diff,
|
26
27
|
reference_values: updated_attributes,
|
28
|
+
atomic_hash_attributes: atomic_hash_attributes,
|
27
29
|
)
|
28
30
|
|
29
31
|
update_value
|
@@ -34,9 +36,10 @@ module ShopifyAPI
|
|
34
36
|
diff: T::Hash[String, T.untyped],
|
35
37
|
path: T::Array[String],
|
36
38
|
reference_values: T::Hash[String, T.untyped],
|
39
|
+
atomic_hash_attributes: T::Array[Symbol],
|
37
40
|
).returns(T::Hash[String, T.untyped])
|
38
41
|
end
|
39
|
-
def build_update_value(diff, path: [], reference_values: {})
|
42
|
+
def build_update_value(diff, path: [], reference_values: {}, atomic_hash_attributes: [])
|
40
43
|
new_hash = {}
|
41
44
|
|
42
45
|
diff.each do |key, value|
|
@@ -49,7 +52,19 @@ module ShopifyAPI
|
|
49
52
|
if has_numbered_key && ref_value.is_a?(Array)
|
50
53
|
new_hash[key] = ref_value
|
51
54
|
else
|
52
|
-
new_value = build_update_value(
|
55
|
+
new_value = build_update_value(
|
56
|
+
value,
|
57
|
+
path: current_path,
|
58
|
+
reference_values: reference_values,
|
59
|
+
atomic_hash_attributes: atomic_hash_attributes,
|
60
|
+
)
|
61
|
+
|
62
|
+
atomic_update = atomic_hash_attributes.include?(key.to_sym)
|
63
|
+
|
64
|
+
# If the key is in atomic_hash_attributes, we use the entire reference value
|
65
|
+
# so we update the hash as a whole.
|
66
|
+
if !new_value.empty? && !ref_value.empty? && atomic_update
|
67
|
+
new_hash[key] = ref_value
|
53
68
|
|
54
69
|
# Only add to new_hash if the user intentionally updates
|
55
70
|
# to empty value like `{}` or `[]`. For example:
|
@@ -70,7 +85,9 @@ module ShopifyAPI
|
|
70
85
|
# new_hash = {}
|
71
86
|
#
|
72
87
|
# new_hash is empty because nothing changes
|
73
|
-
|
88
|
+
elsif !new_value.empty? || ref_value.empty?
|
89
|
+
new_hash[key] = new_value
|
90
|
+
end
|
74
91
|
end
|
75
92
|
elsif value != HashDiff::NO_VALUE
|
76
93
|
new_hash[key] = value
|
data/lib/shopify_api/version.rb
CHANGED
@@ -138,7 +138,7 @@ module ShopifyAPI
|
|
138
138
|
}
|
139
139
|
MUTATION
|
140
140
|
|
141
|
-
delete_response = client.query(query: delete_mutation)
|
141
|
+
delete_response = client.query(query: delete_mutation, response_as_struct: false)
|
142
142
|
raise Errors::WebhookRegistrationError,
|
143
143
|
"Failed to delete webhook from Shopify" unless delete_response.ok?
|
144
144
|
result = T.cast(delete_response.body, T::Hash[String, T.untyped])
|
@@ -170,7 +170,7 @@ module ShopifyAPI
|
|
170
170
|
}
|
171
171
|
QUERY
|
172
172
|
|
173
|
-
fetch_id_response = client.query(query: fetch_id_query)
|
173
|
+
fetch_id_response = client.query(query: fetch_id_query, response_as_struct: false)
|
174
174
|
raise Errors::WebhookRegistrationError,
|
175
175
|
"Failed to fetch webhook from Shopify" unless fetch_id_response.ok?
|
176
176
|
body = T.cast(fetch_id_response.body, T::Hash[String, T.untyped])
|
@@ -216,7 +216,7 @@ module ShopifyAPI
|
|
216
216
|
).returns(T::Hash[Symbol, T.untyped])
|
217
217
|
end
|
218
218
|
def webhook_registration_needed?(client, registration)
|
219
|
-
check_response = client.query(query: registration.build_check_query)
|
219
|
+
check_response = client.query(query: registration.build_check_query, response_as_struct: false)
|
220
220
|
raise Errors::WebhookRegistrationError,
|
221
221
|
"Failed to check if webhook was already registered" unless check_response.ok?
|
222
222
|
parsed_check_result = registration.parse_check_result(T.cast(check_response.body, T::Hash[String, T.untyped]))
|
@@ -233,7 +233,8 @@ module ShopifyAPI
|
|
233
233
|
).returns(T::Hash[String, T.untyped])
|
234
234
|
end
|
235
235
|
def send_register_request(client, registration, webhook_id)
|
236
|
-
register_response = client.query(query: registration.build_register_query(webhook_id: webhook_id)
|
236
|
+
register_response = client.query(query: registration.build_register_query(webhook_id: webhook_id),
|
237
|
+
response_as_struct: false)
|
237
238
|
|
238
239
|
raise Errors::WebhookRegistrationError, "Failed to register webhook with Shopify" unless register_response.ok?
|
239
240
|
|
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: 14.
|
4
|
+
version: 14.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- ".ruby-version"
|
179
179
|
- BREAKING_CHANGES_FOR_OLDER_VERSIONS.md
|
180
180
|
- BREAKING_CHANGES_FOR_V10.md
|
181
|
+
- BREAKING_CHANGES_FOR_V15.md
|
181
182
|
- CHANGELOG.md
|
182
183
|
- CODE_OF_CONDUCT.md
|
183
184
|
- CONTRIBUTING.md
|
@@ -917,6 +918,79 @@ files:
|
|
917
918
|
- lib/shopify_api/rest/resources/2024_04/user.rb
|
918
919
|
- lib/shopify_api/rest/resources/2024_04/variant.rb
|
919
920
|
- lib/shopify_api/rest/resources/2024_04/webhook.rb
|
921
|
+
- lib/shopify_api/rest/resources/2024_07/abandoned_checkout.rb
|
922
|
+
- lib/shopify_api/rest/resources/2024_07/access_scope.rb
|
923
|
+
- lib/shopify_api/rest/resources/2024_07/apple_pay_certificate.rb
|
924
|
+
- lib/shopify_api/rest/resources/2024_07/application_charge.rb
|
925
|
+
- lib/shopify_api/rest/resources/2024_07/application_credit.rb
|
926
|
+
- lib/shopify_api/rest/resources/2024_07/article.rb
|
927
|
+
- lib/shopify_api/rest/resources/2024_07/asset.rb
|
928
|
+
- lib/shopify_api/rest/resources/2024_07/assigned_fulfillment_order.rb
|
929
|
+
- lib/shopify_api/rest/resources/2024_07/balance.rb
|
930
|
+
- lib/shopify_api/rest/resources/2024_07/blog.rb
|
931
|
+
- lib/shopify_api/rest/resources/2024_07/cancellation_request.rb
|
932
|
+
- lib/shopify_api/rest/resources/2024_07/carrier_service.rb
|
933
|
+
- lib/shopify_api/rest/resources/2024_07/checkout.rb
|
934
|
+
- lib/shopify_api/rest/resources/2024_07/collect.rb
|
935
|
+
- lib/shopify_api/rest/resources/2024_07/collection.rb
|
936
|
+
- lib/shopify_api/rest/resources/2024_07/collection_listing.rb
|
937
|
+
- lib/shopify_api/rest/resources/2024_07/comment.rb
|
938
|
+
- lib/shopify_api/rest/resources/2024_07/country.rb
|
939
|
+
- lib/shopify_api/rest/resources/2024_07/currency.rb
|
940
|
+
- lib/shopify_api/rest/resources/2024_07/custom_collection.rb
|
941
|
+
- lib/shopify_api/rest/resources/2024_07/customer.rb
|
942
|
+
- lib/shopify_api/rest/resources/2024_07/customer_address.rb
|
943
|
+
- lib/shopify_api/rest/resources/2024_07/deprecated_api_call.rb
|
944
|
+
- lib/shopify_api/rest/resources/2024_07/discount_code.rb
|
945
|
+
- lib/shopify_api/rest/resources/2024_07/dispute.rb
|
946
|
+
- lib/shopify_api/rest/resources/2024_07/dispute_evidence.rb
|
947
|
+
- lib/shopify_api/rest/resources/2024_07/dispute_file_upload.rb
|
948
|
+
- lib/shopify_api/rest/resources/2024_07/draft_order.rb
|
949
|
+
- lib/shopify_api/rest/resources/2024_07/event.rb
|
950
|
+
- lib/shopify_api/rest/resources/2024_07/fulfillment.rb
|
951
|
+
- lib/shopify_api/rest/resources/2024_07/fulfillment_event.rb
|
952
|
+
- lib/shopify_api/rest/resources/2024_07/fulfillment_order.rb
|
953
|
+
- lib/shopify_api/rest/resources/2024_07/fulfillment_request.rb
|
954
|
+
- lib/shopify_api/rest/resources/2024_07/fulfillment_service.rb
|
955
|
+
- lib/shopify_api/rest/resources/2024_07/gift_card.rb
|
956
|
+
- lib/shopify_api/rest/resources/2024_07/gift_card_adjustment.rb
|
957
|
+
- lib/shopify_api/rest/resources/2024_07/image.rb
|
958
|
+
- lib/shopify_api/rest/resources/2024_07/inventory_item.rb
|
959
|
+
- lib/shopify_api/rest/resources/2024_07/inventory_level.rb
|
960
|
+
- lib/shopify_api/rest/resources/2024_07/location.rb
|
961
|
+
- lib/shopify_api/rest/resources/2024_07/locations_for_move.rb
|
962
|
+
- lib/shopify_api/rest/resources/2024_07/marketing_event.rb
|
963
|
+
- lib/shopify_api/rest/resources/2024_07/metafield.rb
|
964
|
+
- lib/shopify_api/rest/resources/2024_07/mobile_platform_application.rb
|
965
|
+
- lib/shopify_api/rest/resources/2024_07/order.rb
|
966
|
+
- lib/shopify_api/rest/resources/2024_07/order_risk.rb
|
967
|
+
- lib/shopify_api/rest/resources/2024_07/page.rb
|
968
|
+
- lib/shopify_api/rest/resources/2024_07/payment.rb
|
969
|
+
- lib/shopify_api/rest/resources/2024_07/payment_gateway.rb
|
970
|
+
- lib/shopify_api/rest/resources/2024_07/payment_transaction.rb
|
971
|
+
- lib/shopify_api/rest/resources/2024_07/payout.rb
|
972
|
+
- lib/shopify_api/rest/resources/2024_07/policy.rb
|
973
|
+
- lib/shopify_api/rest/resources/2024_07/price_rule.rb
|
974
|
+
- lib/shopify_api/rest/resources/2024_07/product.rb
|
975
|
+
- lib/shopify_api/rest/resources/2024_07/product_listing.rb
|
976
|
+
- lib/shopify_api/rest/resources/2024_07/product_resource_feedback.rb
|
977
|
+
- lib/shopify_api/rest/resources/2024_07/province.rb
|
978
|
+
- lib/shopify_api/rest/resources/2024_07/recurring_application_charge.rb
|
979
|
+
- lib/shopify_api/rest/resources/2024_07/redirect.rb
|
980
|
+
- lib/shopify_api/rest/resources/2024_07/refund.rb
|
981
|
+
- lib/shopify_api/rest/resources/2024_07/resource_feedback.rb
|
982
|
+
- lib/shopify_api/rest/resources/2024_07/script_tag.rb
|
983
|
+
- lib/shopify_api/rest/resources/2024_07/shipping_zone.rb
|
984
|
+
- lib/shopify_api/rest/resources/2024_07/shop.rb
|
985
|
+
- lib/shopify_api/rest/resources/2024_07/smart_collection.rb
|
986
|
+
- lib/shopify_api/rest/resources/2024_07/storefront_access_token.rb
|
987
|
+
- lib/shopify_api/rest/resources/2024_07/tender_transaction.rb
|
988
|
+
- lib/shopify_api/rest/resources/2024_07/theme.rb
|
989
|
+
- lib/shopify_api/rest/resources/2024_07/transaction.rb
|
990
|
+
- lib/shopify_api/rest/resources/2024_07/usage_charge.rb
|
991
|
+
- lib/shopify_api/rest/resources/2024_07/user.rb
|
992
|
+
- lib/shopify_api/rest/resources/2024_07/variant.rb
|
993
|
+
- lib/shopify_api/rest/resources/2024_07/webhook.rb
|
920
994
|
- lib/shopify_api/utils/attributes_comparator.rb
|
921
995
|
- lib/shopify_api/utils/graphql_proxy.rb
|
922
996
|
- lib/shopify_api/utils/hmac_validator.rb
|
@@ -984,6 +1058,7 @@ files:
|
|
984
1058
|
- sorbet/rbi/gems/yard@0.9.27.rbi
|
985
1059
|
- sorbet/rbi/gems/zeitwerk@2.5.4.rbi
|
986
1060
|
- sorbet/rbi/shims/fakefs.rbi
|
1061
|
+
- sorbet/rbi/shims/hash.rb
|
987
1062
|
- sorbet/rbi/shims/openssl.rb
|
988
1063
|
- sorbet/rbi/todo.rbi
|
989
1064
|
- sorbet/tapioca/config.yml
|
@@ -993,7 +1068,7 @@ licenses:
|
|
993
1068
|
- MIT
|
994
1069
|
metadata:
|
995
1070
|
allowed_push_host: https://rubygems.org
|
996
|
-
post_install_message:
|
1071
|
+
post_install_message:
|
997
1072
|
rdoc_options:
|
998
1073
|
- "--charset=UTF-8"
|
999
1074
|
require_paths:
|
@@ -1009,8 +1084,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1009
1084
|
- !ruby/object:Gem::Version
|
1010
1085
|
version: '0'
|
1011
1086
|
requirements: []
|
1012
|
-
rubygems_version: 3.5.
|
1013
|
-
signing_key:
|
1087
|
+
rubygems_version: 3.5.17
|
1088
|
+
signing_key:
|
1014
1089
|
specification_version: 4
|
1015
1090
|
summary: The gem for accessing the Shopify API
|
1016
1091
|
test_files: []
|