Class: BestBuy::Products

Inherits:
BaseAPI show all
Includes:
Conditions
Defined in:
lib/best_buy/products.rb

Constant Summary collapse

PRODUCTS_API =
'/v1/products'
CONDITIONS =
[
  CategoryCondition,
  MinPriceCondition,
  MaxPriceCondition,
  NewCondition,
  PreOwnedCondition,
  RefurbishedCondition
].freeze

Constants inherited from BaseAPI

BaseAPI::BASE_URL

Instance Attribute Summary

Attributes inherited from BaseAPI

#api_key

Instance Method Summary collapse

Methods inherited from BaseAPI

#get_all, #initialize

Constructor Details

This class inherits a constructor from BestBuy::BaseAPI

Instance Method Details

#get_by(conditions) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/best_buy/products.rb', line 17

def get_by(conditions)
  add_search_conditions_to_query(conditions.except(:pagination))

  pagination = conditions[:pagination] || {}

  get_all(search_query: search_query_builder.build, pagination: pagination)
end