Skip to content

Commit 7a24f6a

Browse files
committed
Fixes test cases
1 parent a6dca30 commit 7a24f6a

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

lib/shopify_api/rest/resources/2025_01/fulfillment.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
2525
@name = T.let(nil, T.nilable(String))
2626
@notify_customer = T.let(nil, T.nilable(T::Boolean))
2727
@order_id = T.let(nil, T.nilable(Integer))
28-
@origin_address = T.let(nil, T.nilable(T::Array[T.untyped]))
28+
@origin_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
2929
@receipt = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
3030
@service = T.let(nil, T.nilable(String))
3131
@shipment_status = T.let(nil, T.nilable(String))

lib/shopify_api/rest/resources/2025_01/mobile_platform_application.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
2020

2121
@app_clip_application_id = T.let(nil, T.nilable(String))
2222
@application_id = T.let(nil, T.nilable(String))
23-
@enabled_app_clips = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
23+
@enabled_app_clips = T.let(nil, T.nilable(T::Boolean))
2424
@enabled_shared_webcredentials = T.let(nil, T.nilable(T::Boolean))
2525
@enabled_universal_or_app_links = T.let(nil, T.nilable(T::Boolean))
2626
@id = T.let(nil, T.nilable(Integer))
@@ -44,7 +44,7 @@ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
4444
attr_reader :app_clip_application_id
4545
sig { returns(T.nilable(String)) }
4646
attr_reader :application_id
47-
sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
47+
sig { returns(T.nilable(T::Boolean)) }
4848
attr_reader :enabled_app_clips
4949
sig { returns(T.nilable(T::Boolean)) }
5050
attr_reader :enabled_shared_webcredentials

test/rest/2025_01/webhook_test.rb

+29-29
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
require "shopify_api"
1515
require_relative "../../test_helper"
1616

17-
class Webhook202410Test < Test::Unit::TestCase
17+
class Webhook202501Test < Test::Unit::TestCase
1818
def setup
1919
super
2020

2121
test_session = ShopifyAPI::Auth::Session.new(id: "id", shop: "test-shop.myshopify.io", access_token: "this_is_a_test_token")
2222
ShopifyAPI::Context.activate_session(test_session)
23-
modify_context(api_version: "2024-10")
23+
modify_context(api_version: "2025-01")
2424
end
2525

