vacuum 0.2.0.pre.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +77 -39
  2. data/lib/vacuum/version.rb +1 -1
  3. metadata +15 -15
data/README.md CHANGED
@@ -2,76 +2,112 @@
2
2
 
3
3
  [![travis] [1]] [2]
4
4
 
5
- Vacuum is a Ruby wrapper to [various Amazon Web Services (AWS) APIs] [3].
5
+ Vacuum is a thin Ruby wrapper to various [Amazon Web Services (AWS) APIs] [3].
6
6
 
7
7
  ![vacuum] [4]
8
8
 
9
+ ## Installation
10
+
11
+ ```sh
12
+ gem install vacuum
13
+ ```
14
+
9
15
  ## Amazon Product Advertising API
10
16
 
11
- Vacuum knows the [Amazon Product Advertising API] [5] [inside out] [6].
17
+ Vacuum knows the [Amazon Product Advertising API] [5] inside out.
18
+
19
+ Set up a request:
12
20
 
13
21
  ```ruby
14
- request = Vacuum.new(:product_advertising) do |config|
15
- config.locale 'US'
22
+ req = Vacuum.new :product_advertising
16
23
 
24
+ req.configure do |config|
17
25
  config.key 'key'
18
26
  config.secret 'secret'
19
27
  config.tag 'tag'
20
28
  end
29
+ ```
30
+
31
+ Build and run a search:
32
+
33
+ ```ruby
34
+ req.build operation: 'ItemSearch',
35
+ search_index: 'Books',
36
+ keywords: 'Deleuze'
37
+ res = req.get
38
+ ```
39
+
40
+ Or accomplish the same search less verbosely:
41
+
42
+ ```ruby
43
+ res = req.search :books, 'Deleuze'
44
+ ```
45
+
46
+ The response wraps a [Nokogiri] [6] document:
47
+
48
+ ```ruby
49
+ res.xml
50
+ ```
21
51
 
22
- # Use an alternative Faraday adapter.
23
- # request.connection do |builder|
24
- # builder.adapter :typhoeus
25
- # end
26
-
27
- # A barebone search request.
28
- request.build operation: 'ItemSearch',
29
- search_index: 'Books',
30
- keywords: 'Deleuze'
31
- response = request.get
32
-
33
- # A less verbose search.
34
- request.search :books, 'Deleuze'
35
-
36
- if response.valid?
37
- # response.code
38
- # response.body
39
- # response.errors
40
- # response.xml # The Nokogiri XML doc
41
- # response.to_hash
42
- response.find('Item') do |item|
43
- p item['ASIN']
52
+ And lets you drop down to any node:
53
+
54
+ ```ruby
55
+ if res.valid?
56
+ res.find('Item') do |item|
57
+ p item
44
58
  end
45
59
  end
46
60
  ```
61
+
62
+ You will find more examples [here] [7].
63
+
47
64
  ## Amazon Marketplace Web Services API
48
65
 
49
- The wrapper to the [Amazon Marketplace Web Services API] [7] is a
66
+ The wrapper to the [Amazon Marketplace Web Services API] [8] is a
50
67
  work-in-progress.
51
68
 
69
+ Set up a request to the Products API:
70
+
52
71
  ```ruby
53
- request = Vacuum.new(:mws_products) do |config|
72
+ req = Vacuum.new(:mws_products) do |config|
54
73
  config.locale 'US'
55
-
56
74
  config.key 'key'
57
75
  config.secret 'secret'
58
76
  config.marketplace 'marketplace'
59
77
  config.seller 'seller'
60
78
  end
79
+ ```
80
+
81
+ Get the lowest offers for a single ASIN:
61
82
 
62
- request.build 'Action' => 'GetLowestOfferListingsForASIN',
63
- 'ASINList.ASIN.1' => '0231081596'
64
- offers = request.get.find 'GetLowestOfferListingsForASINResult'
83
+ ```ruby
84
+ req.build 'Action' => 'GetLowestOfferListingsForASIN',
85
+ 'ASINList.ASIN.1' => '0231081596'
86
+ offers = req.get.find 'GetLowestOfferListingsForASINResult'
65
87
  ```
