Customer.search returns HTTPResponse instead of array of Customer object
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start at the ShopifyAPI::Customer.search entry point and trace how its response is returned compared with other resource APIs. Reproduce the query shown in the issue and verify that the result is an array of Customer objects rather than an HttpResponse object.
Written by the indexing model from the issue text.
Description
Issue summary
Before opening this issue, I have:
- Upgraded to the latest version of the package
shopify_apiversion: 14.8.0- Ruby version: 3.4.1
- Operating system: OS X
- Set
log_level: :debugin my configuration, if applicable - Found a reliable way to reproduce the problem that indicates it's a problem with the package
- Looked for similar issues in this repository
- Checked that this isn't an issue with a Shopify API
- If it is, please create a post in the Shopify community forums or report it to Shopify Partner Support
When calling ShopifyAPI::Customer.search the result is an ShopifyAPI::Clients::HttpResponse object. This is pretty different than other API's, most (all?) of which seem to return resource objects
Expected behavior
Returned value should be an array of Customer Objects
Actual behavior
It's an HTTPResponse Object
Steps to reproduce the problem
Demonstrating a call:
3.4.1 :049 > ShopifyAPI::Customer.search(query: "email:tim@example.com")
=>
#<ShopifyAPI::Clients::HttpResponse:0x000000012c452bd0
@api_call_limit={request_count: 1, bucket_size: 40},
@body=
{"customers" =>
[{"id" => 7209130524768,
"email" => "tim@example.com",
So as a client I have to do this:
ShopifyAPI::Customer.search(query: "email:tim@example.com").body["customers"].map { ShopifyAPI::Customer.new(from_hash: it) }
Debug logs
// Paste any relevant logs here
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 484
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/shopify-api-ruby
-
devtools-gardener
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Shopify/shopify-api-ruby#1456 · 3 reactions ·
-
devtools-gardener
Difficulty 3/5 1-2 days Newbie friendliness 67/100
Shopify/shopify-api-ruby#1461 ·
-
automated
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Shopify/shopify-api-ruby#1460 ·
-
devtools-gardener
Difficulty 5/5 Over a week Newbie friendliness 35/100
Shopify/shopify-api-ruby#1455 ·
-
devtools-gardener
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Shopify/shopify-api-ruby#1453 ·
All issues in Shopify/shopify-api-ruby
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100