2626
def teardown
@@ -33,16 +33,16 @@ def teardown
3333
void
3434
end
3535
def test_1()
36-
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json")
36+
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json")
3737
.with(
3838
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json"},
3939
body: {}
4040
)
41-
.to_return(status: 200, body: JSON.generate({"webhooks" => [{"id" => 4759306, "address" => "https://apple.com", "topic" => "orders/create", "created_at" => "2024-10-02T08:59:11-05:00", "updated_at" => "2024-10-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}, {"id" => 892403750, "address" => "https://example.org/fully_loaded_1", "topic" => "orders/cancelled", "created_at" => "2021-12-01T05:23:43-05:00", "updated_at" => "2021-12-01T05:23:43-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}, {"id" => 901431826, "address" => "https://apple.com/uninstall", "topic" => "app/uninstalled", "created_at" => "2024-10-02T08:59:11-05:00", "updated_at" => "2024-10-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}, {"id" => 1014196360, "address" => "https://example.org/app_uninstalled", "topic" => "app/uninstalled", "created_at" => "2024-10-02T08:59:11-05:00", "updated_at" => "2024-10-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}]}), headers: {})
41+
.to_return(status: 200, body: JSON.generate({"webhooks" => [{"id" => 4759306, "address" => "https://apple.com", "topic" => "orders/create", "created_at" => "2025-01-02T08:59:11-05:00", "updated_at" => "2025-01-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}, {"id" => 892403750, "address" => "https://example.org/fully_loaded_1", "topic" => "orders/cancelled", "created_at" => "2021-12-01T05:23:43-05:00", "updated_at" => "2021-12-01T05:23:43-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}, {"id" => 901431826, "address" => "https://apple.com/uninstall", "topic" => "app/uninstalled", "created_at" => "2025-01-02T08:59:11-05:00", "updated_at" => "2025-01-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}, {"id" => 1014196360, "address" => "https://example.org/app_uninstalled", "topic" => "app/uninstalled", "created_at" => "2025-01-02T08:59:11-05:00", "updated_at" => "2025-01-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}]}), headers: {})
4242

4343
response = ShopifyAPI::Webhook.all
4444

45-
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json")
45+
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json")
4646

4747
response = response.first if response.respond_to?(:first)
4848

@@ -63,18 +63,18 @@ def test_1()
6363
void
6464
end
6565
def test_2()
66-
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json?since_id=901431826")
66+
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json?since_id=901431826")
6767
.with(
6868
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json"},
6969
body: {}
7070
)
71-
.to_return(status: 200, body: JSON.generate({"webhooks" => [{"id" => 1014196360, "address" => "https://example.org/app_uninstalled", "topic" => "app/uninstalled", "created_at" => "2024-10-02T08:59:11-05:00", "updated_at" => "2024-10-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}]}), headers: {})
71+
.to_return(status: 200, body: JSON.generate({"webhooks" => [{"id" => 1014196360, "address" => "https://example.org/app_uninstalled", "topic" => "app/uninstalled", "created_at" => "2025-01-02T08:59:11-05:00", "updated_at" => "2025-01-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}]}), headers: {})
7272

7373
response = ShopifyAPI::Webhook.all(
7474
since_id: "901431826",
7575
)
7676

77-
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json?since_id=901431826")
77+
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json?since_id=901431826")
7878

7979
response = response.first if response.respond_to?(:first)
8080

@@ -95,20 +95,20 @@ def test_2()
9595
void
9696
end
9797
def test_3()
98-
stub_request(:post, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json")
98+
stub_request(:post, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json")
9999
.with(
100100
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json", "Content-Type"=>"application/json"},
101101
body: { "webhook" => hash_including({"address" => "pubsub://projectName:topicName", "topic" => "customers/update", "format" => "json"}) }
102102
)
103-
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 6883828544, "address" => "pubsub://projectName:topicName", "topic" => "customers/update", "created_at" => "2024-10-02T09:06:06-05:00", "updated_at" => "2024-10-02T09:06:06-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
103+
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 6883828544, "address" => "pubsub://projectName:topicName", "topic" => "customers/update", "created_at" => "2025-01-02T09:06:06-05:00", "updated_at" => "2025-01-02T09:06:06-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
104104

105105
response = webhook = ShopifyAPI::Webhook.new
106106
webhook.address = "pubsub://projectName:topicName"
107107
webhook.topic = "customers/update"
108108
webhook.format = "json"
109109
webhook.save
110110

111-
assert_requested(:post, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json")
111+
assert_requested(:post, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json")
112112

113113
response = response.first if response.respond_to?(:first)
114114

@@ -129,20 +129,20 @@ def test_3()
129129
void
130130
end
131131
def test_4()
132-
stub_request(:post, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json")
132+
stub_request(:post, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json")
133133
.with(
134134
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json", "Content-Type"=>"application/json"},
135135
body: { "webhook" => hash_including({"address" => "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/755357713/example-event-source", "topic" => "customers/update", "format" => "json"}) }
136136
)
137-
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 6883828534, "address" => "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/755357713/example-event-source", "topic" => "customers/update", "created_at" => "2024-10-02T09:05:41-05:00", "updated_at" => "2024-10-02T09:05:41-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
137+
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 6883828534, "address" => "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/755357713/example-event-source", "topic" => "customers/update", "created_at" => "2025-01-02T09:05:41-05:00", "updated_at" => "2025-01-02T09:05:41-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
138138

139139
response = webhook = ShopifyAPI::Webhook.new
140140
webhook.address = "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/755357713/example-event-source"
141141
webhook.topic = "customers/update"
142142
webhook.format = "json"
143143
webhook.save
144144

145-
assert_requested(:post, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json")
145+
assert_requested(:post, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json")
146146

147147
response = response.first if response.respond_to?(:first)
148148

@@ -163,12 +163,12 @@ def test_4()
163163
void
164164
end
165165
def test_5()
166-
stub_request(:post, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json")
166+
stub_request(:post, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json")
167167
.with(
168168
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json", "Content-Type"=>"application/json"},
169169
body: { "webhook" => hash_including({"topic" => "orders/create", "address" => "https://example.hostname.com/", "format" => "json", "fields" => ["id", "note"]}) }
170170
)
171-
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 6883828554, "address" => "https://example.hostname.com/", "topic" => "orders/create", "created_at" => "2024-10-02T09:06:30-05:00", "updated_at" => "2024-10-02T09:06:30-05:00", "format" => "json", "fields" => ["id", "note"], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
171+
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 6883828554, "address" => "https://example.hostname.com/", "topic" => "orders/create", "created_at" => "2025-01-02T09:06:30-05:00", "updated_at" => "2025-01-02T09:06:30-05:00", "format" => "json", "fields" => ["id", "note"], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
172172

173173
response = webhook = ShopifyAPI::Webhook.new
174174
webhook.topic = "orders/create"
@@ -180,7 +180,7 @@ def test_5()
180180
]
181181
webhook.save
182182

183-
assert_requested(:post, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks.json")
183+
assert_requested(:post, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks.json")
184184

185185
response = response.first if response.respond_to?(:first)
186186

@@ -201,7 +201,7 @@ def test_5()
201201
void
202202
end
203203
def test_6()
204-
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/count.json?topic=orders%2Fcreate")
204+
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/count.json?topic=orders%2Fcreate")
205205
.with(
206206
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json"},
207207
body: {}
@@ -212,7 +212,7 @@ def test_6()
212212
topic: "orders/create",
213213
)
214214

215-
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/count.json?topic=orders%2Fcreate")
215+
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/count.json?topic=orders%2Fcreate")
216216

217217
response = response.first if response.respond_to?(:first)
218218

@@ -233,7 +233,7 @@ def test_6()
233233
void
234234
end
235235
def test_7()
236-
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/count.json")
236+
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/count.json")
237237
.with(
238238
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json"},
239239
body: {}
@@ -242,7 +242,7 @@ def test_7()
242242

243243
response = ShopifyAPI::Webhook.count
244244

245-
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/count.json")
245+
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/count.json")
246246

247247
response = response.first if response.respond_to?(:first)
248248

@@ -263,18 +263,18 @@ def test_7()
263263
void
264264
end
265265
def test_8()
266-
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/4759306.json")
266+
stub_request(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/4759306.json")
267267
.with(
268268
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json"},
269269
body: {}
270270
)
271-
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 4759306, "address" => "https://apple.com", "topic" => "orders/create", "created_at" => "2024-10-02T08:59:11-05:00", "updated_at" => "2024-10-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
271+
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 4759306, "address" => "https://apple.com", "topic" => "orders/create", "created_at" => "2025-01-02T08:59:11-05:00", "updated_at" => "2025-01-02T08:59:11-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
272272

273273
response = ShopifyAPI::Webhook.find(
274274
id: 4759306,
275275
)
276276

277-
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/4759306.json")
277+
assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/4759306.json")
278278

279279
response = response.first if response.respond_to?(:first)
280280

@@ -295,19 +295,19 @@ def test_8()
295295
void
296296
end
297297
def test_9()
298-
stub_request(:put, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/4759306.json")
298+
stub_request(:put, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/4759306.json")
299299
.with(
300300
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json", "Content-Type"=>"application/json"},
301301
body: { "webhook" => hash_including({"address" => "https://somewhere-else.com/"}) }
302302
)
303-
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 4759306, "address" => "https://somewhere-else.com/", "topic" => "orders/create", "created_at" => "2024-10-02T08:59:11-05:00", "updated_at" => "2024-10-02T09:08:15-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
303+
.to_return(status: 200, body: JSON.generate({"webhook" => {"id" => 4759306, "address" => "https://somewhere-else.com/", "topic" => "orders/create", "created_at" => "2025-01-02T08:59:11-05:00", "updated_at" => "2025-01-02T09:08:15-05:00", "format" => "json", "fields" => [], "metafield_namespaces" => [], "api_version" => "unstable", "private_metafield_namespaces" => []}}), headers: {})
304304

305305
response = webhook = ShopifyAPI::Webhook.new
306306
webhook.id = 4759306
307307
webhook.address = "https://somewhere-else.com/"
308308
webhook.save
309309

310-
assert_requested(:put, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/4759306.json")
310+
assert_requested(:put, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/4759306.json")
311311

312312
response = response.first if response.respond_to?(:first)
313313

@@ -328,7 +328,7 @@ def test_9()
328328
void
329329
end
330330
def test_10()
331-
stub_request(:delete, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/4759306.json")
331+
stub_request(:delete, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/4759306.json")
332332
.with(
333333
headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json"},
334334
body: {}
@@ -339,7 +339,7 @@ def test_10()
339339
id: 4759306,
340340
)
341341

342-
assert_requested(:delete, "https://test-shop.myshopify.io/admin/api/2024-10/webhooks/4759306.json")
342+
assert_requested(:delete, "https://test-shop.myshopify.io/admin/api/2025-01/webhooks/4759306.json")
343343

344344
response = response.first if response.respond_to?(:first)
345345

0 commit comments

Comments
 (0)