class TescoRb::Client

The main class to coordinate HTTP requests

Attributes

api_key[R]

Public Class Methods

new(api_key) click to toggle source
# File lib/tesco_rb/client.rb, line 13
def initialize(api_key)
  fail 'invalid API Key' unless api_key.is_a?(String) && api_key.length > 10
  @api_key = api_key
end

Public Instance Methods

default_options() click to toggle source
# File lib/tesco_rb/client.rb, line 34
def default_options
  { headers:
      { 'Ocp-Apim-Subscription-Key' => api_key } }
end
get(url, options = {}) click to toggle source
# File lib/tesco_rb/client.rb, line 30
def get(url, options = {})
  self.class.get(url, options.merge(default_options))
end
item(options = {}) click to toggle source
# File lib/tesco_rb/client.rb, line 22
def item(options = {})
  ItemRequester.new.create_representations(self, options)
end
store(options = {}) click to toggle source
# File lib/tesco_rb/client.rb, line 18
def store(options = {})
  StoreRequester.new.create_representations(self, options)
end