vacuum 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +4 -0
- data/lib/vacuum/request.rb +6 -6
- data/lib/vacuum/version.rb +1 -1
- data/test/test_integration.rb +2 -3
- data/test/test_vacuum.rb +2 -3
- metadata +22 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0a673fbb5abdaae748ad40500d5fc2712f2bc21
|
4
|
+
data.tar.gz: d5037349839a8fc734b3460a827b9584db0ad338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb0425bf241f4d92168b1014a80a2248467bde887d2f40f7c5a25e66c8d4a53b6bbd79fff42d441ddc0aa871f1f48287b144dda9aede133b99c907789e01d7a8
|
7
|
+
data.tar.gz: 5c13b763aa705fd1f22cc1db2906873d4bbbee0f63f7bd0739629a6ebb67dc03bbe79fcc1b1a9a4bcb840f5eb06daf20119b05d35508170630a5096c0198037f
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,10 @@ Vacuum is a fast, light-weight Ruby wrapper to the [Amazon Product Advertising A
|
|
5
5
|
|
6
6
|
![vacuum](http://f.cl.ly/items/2k2X0e2u0G3k1c260D2u/vacuum.png)
|
7
7
|
|
8
|
+
> Amazon is a $250 billion dollar company that reacts to you buying a vacuum by going THIS GUY LOVES BUYING VACUUMS HERE ARE SOME MORE VACUUMS
|
9
|
+
|
10
|
+
— [@kibblesmith](https://twitter.com/kibblesmith/status/724817086309142529)
|
11
|
+
|
8
12
|
## Usage
|
9
13
|
|
10
14
|
### Prerequisite
|
data/lib/vacuum/request.rb
CHANGED
@@ -6,9 +6,9 @@ module Vacuum
|
|
6
6
|
class Request
|
7
7
|
include Jeff
|
8
8
|
|
9
|
-
BadLocale
|
9
|
+
BadLocale = Class.new(ArgumentError)
|
10
10
|
|
11
|
-
LATEST_VERSION = '2013-08-01'
|
11
|
+
LATEST_VERSION = '2013-08-01'.freeze
|
12
12
|
|
13
13
|
HOSTS = {
|
14
14
|
'BR' => 'webservices.amazon.com.br',
|
@@ -25,7 +25,7 @@ module Vacuum
|
|
25
25
|
'MX' => 'webservices.amazon.com.mx'
|
26
26
|
}.freeze
|
27
27
|
|
28
|
-
OPERATIONS = %w
|
28
|
+
OPERATIONS = %w[
|
29
29
|
BrowseNodeLookup
|
30
30
|
CartAdd
|
31
31
|
CartClear
|
@@ -35,7 +35,7 @@ module Vacuum
|
|
35
35
|
ItemLookup
|
36
36
|
ItemSearch
|
37
37
|
SimilarityLookup
|
38
|
-
|
38
|
+
].freeze
|
39
39
|
|
40
40
|
params 'AssociateTag' => -> { associate_tag },
|
41
41
|
'Service' => 'AWSECommerceService',
|
@@ -53,8 +53,8 @@ module Vacuum
|
|
53
53
|
# Raises a Bad Locale error if locale is not valid.
|
54
54
|
def initialize(locale = 'US', secure = false)
|
55
55
|
locale = 'GB' if locale == 'UK'
|
56
|
-
host = HOSTS.fetch(locale) {
|
57
|
-
@aws_endpoint = "#{secure ? 'https' : 'http'
|
56
|
+
host = HOSTS.fetch(locale) { raise BadLocale }
|
57
|
+
@aws_endpoint = "#{secure ? 'https' : 'http'}://#{host}/onca/xml"
|
58
58
|
end
|
59
59
|
|
60
60
|
# Configure the Amazon Product Advertising API request.
|
data/lib/vacuum/version.rb
CHANGED
data/test/test_integration.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
|
-
require 'minitest/pride'
|
3
2
|
require 'vcr'
|
4
3
|
require_relative '../lib/vacuum'
|
5
4
|
|
@@ -28,7 +27,7 @@ class TestIntegration < Minitest::Test
|
|
28
27
|
# rubocop:disable AbcSize
|
29
28
|
def test_encoding_issues
|
30
29
|
params = { 'SearchIndex' => 'All', 'Keywords' => 'google' }
|
31
|
-
titles = %w
|
30
|
+
titles = %w[BR CA CN DE ES FR GB IN IT JP US MX].flat_map do |locale|
|
32
31
|
req = Vacuum.new(locale)
|
33
32
|
req.associate_tag = 'foo'
|
34
33
|
res = req.item_search(query: params)
|
@@ -39,6 +38,6 @@ class TestIntegration < Minitest::Test
|
|
39
38
|
|
40
39
|
# Newer JRuby now appears to return both US-ASCII and UTF-8, depending on
|
41
40
|
# whether the string has non-ASCII characters. MRI will only return latter.
|
42
|
-
assert
|
41
|
+
assert(encodings.any? { |encoding| encoding == 'UTF-8' })
|
43
42
|
end
|
44
43
|
end
|
data/test/test_vacuum.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
|
-
require 'minitest/pride'
|
3
2
|
require_relative '../lib/vacuum'
|
4
3
|
|
5
4
|
class TestVacuum < Minitest::Test
|
@@ -26,11 +25,11 @@ class TestVacuum < Minitest::Test
|
|
26
25
|
end
|
27
26
|
|
28
27
|
def test_accepts_uk_as_locale
|
29
|
-
Request.new(
|
28
|
+
Request.new('UK')
|
30
29
|
end
|
31
30
|
|
32
31
|
def test_accepts_mx_as_locale
|
33
|
-
Request.new(
|
32
|
+
Request.new('MX')
|
34
33
|
end
|
35
34
|
|
36
35
|
def test_fetches_parsable_response
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vacuum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeff
|
@@ -30,14 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.6.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: appraisal
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: minitest
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +81,7 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: rubocop
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
@@ -120,9 +134,9 @@ require_paths:
|
|
120
134
|
- lib
|
121
135
|
required_ruby_version: !ruby/object:Gem::Requirement
|
122
136
|
requirements:
|
123
|
-
- - "
|
137
|
+
- - ">"
|
124
138
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
139
|
+
version: '2.0'
|
126
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
141
|
requirements:
|
128
142
|
- - ">="
|
@@ -130,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
144
|
version: '0'
|
131
145
|
requirements: []
|
132
146
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.6.8
|
134
148
|
signing_key:
|
135
149
|
specification_version: 4
|
136
150
|
summary: Amazon Product Advertising in Ruby
|
@@ -138,4 +152,3 @@ test_files:
|
|
138
152
|
- test/cassettes/vacuum.yml
|
139
153
|
- test/test_integration.rb
|
140
154
|
- test/test_vacuum.rb
|
141
|
-
has_rdoc:
|