Skip to content

Square::Inventory::Client doesn't use Square::Client base_url #218

@davidmtmdesign

Description

@davidmtmdesign

Steps to reproduce:

  1. Create a Square::Client specifying the base_url: client = Square::Client.new(token:, base_url: Square::Environment::SANDBOX)
  2. Call an inventory method: client.inventory.get(catalog_object_id:)
  3. The client tries to connect to Host: connect.squareup.com

The problem is that when creating the request it defaults to Square::Environment::PRODUCTION when request_options[:base_url] is not set:

Square::Internal::JSON::Request.new(
  base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
  method: "GET",
  path: "v2/inventory/#{params[:catalog_object_id]}",
  query: _query
)

A work around is to set base_url in request_options: client.inventory.get(request_options: { base_url: Square::Environment::SANDBOX }, catalog_object_id:)

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