Best Buy API

Build Status

A Ruby wrapper for the Best Buy developer API.

Installation

Add this line to your application's Gemfile:

gem 'bestbuy_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bestbuy_api

Getting Started

Sign-up for a developer API Key at https://developer.bestbuy.com/

API Documentation

Documentation for the Best Buy API is located at bestbuyapis.github.io.

Usage

require 'bestbuy_api'

BestbuyApi.config.api_key = 'YourBestbuyApiKey'

product = BestbuyApi::Product.select(:sku, :name, :sale_price, :url, :image)
                             .where(keyword: 'iPhone')
                             .limit(10).page(1)
product.items.each do |item|
  item['sku']
end

Find products

product = BestbuyApi::Product.select(:sku, :name, :sale_price, :url, :image)
product.items

Find categories

category = BestbuyApi::Category.select(:id, :name, :subcategory_id, :subcategory_name)
category.items

Find stores

store = BestbuyApi::Store.select(:id, :city, :state, :postal_code)
store.items

Selecting Specific Fields

BestbuyApi::Product.select(category_id: 'abcat500')

Conditions

BestbuyApi::Product.where(category_id: 'abcat500')

Limit and Offset

BestbuyApi::Product.limit(20).page(2)

Pagination

product = BestbuyApi::Product.where(category_id: 'abcat500')
product.pagination or product.url

License

The gem is available as open source under the terms of the MIT License.