class Delivery::Client
Attributes
base_uri[RW]
client_id[RW]
Public Class Methods
new(client_id, options={})
click to toggle source
# File lib/delivery/client.rb, line 11 def initialize(client_id, options={}) @client_id = client_id options[:base_uri] ||= 'https://api.delivery.com' @base_uri = options[:base_uri] end
Public Instance Methods
hours(id, options={})
click to toggle source
# File lib/delivery/client.rb, line 39 def hours(id, options={}) options = {query: {client_id: client_id}.merge(options)} response = self.class.get("#{base_uri}/merchant/#{id}/hours", options) Hashie::Mash.new(JSON.parse(response.body)) end
Also aliased as: merchant_hours
info(id, options={})
click to toggle source
# File lib/delivery/client.rb, line 25 def info(id, options={}) options = {query: {client_id: client_id}.merge(options)} response = self.class.get("#{base_uri}/merchant/#{id}", options) Hashie::Mash.new(JSON.parse(response.body)) end
Also aliased as: merchant_info
search(address, options={})
click to toggle source
# File lib/delivery/client.rb, line 18 def search(address, options={}) options = {query: {client_id: client_id, address: address}.merge(options)} response = self.class.get("#{base_uri}/merchant/search/delivery", options) Hashie::Mash.new(JSON.parse(response.body)) end
Also aliased as: merchant_search