66
88
 
89
+ I will at some point throw in some syntactic sugar for common operations.
90
+
67
91
  ## Other AWS APIs
68
92
 
69
- Vacuum should work with EC2, S3, IAM, SimpleDB, SQS, SNS, SES, ELB, CW, and so
70
- on. Implement and send a pull request.
93
+ Vacuum should work with all AWS libraries, including EC2, S3, IAM, SimpleDB,
94
+ SQS, SNS, SES, and ELB. Most of these already have popular Ruby
95
+ implementations. If you need to implement one using Vacuum, please fork and
96
+ send a pull request when done.
97
+
98
+ ## HTTP Client Adapters
99
+
100
+ You can use any of the alternative adapters [Faraday] [9] supports:
101
+
102
+ ```ruby
103
+ req.connection do |builder|
104
+ builder.adapter :em_synchrony
105
+ end
106
+ ```
71
107
 
72
- # Addendum
108
+ ## Addendum
73
109
 
74
- ![vacuums] [8]
110
+ ![vacuums] [10]
75
111
 
76
112
  > Workers queuing to crawl AWS.
77
113
 
@@ -80,6 +116,8 @@ on. Implement and send a pull request.
80
116
  [3]: http://aws.amazon.com/
81
117
  [4]: http://f.cl.ly/items/2k2X0e2u0G3k1c260D2u/vacuum.png
82
118
  [5]: https://affiliate-program.amazon.co.uk/gp/advertising/api/detail/main.html
83
- [6]: https://github.com/hakanensari/vacuum/blob/master/examples/product_advertising/
84
- [7]: https://developer.amazonservices.com/gp/mws/docs.html
85
- [8]: http://f.cl.ly/items/1Q3W372A0H3M0w2H1e0W/hoover.jpeg
119
+ [6]: http://nokogiri.org/
120
+ [7]: https://github.com/hakanensari/vacuum/blob/master/examples/product_advertising/
121
+ [8]: https://developer.amazonservices.com/gp/mws/docs.html
122
+ [9]: https://github.com/technoweenie/faraday
123
+ [10]: http://f.cl.ly/items/1Q3W372A0H3M0w2H1e0W/hoover.jpeg
@@ -1,3 +1,3 @@
1
1
  module Vacuum
2
- VERSION = '0.2.0.pre.1'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vacuum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre.1
5
- prerelease: 6
4
+ version: 0.2.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Hakan Ensari
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-02 00:00:00.000000000 Z
12
+ date: 2012-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70260273152380 !ruby/object:Gem::Requirement
16
+ requirement: &70130080587320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.9'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70260273152380
24
+ version_requirements: *70130080587320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70260273201100 !ruby/object:Gem::Requirement
27
+ requirement: &70130080586800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.9'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70260273201100
35
+ version_requirements: *70130080586800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: addressable
38
- requirement: &70260273200640 !ruby/object:Gem::Requirement
38
+ requirement: &70130080586300 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.2'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70260273200640
46
+ version_requirements: *70130080586300
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: faraday
49
- requirement: &70260273200160 !ruby/object:Gem::Requirement
49
+ requirement: &70130080585780 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.7.6
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70260273200160
57
+ version_requirements: *70130080585780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: nokogiri
60
- requirement: &70260273199640 !ruby/object:Gem::Requirement
60
+ requirement: &70130080585140 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '1.5'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70260273199640
68
+ version_requirements: *70130080585140
69
69
  description: ! 'Vacuum is a wrapper to various Amazon Web Services (AWS) APIs, including
70
70
 
71
71
  Product Advertising and Marketplace Web Services (MWS).
@@ -128,9 +128,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
- - - ! '>'
131
+ - - ! '>='
132
132
  - !ruby/object:Gem::Version
133
- version: 1.3.1
133
+ version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
136
  rubygems_version: 1.8.11