shopify_api 14.11.1 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/api_update_reminder.yml +2 -2
- data/.github/workflows/api_update_reminder_on_release.yml +2 -2
- data/.github/workflows/build.yml +2 -2
- data/.github/workflows/close-waiting-for-response-issues.yml +1 -1
- data/.github/workflows/remove-labels-on-activity.yml +1 -1
- data/BREAKING_CHANGES_FOR_V15.md +98 -3
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/RELEASING.md +108 -17
- data/REST_RESOURCES.md +161 -0
- data/docs/usage/webhooks.md +0 -17
- data/lib/shopify_api/admin_versions.rb +1 -5
- data/lib/shopify_api/clients/graphql/storefront.rb +5 -11
- data/lib/shopify_api/context.rb +4 -4
- data/lib/shopify_api/rest/resources/2025_10/abandoned_checkout.rb +194 -0
- data/lib/shopify_api/rest/resources/2025_10/access_scope.rb +62 -0
- data/lib/shopify_api/rest/resources/2025_10/apple_pay_certificate.rb +109 -0
- data/lib/shopify_api/rest/resources/2025_10/application_charge.rb +113 -0
- data/lib/shopify_api/rest/resources/2025_10/application_credit.rb +95 -0
- data/lib/shopify_api/rest/resources/2025_10/article.rb +269 -0
- data/lib/shopify_api/rest/resources/2025_10/asset.rb +122 -0
- data/lib/shopify_api/rest/resources/2025_10/assigned_fulfillment_order.rb +92 -0
- data/lib/shopify_api/rest/resources/2025_10/balance.rb +58 -0
- data/lib/shopify_api/rest/resources/2025_10/blog.rb +166 -0
- data/lib/shopify_api/rest/resources/2025_10/cancellation_request.rb +87 -0
- data/lib/shopify_api/rest/resources/2025_10/carrier_service.rb +120 -0
- data/lib/shopify_api/rest/resources/2025_10/checkout.rb +213 -0
- data/lib/shopify_api/rest/resources/2025_10/collect.rb +146 -0
- data/lib/shopify_api/rest/resources/2025_10/collection.rb +114 -0
- data/lib/shopify_api/rest/resources/2025_10/collection_listing.rb +159 -0
- data/lib/shopify_api/rest/resources/2025_10/comment.rb +287 -0
- data/lib/shopify_api/rest/resources/2025_10/country.rb +141 -0
- data/lib/shopify_api/rest/resources/2025_10/currency.rb +61 -0
- data/lib/shopify_api/rest/resources/2025_10/custom_collection.rb +191 -0
- data/lib/shopify_api/rest/resources/2025_10/customer.rb +328 -0
- data/lib/shopify_api/rest/resources/2025_10/deprecated_api_call.rb +61 -0
- data/lib/shopify_api/rest/resources/2025_10/discount_code.rb +226 -0
- data/lib/shopify_api/rest/resources/2025_10/dispute.rb +115 -0
- data/lib/shopify_api/rest/resources/2025_10/dispute_evidence.rb +121 -0
- data/lib/shopify_api/rest/resources/2025_10/dispute_file_upload.rb +85 -0
- data/lib/shopify_api/rest/resources/2025_10/draft_order.rb +279 -0
- data/lib/shopify_api/rest/resources/2025_10/event.rb +152 -0
- data/lib/shopify_api/rest/resources/2025_10/fulfillment.rb +235 -0
- data/lib/shopify_api/rest/resources/2025_10/fulfillment_event.rb +167 -0
- data/lib/shopify_api/rest/resources/2025_10/fulfillment_order.rb +326 -0
- data/lib/shopify_api/rest/resources/2025_10/fulfillment_request.rb +116 -0
- data/lib/shopify_api/rest/resources/2025_10/fulfillment_service.rb +134 -0
- data/lib/shopify_api/rest/resources/2025_10/gift_card.rb +222 -0
- data/lib/shopify_api/rest/resources/2025_10/gift_card_adjustment.rb +122 -0
- data/lib/shopify_api/rest/resources/2025_10/image.rb +161 -0
- data/lib/shopify_api/rest/resources/2025_10/inventory_item.rb +112 -0
- data/lib/shopify_api/rest/resources/2025_10/inventory_level.rb +183 -0
- data/lib/shopify_api/rest/resources/2025_10/location.rb +171 -0
- data/lib/shopify_api/rest/resources/2025_10/locations_for_move.rb +60 -0
- data/lib/shopify_api/rest/resources/2025_10/marketing_event.rb +213 -0
- data/lib/shopify_api/rest/resources/2025_10/metafield.rb +348 -0
- data/lib/shopify_api/rest/resources/2025_10/mobile_platform_application.rb +120 -0
- data/lib/shopify_api/rest/resources/2025_10/order.rb +503 -0
- data/lib/shopify_api/rest/resources/2025_10/order_risk.rb +148 -0
- data/lib/shopify_api/rest/resources/2025_10/page.rb +198 -0
- data/lib/shopify_api/rest/resources/2025_10/payment.rb +98 -0
- data/lib/shopify_api/rest/resources/2025_10/payment_gateway.rb +147 -0
- data/lib/shopify_api/rest/resources/2025_10/payment_transaction.rb +117 -0
- data/lib/shopify_api/rest/resources/2025_10/payout.rb +101 -0
- data/lib/shopify_api/rest/resources/2025_10/policy.rb +73 -0
- data/lib/shopify_api/rest/resources/2025_10/price_rule.rb +227 -0
- data/lib/shopify_api/rest/resources/2025_10/product.rb +227 -0
- data/lib/shopify_api/rest/resources/2025_10/product_listing.rb +200 -0
- data/lib/shopify_api/rest/resources/2025_10/product_resource_feedback.rb +92 -0
- data/lib/shopify_api/rest/resources/2025_10/province.rb +136 -0
- data/lib/shopify_api/rest/resources/2025_10/recurring_application_charge.rb +184 -0
- data/lib/shopify_api/rest/resources/2025_10/redirect.rb +143 -0
- data/lib/shopify_api/rest/resources/2025_10/refund.rb +158 -0
- data/lib/shopify_api/rest/resources/2025_10/resource_feedback.rb +77 -0
- data/lib/shopify_api/rest/resources/2025_10/script_tag.rb +159 -0
- data/lib/shopify_api/rest/resources/2025_10/shipping_zone.rb +87 -0
- data/lib/shopify_api/rest/resources/2025_10/shop.rb +231 -0
- data/lib/shopify_api/rest/resources/2025_10/smart_collection.rb +220 -0
- data/lib/shopify_api/rest/resources/2025_10/storefront_access_token.rb +91 -0
- data/lib/shopify_api/rest/resources/2025_10/tender_transaction.rb +97 -0
- data/lib/shopify_api/rest/resources/2025_10/theme.rb +127 -0
- data/lib/shopify_api/rest/resources/2025_10/transaction.rb +194 -0
- data/lib/shopify_api/rest/resources/2025_10/usage_charge.rb +106 -0
- data/lib/shopify_api/rest/resources/2025_10/user.rb +142 -0
- data/lib/shopify_api/rest/resources/2025_10/variant.rb +212 -0
- data/lib/shopify_api/rest/resources/2025_10/webhook.rb +173 -0
- data/lib/shopify_api/version.rb +1 -1
- data/lib/shopify_api/webhooks/registration.rb +3 -3
- data/lib/shopify_api/webhooks/registry.rb +3 -13
- data/lib/shopify_api/webhooks/{handler.rb → webhook_handler.rb} +0 -12
- data/lib/shopify_api.rb +1 -1
- metadata +76 -3
|
@@ -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,173 @@
|
|
|
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
|
+
@filter = T.let(nil, T.nilable(String))
|
|
27
|
+
@format = T.let(nil, T.nilable(String))
|
|
28
|
+
@id = T.let(nil, T.nilable(Integer))
|
|
29
|
+
@metafield_namespaces = T.let(nil, T.nilable(T::Array[T.untyped]))
|
|
30
|
+
@private_metafield_namespaces = T.let(nil, T.nilable(T::Array[T.untyped]))
|
|
31
|
+
@updated_at = T.let(nil, T.nilable(String))
|
|
32
|
+
|
|
33
|
+
super(session: session, from_hash: from_hash)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
@has_one = T.let({}, T::Hash[Symbol, Class])
|
|
37
|
+
@has_many = T.let({}, T::Hash[Symbol, Class])
|
|
38
|
+
@paths = T.let([
|
|
39
|
+
{http_method: :delete, operation: :delete, ids: [:id], path: "webhooks/<id>.json"},
|
|
40
|
+
{http_method: :get, operation: :count, ids: [], path: "webhooks/count.json"},
|
|
41
|
+
{http_method: :get, operation: :get, ids: [], path: "webhooks.json"},
|
|
42
|
+
{http_method: :get, operation: :get, ids: [:id], path: "webhooks/<id>.json"},
|
|
43
|
+
{http_method: :post, operation: :post, ids: [], path: "webhooks.json"},
|
|
44
|
+
{http_method: :put, operation: :put, ids: [:id], path: "webhooks/<id>.json"}
|
|
45
|
+
], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
|
|
46
|
+
|
|
47
|
+
sig { returns(T.nilable(String)) }
|
|
48
|
+
attr_reader :address
|
|
49
|
+
sig { returns(T.nilable(String)) }
|
|
50
|
+
attr_reader :topic
|
|
51
|
+
sig { returns(T.nilable(String)) }
|
|
52
|
+
attr_reader :api_version
|
|
53
|
+
sig { returns(T.nilable(String)) }
|
|
54
|
+
attr_reader :created_at
|
|
55
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
56
|
+
attr_reader :fields
|
|
57
|
+
sig { returns(T.nilable(String)) }
|
|
58
|
+
attr_reader :format
|
|
59
|
+
sig { returns(T.nilable(Integer)) }
|
|
60
|
+
attr_reader :id
|
|
61
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
62
|
+
attr_reader :metafield_namespaces
|
|
63
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
64
|
+
attr_reader :private_metafield_namespaces
|
|
65
|
+
sig { returns(T.nilable(String)) }
|
|
66
|
+
attr_reader :updated_at
|
|
67
|
+
|
|
68
|
+
class << self
|
|
69
|
+
sig do
|
|
70
|
+
params(
|
|
71
|
+
id: T.any(Integer, String),
|
|
72
|
+
fields: T.untyped,
|
|
73
|
+
session: Auth::Session
|
|
74
|
+
).returns(T.nilable(Webhook))
|
|
75
|
+
end
|
|
76
|
+
def find(
|
|
77
|
+
id:,
|
|
78
|
+
fields: nil,
|
|
79
|
+
session: ShopifyAPI::Context.active_session
|
|
80
|
+
)
|
|
81
|
+
result = base_find(
|
|
82
|
+
session: session,
|
|
83
|
+
ids: {id: id},
|
|
84
|
+
params: {fields: fields},
|
|
85
|
+
)
|
|
86
|
+
T.cast(result[0], T.nilable(Webhook))
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
sig do
|
|
90
|
+
params(
|
|
91
|
+
id: T.any(Integer, String),
|
|
92
|
+
session: Auth::Session
|
|
93
|
+
).returns(T.untyped)
|
|
94
|
+
end
|
|
95
|
+
def delete(
|
|
96
|
+
id:,
|
|
97
|
+
session: ShopifyAPI::Context.active_session
|
|
98
|
+
)
|
|
99
|
+
request(
|
|
100
|
+
http_method: :delete,
|
|
101
|
+
operation: :delete,
|
|
102
|
+
session: session,
|
|
103
|
+
ids: {id: id},
|
|
104
|
+
params: {},
|
|
105
|
+
)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
sig do
|
|
109
|
+
params(
|
|
110
|
+
address: T.untyped,
|
|
111
|
+
created_at_max: T.untyped,
|
|
112
|
+
created_at_min: T.untyped,
|
|
113
|
+
fields: T.untyped,
|
|
114
|
+
limit: T.untyped,
|
|
115
|
+
since_id: T.untyped,
|
|
116
|
+
topic: T.untyped,
|
|
117
|
+
updated_at_min: T.untyped,
|
|
118
|
+
updated_at_max: T.untyped,
|
|
119
|
+
session: Auth::Session,
|
|
120
|
+
kwargs: T.untyped
|
|
121
|
+
).returns(T::Array[Webhook])
|
|
122
|
+
end
|
|
123
|
+
def all(
|
|
124
|
+
address: nil,
|
|
125
|
+
created_at_max: nil,
|
|
126
|
+
created_at_min: nil,
|
|
127
|
+
fields: nil,
|
|
128
|
+
limit: nil,
|
|
129
|
+
since_id: nil,
|
|
130
|
+
topic: nil,
|
|
131
|
+
updated_at_min: nil,
|
|
132
|
+
updated_at_max: nil,
|
|
133
|
+
session: ShopifyAPI::Context.active_session,
|
|
134
|
+
**kwargs
|
|
135
|
+
)
|
|
136
|
+
response = base_find(
|
|
137
|
+
session: session,
|
|
138
|
+
ids: {},
|
|
139
|
+
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,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
T.cast(response, T::Array[Webhook])
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
sig do
|
|
146
|
+
params(
|
|
147
|
+
address: T.untyped,
|
|
148
|
+
topic: T.untyped,
|
|
149
|
+
session: Auth::Session,
|
|
150
|
+
kwargs: T.untyped
|
|
151
|
+
).returns(T.untyped)
|
|
152
|
+
end
|
|
153
|
+
def count(
|
|
154
|
+
address: nil,
|
|
155
|
+
topic: nil,
|
|
156
|
+
session: ShopifyAPI::Context.active_session,
|
|
157
|
+
**kwargs
|
|
158
|
+
)
|
|
159
|
+
request(
|
|
160
|
+
http_method: :get,
|
|
161
|
+
operation: :count,
|
|
162
|
+
session: session,
|
|
163
|
+
ids: {},
|
|
164
|
+
params: {address: address, topic: topic}.merge(kwargs).compact,
|
|
165
|
+
body: {},
|
|
166
|
+
entity: nil,
|
|
167
|
+
)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
end
|
|
173
|
+
end
|
data/lib/shopify_api/version.rb
CHANGED
|
@@ -13,7 +13,7 @@ module ShopifyAPI
|
|
|
13
13
|
sig { returns(String) }
|
|
14
14
|
attr_reader :topic
|
|
15
15
|
|
|
16
|
-
sig { returns(T.nilable(
|
|
16
|
+
sig { returns(T.nilable(WebhookHandler)) }
|
|
17
17
|
attr_reader :handler
|
|
18
18
|
|
|
19
19
|
sig { returns(T.nilable(T::Array[String])) }
|
|
@@ -26,13 +26,13 @@ module ShopifyAPI
|
|
|
26
26
|
attr_reader :filter
|
|
27
27
|
|
|
28
28
|
sig do
|
|
29
|
-
params(topic: String, path: String, handler: T.nilable(
|
|
29
|
+
params(topic: String, path: String, handler: T.nilable(WebhookHandler),
|
|
30
30
|
fields: T.nilable(T.any(String, T::Array[String])),
|
|
31
31
|
metafield_namespaces: T.nilable(T::Array[String]),
|
|
32
32
|
filter: T.nilable(String)).void
|
|
33
33
|
end
|
|
34
34
|
def initialize(topic:, path:, handler: nil, fields: nil, metafield_namespaces: nil, filter: nil)
|
|
35
|
-
@topic = T.let(topic.gsub(
|
|
35
|
+
@topic = T.let(topic.gsub(%r{/|\.}, "_").upcase, String)
|
|
36
36
|
@path = path
|
|
37
37
|
@handler = handler
|
|
38
38
|
fields_array = fields.is_a?(String) ? fields.split(FIELDS_DELIMITER) : fields
|
|
@@ -17,7 +17,7 @@ module ShopifyAPI
|
|
|
17
17
|
params(topic: String,
|
|
18
18
|
delivery_method: Symbol,
|
|
19
19
|
path: String,
|
|
20
|
-
handler: T.nilable(
|
|
20
|
+
handler: T.nilable(WebhookHandler),
|
|
21
21
|
fields: T.nilable(T.any(String, T::Array[String])),
|
|
22
22
|
filter: T.nilable(String),
|
|
23
23
|
metafield_namespaces: T.nilable(T::Array[String])).void
|
|
@@ -195,18 +195,8 @@ module ShopifyAPI
|
|
|
195
195
|
raise Errors::NoWebhookHandler, "No webhook handler found for topic: #{request.topic}."
|
|
196
196
|
end
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
body: request.parsed_body, api_version: request.api_version, webhook_id: request.webhook_id))
|
|
201
|
-
else
|
|
202
|
-
handler.handle(topic: request.topic, shop: request.shop, body: request.parsed_body)
|
|
203
|
-
warning = <<~WARNING
|
|
204
|
-
DEPRECATED: Use ShopifyAPI::Webhooks::WebhookHandler#handle instead of
|
|
205
|
-
ShopifyAPI::Webhooks::Handler#handle.
|
|
206
|
-
https://github.com/Shopify/shopify-api-ruby/blob/main/docs/usage/webhooks.md#create-a-webhook-handler
|
|
207
|
-
WARNING
|
|
208
|
-
ShopifyAPI::Logger.deprecated(warning, "15.0.0")
|
|
209
|
-
end
|
|
198
|
+
handler.handle(data: WebhookMetadata.new(topic: request.topic, shop: request.shop,
|
|
199
|
+
body: request.parsed_body, api_version: request.api_version, webhook_id: request.webhook_id))
|
|
210
200
|
end
|
|
211
201
|
|
|
212
202
|
private
|
|
@@ -11,18 +11,6 @@ module ShopifyAPI
|
|
|
11
11
|
const :webhook_id, String
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
module Handler
|
|
15
|
-
include Kernel
|
|
16
|
-
extend T::Sig
|
|
17
|
-
extend T::Helpers
|
|
18
|
-
interface!
|
|
19
|
-
|
|
20
|
-
sig do
|
|
21
|
-
abstract.params(topic: String, shop: String, body: T::Hash[String, T.untyped]).void
|
|
22
|
-
end
|
|
23
|
-
def handle(topic:, shop:, body:); end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
14
|
module WebhookHandler
|
|
27
15
|
include Kernel
|
|
28
16
|
extend T::Sig
|
data/lib/shopify_api.rb
CHANGED
|
@@ -16,7 +16,7 @@ require "concurrent"
|
|
|
16
16
|
|
|
17
17
|
require_relative "shopify_api/inflector"
|
|
18
18
|
require_relative "shopify_api/admin_versions"
|
|
19
|
-
require_relative "shopify_api/webhooks/
|
|
19
|
+
require_relative "shopify_api/webhooks/webhook_handler"
|
|
20
20
|
|
|
21
21
|
loader = Zeitwerk::Loader.for_gem
|
|
22
22
|
loader.inflector = ShopifyAPI::Inflector.new(__FILE__)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shopify_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 15.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify
|
|
@@ -186,6 +186,7 @@ files:
|
|
|
186
186
|
- LICENSE
|
|
187
187
|
- README.md
|
|
188
188
|
- RELEASING.md
|
|
189
|
+
- REST_RESOURCES.md
|
|
189
190
|
- ROADMAP.md
|
|
190
191
|
- Rakefile
|
|
191
192
|
- SECURITY.md
|
|
@@ -1283,6 +1284,78 @@ files:
|
|
|
1283
1284
|
- lib/shopify_api/rest/resources/2025_07/user.rb
|
|
1284
1285
|
- lib/shopify_api/rest/resources/2025_07/variant.rb
|
|
1285
1286
|
- lib/shopify_api/rest/resources/2025_07/webhook.rb
|
|
1287
|
+
- lib/shopify_api/rest/resources/2025_10/abandoned_checkout.rb
|
|
1288
|
+
- lib/shopify_api/rest/resources/2025_10/access_scope.rb
|
|
1289
|
+
- lib/shopify_api/rest/resources/2025_10/apple_pay_certificate.rb
|
|
1290
|
+
- lib/shopify_api/rest/resources/2025_10/application_charge.rb
|
|
1291
|
+
- lib/shopify_api/rest/resources/2025_10/application_credit.rb
|
|
1292
|
+
- lib/shopify_api/rest/resources/2025_10/article.rb
|
|
1293
|
+
- lib/shopify_api/rest/resources/2025_10/asset.rb
|
|
1294
|
+
- lib/shopify_api/rest/resources/2025_10/assigned_fulfillment_order.rb
|
|
1295
|
+
- lib/shopify_api/rest/resources/2025_10/balance.rb
|
|
1296
|
+
- lib/shopify_api/rest/resources/2025_10/blog.rb
|
|
1297
|
+
- lib/shopify_api/rest/resources/2025_10/cancellation_request.rb
|
|
1298
|
+
- lib/shopify_api/rest/resources/2025_10/carrier_service.rb
|
|
1299
|
+
- lib/shopify_api/rest/resources/2025_10/checkout.rb
|
|
1300
|
+
- lib/shopify_api/rest/resources/2025_10/collect.rb
|
|
1301
|
+
- lib/shopify_api/rest/resources/2025_10/collection.rb
|
|
1302
|
+
- lib/shopify_api/rest/resources/2025_10/collection_listing.rb
|
|
1303
|
+
- lib/shopify_api/rest/resources/2025_10/comment.rb
|
|
1304
|
+
- lib/shopify_api/rest/resources/2025_10/country.rb
|
|
1305
|
+
- lib/shopify_api/rest/resources/2025_10/currency.rb
|
|
1306
|
+
- lib/shopify_api/rest/resources/2025_10/custom_collection.rb
|
|
1307
|
+
- lib/shopify_api/rest/resources/2025_10/customer.rb
|
|
1308
|
+
- lib/shopify_api/rest/resources/2025_10/deprecated_api_call.rb
|
|
1309
|
+
- lib/shopify_api/rest/resources/2025_10/discount_code.rb
|
|
1310
|
+
- lib/shopify_api/rest/resources/2025_10/dispute.rb
|
|
1311
|
+
- lib/shopify_api/rest/resources/2025_10/dispute_evidence.rb
|
|
1312
|
+
- lib/shopify_api/rest/resources/2025_10/dispute_file_upload.rb
|
|
1313
|
+
- lib/shopify_api/rest/resources/2025_10/draft_order.rb
|
|
1314
|
+
- lib/shopify_api/rest/resources/2025_10/event.rb
|
|
1315
|
+
- lib/shopify_api/rest/resources/2025_10/fulfillment.rb
|
|
1316
|
+
- lib/shopify_api/rest/resources/2025_10/fulfillment_event.rb
|
|
1317
|
+
- lib/shopify_api/rest/resources/2025_10/fulfillment_order.rb
|
|
1318
|
+
- lib/shopify_api/rest/resources/2025_10/fulfillment_request.rb
|
|
1319
|
+
- lib/shopify_api/rest/resources/2025_10/fulfillment_service.rb
|
|
1320
|
+
- lib/shopify_api/rest/resources/2025_10/gift_card.rb
|
|
1321
|
+
- lib/shopify_api/rest/resources/2025_10/gift_card_adjustment.rb
|
|
1322
|
+
- lib/shopify_api/rest/resources/2025_10/image.rb
|
|
1323
|
+
- lib/shopify_api/rest/resources/2025_10/inventory_item.rb
|
|
1324
|
+
- lib/shopify_api/rest/resources/2025_10/inventory_level.rb
|
|
1325
|
+
- lib/shopify_api/rest/resources/2025_10/location.rb
|
|
1326
|
+
- lib/shopify_api/rest/resources/2025_10/locations_for_move.rb
|
|
1327
|
+
- lib/shopify_api/rest/resources/2025_10/marketing_event.rb
|
|
1328
|
+
- lib/shopify_api/rest/resources/2025_10/metafield.rb
|
|
1329
|
+
- lib/shopify_api/rest/resources/2025_10/mobile_platform_application.rb
|
|
1330
|
+
- lib/shopify_api/rest/resources/2025_10/order.rb
|
|
1331
|
+
- lib/shopify_api/rest/resources/2025_10/order_risk.rb
|
|
1332
|
+
- lib/shopify_api/rest/resources/2025_10/page.rb
|
|
1333
|
+
- lib/shopify_api/rest/resources/2025_10/payment.rb
|
|
1334
|
+
- lib/shopify_api/rest/resources/2025_10/payment_gateway.rb
|
|
1335
|
+
- lib/shopify_api/rest/resources/2025_10/payment_transaction.rb
|
|
1336
|
+
- lib/shopify_api/rest/resources/2025_10/payout.rb
|
|
1337
|
+
- lib/shopify_api/rest/resources/2025_10/policy.rb
|
|
1338
|
+
- lib/shopify_api/rest/resources/2025_10/price_rule.rb
|
|
1339
|
+
- lib/shopify_api/rest/resources/2025_10/product.rb
|
|
1340
|
+
- lib/shopify_api/rest/resources/2025_10/product_listing.rb
|
|
1341
|
+
- lib/shopify_api/rest/resources/2025_10/product_resource_feedback.rb
|
|
1342
|
+
- lib/shopify_api/rest/resources/2025_10/province.rb
|
|
1343
|
+
- lib/shopify_api/rest/resources/2025_10/recurring_application_charge.rb
|
|
1344
|
+
- lib/shopify_api/rest/resources/2025_10/redirect.rb
|
|
1345
|
+
- lib/shopify_api/rest/resources/2025_10/refund.rb
|
|
1346
|
+
- lib/shopify_api/rest/resources/2025_10/resource_feedback.rb
|
|
1347
|
+
- lib/shopify_api/rest/resources/2025_10/script_tag.rb
|
|
1348
|
+
- lib/shopify_api/rest/resources/2025_10/shipping_zone.rb
|
|
1349
|
+
- lib/shopify_api/rest/resources/2025_10/shop.rb
|
|
1350
|
+
- lib/shopify_api/rest/resources/2025_10/smart_collection.rb
|
|
1351
|
+
- lib/shopify_api/rest/resources/2025_10/storefront_access_token.rb
|
|
1352
|
+
- lib/shopify_api/rest/resources/2025_10/tender_transaction.rb
|
|
1353
|
+
- lib/shopify_api/rest/resources/2025_10/theme.rb
|
|
1354
|
+
- lib/shopify_api/rest/resources/2025_10/transaction.rb
|
|
1355
|
+
- lib/shopify_api/rest/resources/2025_10/usage_charge.rb
|
|
1356
|
+
- lib/shopify_api/rest/resources/2025_10/user.rb
|
|
1357
|
+
- lib/shopify_api/rest/resources/2025_10/variant.rb
|
|
1358
|
+
- lib/shopify_api/rest/resources/2025_10/webhook.rb
|
|
1286
1359
|
- lib/shopify_api/utils/attributes_comparator.rb
|
|
1287
1360
|
- lib/shopify_api/utils/graphql_proxy.rb
|
|
1288
1361
|
- lib/shopify_api/utils/hmac_validator.rb
|
|
@@ -1290,7 +1363,6 @@ files:
|
|
|
1290
1363
|
- lib/shopify_api/utils/session_utils.rb
|
|
1291
1364
|
- lib/shopify_api/utils/verifiable_query.rb
|
|
1292
1365
|
- lib/shopify_api/version.rb
|
|
1293
|
-
- lib/shopify_api/webhooks/handler.rb
|
|
1294
1366
|
- lib/shopify_api/webhooks/register_result.rb
|
|
1295
1367
|
- lib/shopify_api/webhooks/registration.rb
|
|
1296
1368
|
- lib/shopify_api/webhooks/registrations/event_bridge.rb
|
|
@@ -1298,6 +1370,7 @@ files:
|
|
|
1298
1370
|
- lib/shopify_api/webhooks/registrations/pub_sub.rb
|
|
1299
1371
|
- lib/shopify_api/webhooks/registry.rb
|
|
1300
1372
|
- lib/shopify_api/webhooks/request.rb
|
|
1373
|
+
- lib/shopify_api/webhooks/webhook_handler.rb
|
|
1301
1374
|
- service.yml
|
|
1302
1375
|
- shipit.rubygems.yml
|
|
1303
1376
|
- shopify_api.gemspec
|
|
@@ -1375,7 +1448,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1375
1448
|
- !ruby/object:Gem::Version
|
|
1376
1449
|
version: '0'
|
|
1377
1450
|
requirements: []
|
|
1378
|
-
rubygems_version: 3.7.
|
|
1451
|
+
rubygems_version: 3.7.2
|
|
1379
1452
|
specification_version: 4
|
|
1380
1453
|
summary: The gem for accessing the Shopify API
|
|
1381
1454
|
test_files: []
|