popshops 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/LICENSE +22 -0
  2. data/README.rdoc +31 -0
  3. data/lib/popshops.rb +43 -0
  4. metadata +76 -0
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2010 Matt Mueller
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,31 @@
1
+ == popshops
2
+
3
+ Ruby gem for accessing the popshops API (http://www.popshops.com)
4
+
5
+ == install
6
+
7
+ gem install popshops
8
+
9
+ == example
10
+
11
+ require 'rubygems'
12
+ require 'popshops'
13
+
14
+ popshops = Popshops.new('YOUR_API_KEY')
15
+
16
+ popshops.product_search(:query => {:catalog_key => 'CATALOG_KEY', :keywords => 'books'})
17
+ popshops.merchant_sarch(:query => {:catalog_key => 'CATALOG_KEY', :merchant_type_id => 12})
18
+ popshops.merchant_types
19
+ popshops.networks
20
+ popshops.deal_search(:query => {:catalog_key => 'CATALOG_KEY', :keywords => 'books'})
21
+ popshops.deal_types
22
+
23
+ == notes
24
+
25
+ You can pass any valid option from the API documentation (see http://popshops.com/faq/affiliate-xml-api-reference/) inside of the query hash as presented above.
26
+
27
+ Results will be returned using Hashie (http://github.com/intridea/hashie) so that you can navigate through the api results in a bit more ruby-esque way.
28
+
29
+ == license
30
+
31
+ MIT license - see LICENSE for more details.
data/lib/popshops.rb ADDED
@@ -0,0 +1,43 @@
1
+ require 'rubygems'
2
+ require 'httparty'
3
+ require 'hashie'
4
+
5
+ class Popshops
6
+ include HTTParty
7
+ base_uri 'api.popshops.com/v2'
8
+
9
+ def initialize(api_key)
10
+ @api_key = api_key
11
+ end
12
+
13
+ def product_search(options={})
14
+ results = self.class.get("/#{@api_key}/products.xml", options)
15
+ Hashie::Mash.new(results['search_results'])
16
+ end
17
+
18
+ def merchant_search(options={})
19
+ results = self.class.get("/#{@api_key}/merchants.xml", options)
20
+ Hashie::Mash.new(results['merchants'])
21
+ end
22
+
23
+ def merchant_types
24
+ results = self.class.get("/#{@api_key}/merchant_types.xml")
25
+ Hashie::Mash.new(results['merchant_types'])
26
+ end
27
+
28
+ def networks
29
+ results = self.class.get("/#{@api_key}/networks.xml")
30
+ Hashie::Mash.new(results['networks'])
31
+ end
32
+
33
+ def deal_search(options={})
34
+ results = self.class.get("/#{@api_key}/deals.xml", options)
35
+ Hashie::Mash.new(results['search_results'])
36
+ end
37
+
38
+ def deal_types
39
+ results = self.class.get("/#{@api_key}/deal_types.xml")
40
+ Hashie::Mash.new(results['deal_types'])
41
+ end
42
+
43
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: popshops
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Matt Mueller
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-17 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httparty
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hashie
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description: The popshops gem provides convenient methods to access all of the popshops.com API features. It uses hashie to return results that can be used in a more ruby-esque manner than with a plain hash.
36
+ email: muellermr@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - LICENSE
45
+ - README.rdoc
46
+ - lib/popshops.rb
47
+ has_rdoc: true
48
+ homepage: http://github.com/mattmueller/Popshops
49
+ licenses: []
50
+
51
+ post_install_message:
52
+ rdoc_options: []
53
+
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.3.5
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Ruby gem for accessing the popshops API
75
+ test_files: []
76
+