class Popshops::Api
Attributes
api_key[RW]
catalog_key[RW]
format[RW]
private_api_key[RW]
Public Class Methods
new(api_key, catalog_key = nil, private_api_key = nil, format = :json)
click to toggle source
# File lib/popshops.rb, line 12 def initialize(api_key, catalog_key = nil, private_api_key = nil, format = :json) @api_key = api_key @catalog_key = catalog_key @private_api_key = private_api_key @format = format end
Public Instance Methods
find_coupons_and_deals(options={})
click to toggle source
# File lib/popshops.rb, line 27 def find_coupons_and_deals(options={}) Hashie::Mash.new( self.class.get "/deals.#{@format}", query: merged(options) ) end
find_merchants(options={})
click to toggle source
# File lib/popshops.rb, line 31 def find_merchants(options={}) Hashie::Mash.new( self.class.get "/merchants.#{@format}", query: merged(options) ) end
find_products(options={})
click to toggle source
# File lib/popshops.rb, line 23 def find_products(options={}) Hashie::Mash.new( self.class.get "/products.#{@format}", query: merged(options) ) end
list_categories(options={})
click to toggle source
# File lib/popshops.rb, line 35 def list_categories(options={}) Hashie::Mash.new( self.class.get "/categories.#{@format}", query: merged(options) ) end
list_countries(options={})
click to toggle source
# File lib/popshops.rb, line 51 def list_countries(options={}) Hashie::Mash.new( self.class.get "/countries.#{@format}", query: merged(options) ) end
list_deal_types(options={})
click to toggle source
# File lib/popshops.rb, line 43 def list_deal_types(options={}) Hashie::Mash.new( self.class.get "/deal_types.#{@format}", query: merged(options) ) end
list_keywords(options={})
click to toggle source
# File lib/popshops.rb, line 55 def list_keywords(options={}) Hashie::Mash.new( self.class.get "/keywords.#{@format}", query: merged(options) ) end
list_merchant_types(options={})
click to toggle source
# File lib/popshops.rb, line 39 def list_merchant_types(options={}) Hashie::Mash.new( self.class.get "/merchant_types.#{@format}", query: merged(options) ) end
list_networks(options={})
click to toggle source
# File lib/popshops.rb, line 47 def list_networks(options={}) Hashie::Mash.new( self.class.get "/networks.#{@format}", query: merged(options) ) end
use_catalog(catalog_key)
click to toggle source
# File lib/popshops.rb, line 19 def use_catalog(catalog_key) @catalog_key = catalog_key end
Private Instance Methods
merged(options)
click to toggle source
This is used in all calls to merge our account & catalog parameters into the options queries
# File lib/popshops.rb, line 61 def merged(options) { account: @api_key, catalog: @catalog_key}.merge(options) end