Popshops
A lightweight Ruby wrapper for communicating with the latest PopShops API (v3).
Installation
Add this line to your application's Gemfile:
gem 'popshops-api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install popshops-api
Usage
require 'popshops'
as needed
Initialize the Popshops API
popshops = Popshops::Api.new('api_key_value', 'catalog_key_value' )
Options:
- api_key: Required
- catalog_key: Optional, but needed in many calls.
- private_api_key: Optional, if your account supports it.
- format: Optional. Can be :json or :xml. Defaults to :json
You can always switch popshops catalogs by reinitializing popshops, or utilizing the following method:
popshops.use_catalog('new_catalog_key')
You're now ready to start receiving data from Popshops. All of the PopShops API methods are available as:
- find_products
- find_coupons_and_deals
- find_merchants
- list_categories
- list_merchant_types
- list_deal_types
- list_networks
- list_countries
- list_keywords
Product calls are used to get all information related to products, and the specific merchant offers for those products. One thing to note is that only offers will have affiliate links associated with them, the product itself will not have an affiliate URL.
To lookup all products in your catalog, call:
popshops.find_products
To search for products by keyword, call:
popshops.find_products(keyword: 'ipad')
More details to come for other sections.
Contributing
- Fork it ( http://github.com/beneggett/popshops-api/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request