Class: Popshops
Instance Method Summary collapse
-
#activate_merchants(catalog_key, merchants) ⇒ Object
Activates merchants for the given catalog.
- #catalogs ⇒ Object
-
#deactivate_merchants(catalog_key, merchants) ⇒ Object
Deactivates merchants for the given catalog.
- #deal_search(options = {}) ⇒ Object
- #deal_types ⇒ Object
-
#initialize(api_key, private_api_key = nil) ⇒ Popshops
constructor
A new instance of Popshops.
- #merchant_search(options = {}) ⇒ Object
- #merchant_types ⇒ Object
- #networks ⇒ Object
- #product_search(options = {}) ⇒ Object
Constructor Details
#initialize(api_key, private_api_key = nil) ⇒ Popshops
Returns a new instance of Popshops.
9 10 11 12 |
# File 'lib/popshops.rb', line 9 def initialize(api_key, private_api_key = nil) @api_key = api_key @private_api_key = private_api_key end |
Instance Method Details
#activate_merchants(catalog_key, merchants) ⇒ Object
Activates merchants for the given catalog.
merchants can be either a string, an integer, or an array of ids.
52 53 54 55 |
# File 'lib/popshops.rb', line 52 def activate_merchants(catalog_key, merchants) results = self.class.post(catalog_update_url(catalog_key, merchants), :query => { :active => 1 }) Hashie::Mash.new(results['response']) end |
#catalogs ⇒ Object
44 45 46 47 |
# File 'lib/popshops.rb', line 44 def catalogs results = self.class.get("https://www.popshops.com/v2/#{@api_key}/catalogs/list.xml?private_api_key=#{@private_api_key}") Hashie::Mash.new(results['results']['catalogs']) end |
#deactivate_merchants(catalog_key, merchants) ⇒ Object
Deactivates merchants for the given catalog.
merchants can be either a string, an integer, or an array of ids.
60 61 62 63 |
# File 'lib/popshops.rb', line 60 def deactivate_merchants(catalog_key, merchants) results = self.class.post(catalog_update_url(catalog_key, merchants), :query => { :active => 0 }) Hashie::Mash.new(results['response']) end |
#deal_search(options = {}) ⇒ Object
34 35 36 37 |
# File 'lib/popshops.rb', line 34 def deal_search(={}) results = self.class.get("/#{@api_key}/deals.xml", ) Hashie::Mash.new(results['search_results']) end |
#deal_types ⇒ Object
39 40 41 42 |
# File 'lib/popshops.rb', line 39 def deal_types results = self.class.get("/#{@api_key}/deal_types.xml") Hashie::Mash.new(results['deal_types']) end |
#merchant_search(options = {}) ⇒ Object
19 20 21 22 |
# File 'lib/popshops.rb', line 19 def merchant_search(={}) results = self.class.get("/#{@api_key}/merchants.xml", ) Hashie::Mash.new(results['merchants']) end |
#merchant_types ⇒ Object
24 25 26 27 |
# File 'lib/popshops.rb', line 24 def merchant_types results = self.class.get("/#{@api_key}/merchant_types.xml") Hashie::Mash.new(results['merchant_types']) end |
#networks ⇒ Object
29 30 31 32 |
# File 'lib/popshops.rb', line 29 def networks results = self.class.get("/#{@api_key}/networks.xml") Hashie::Mash.new(results['networks']) end |
#product_search(options = {}) ⇒ Object
14 15 16 17 |
# File 'lib/popshops.rb', line 14 def product_search(={}) results = self.class.get("/#{@api_key}/products.xml", ) Hashie::Mash.new(results['search_results']) end |