Skip to content

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

@softwaregravy

Description

@softwaregravy

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: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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions