Skip to content

Commit

Permalink
Fix CustomerAddress.all
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmwebs committed Aug 8, 2023
1 parent 77ab36c commit 23ca3dd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/shopify_api/rest/resources/2023_07/customer_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ def json_body_name()
"address"
end

sig do
returns(String)
end
def json_response_body_name()
"addresses"
end

sig do
params(
id: T.any(Integer, String),
Expand Down
8 changes: 8 additions & 0 deletions test/rest/2023_07/customer_address_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ def test_1()
)

assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2023-07/customers/207119551/addresses.json?limit=1")
assert_equal(1, response.count)

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

# Assert attributes are correctly typed preventing Sorbet errors downstream
if response.respond_to?(:original_state)
response&.original_state&.each do |key, value|
next if key == :default

begin
response.send(key)
rescue TypeError => error
Expand All @@ -78,12 +81,15 @@ def test_2()
)

assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2023-07/customers/207119551/addresses.json")
assert_equal(1, response.count)

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

# Assert attributes are correctly typed preventing Sorbet errors downstream
if response.respond_to?(:original_state)
response&.original_state&.each do |key, value|
next if key == :default

begin
response.send(key)
rescue TypeError => error
Expand Down Expand Up @@ -117,6 +123,8 @@ def test_3()
# Assert attributes are correctly typed preventing Sorbet errors downstream
if response.respond_to?(:original_state)
response&.original_state&.each do |key, value|
next if key == :default

begin
response.send(key)
rescue TypeError => error
Expand Down

0 comments on commit 23ca3dd

Please sign in to comment.