class BestbuyApi::Request
Public Class Methods
new(api_key, path)
click to toggle source
# File lib/bestbuy_api/request.rb, line 9 def initialize(api_key, path) raise MissingApiKeyError, 'API Key is not defined' if api_key.empty? @path = path @options = { apiKey: api_key, format: 'json' } end
Public Instance Methods
find(params)
click to toggle source
# File lib/bestbuy_api/request.rb, line 16 def find(params) result = self.class.get("/#{@path}#{params[:slug]}", query: @options.merge(params[:query])) code = result.code raise RequestError, "#{code} Request Error: #{result.request.last_uri}" if code != 200 Response.new(result, @path) end