Skip to content
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

Customer.search returns HTTPResponse instead of array of Customer object #1361

Open
5 tasks done
softwaregravy opened this issue Feb 1, 2025 · 0 comments
Open
5 tasks done

Comments

@softwaregravy
Copy link

softwaregravy commented Feb 1, 2025

Issue summary

Before opening this issue, I have:

  • Upgraded to the latest version of the package
    • shopify_api version: 14.8.0
    • Ruby version: 3.4.1
    • Operating system: OS X
  • Set log_level: :debug in 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

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:[email protected]")
 =>
#<ShopifyAPI::Clients::HttpResponse:0x000000012c452bd0
 @api_call_limit={request_count: 1, bucket_size: 40},
 @body=
  {"customers" =>
    [{"id" => 7209130524768,
      "email" => "[email protected]",

So as a client I have to do this:

 ShopifyAPI::Customer.search(query: "email:[email protected]").body["customers"].map { ShopifyAPI::Customer.new(from_hash: it) }

Debug logs

// Paste any relevant logs here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant