Class: Square::Types::CatalogQuery

Inherits:
Internal::Types::Model show all
Defined in:
lib/square/types/catalog_query.rb

Overview

A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the ‘SearchCatalogObjects` endpoint.

Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). Any combination of the following types may be used together:

  • [exact_query](entity:CatalogQueryExact)

  • [prefix_query](entity:CatalogQueryPrefix)

  • [range_query](entity:CatalogQueryRange)

  • [sorted_attribute_query](entity:CatalogQuerySortedAttribute)

  • [text_query](entity:CatalogQueryText)

All other query types cannot be combined with any others.

When a query filter is based on an attribute, the attribute must be searchable. Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters.

Searchable attribute and objects queryable by searchable attributes:

  • ‘name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`,

‘CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue`

  • ‘description`: `CatalogItem`, `CatalogItemOptionValue`

  • ‘abbreviation`: `CatalogItem`

  • ‘upc`: `CatalogItemVariation`

  • ‘sku`: `CatalogItemVariation`

  • ‘caption`: `CatalogImage`

  • ‘display_name`: `CatalogItemOption`

For example, to search for [CatalogItem](entity:CatalogItem) objects by searchable attributes, you can use the ‘“name”`, `“description”`, or `“abbreviation”` attribute in an applicable query filter.

Method Summary

Methods inherited from Internal::Types::Model

#==, ===, add_extra_field_definition, coerce, extra_fields, field, fields, #initialize, #inspect, literal, load, #to_h

Methods included from Internal::Types::Type

#coerce, #strict!, #strict?

Methods included from Internal::JSON::Serializable

#dump, #load

Constructor Details

This class inherits a constructor from Square::Internal::Types::Model