-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ShopifyAPI::CustomerAddress.all always returns an empty array #1018
Comments
Duplicate of #970 |
This issue also happens with ShopifyAPI::OrderRisk class. API return |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Not stale. |
And its still an issue, in previous versions of the gem! I just did some sleuthing and if you upgrade to 12.4.0 then it works fine. How nice would it be to have this out in the open instead of having to sleuth for hours.. ahh a boy can dream |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Not stale, bot sucks. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
not stale, bot still sucks |
Previously, when fetching `all` on CustomerAddress it would return an empty array. Two issues (Shopify#970, Shopify#1018) were opened outlining the problem. This PR adds `json_response_body_name` to the CustomerAddress class to properly fetch the results from the JSON. Two assertions have been added to the the tests as well.
Previously, when fetching `all` on CustomerAddress it would return an empty array. Two issues (Shopify#970, Shopify#1018) were opened outlining the problem. Initial attempt was to override `json_response_body_name` which worked for fetching arrays of results. It doesn't work for fetching individual results though. I wound up overriding `create_instances_from_response` for CustomerAddress. It isn't ideal but it does seem to behave correctly. Assertions have been added to the the tests as well.
We've got this on our plate for this sprint! Sorry this has taken so long :( |
Previously, when fetching `all` on CustomerAddress it would return an empty array. Two issues (Shopify#970, Shopify#1018) were opened outlining the problem. Initial attempt was to override `json_response_body_name` which worked for fetching arrays of results. It doesn't work for fetching individual results though. I wound up overriding `create_instances_from_response` for CustomerAddress. It isn't ideal but it does seem to behave correctly. Assertions have been added to the the tests as well.
Issue summary
ShopifyAPI::CustomerAddress.all always returns an empty array.
Expected behavior
It should return an array of CustomerAddress objects
Actual behavior
This happens because create_instance_from_response method is unable to create instances if normalized resource class name is different than parent attribute in API response. It tries to find normalized class_name inside response body, but it could not find it because response from API contains parent attribute
addresses
instead ofcustomer_addresses
. So the resource class should be namedShopifyAPI::Addresses
or API response should containcustomer_addresses
as parent attribute. This is same issue just with different resource - #992So this results as no objects created and returned an empty array.
Steps to reproduce the problem
ShopifyAPI::CustomerAddress.all(customer_id: customer_id)
Specifications
shopify_api
version: 11.1.02022-04
):@itissible/matrixify
The text was updated successfully, but these errors were encountered: