vacuum 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +58 -24
- data/lib/vacuum.rb +5 -0
- data/lib/vacuum/locale.rb +51 -42
- data/lib/vacuum/matcher.rb +16 -1
- data/lib/vacuum/operation.rb +75 -0
- data/lib/vacuum/request.rb +32 -79
- data/lib/vacuum/response.rb +1 -1
- data/lib/vacuum/version.rb +1 -1
- data/test/cassettes/vacuum.yml +834 -253
- data/test/integration_helper.rb +0 -2
- data/test/locales.yml +16 -16
- data/test/locales.yml.example +8 -0
- data/test/vacuum/test_locale.rb +22 -14
- data/test/vacuum/test_operation.rb +31 -0
- data/test/vacuum/test_request.rb +40 -7
- metadata +8 -5
data/test/integration_helper.rb
CHANGED
data/test/locales.yml
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
:access_key: AKIAIWQTVHVWCQA5THXQ
|
|
3
3
|
:secret_key: VOhSIqIY1wF5selhhJYJGVnIET9k5q0J8QjTX38i
|
|
4
4
|
:partner_tag: adabo00-20
|
|
5
|
-
- :marketplace: DE
|
|
6
|
-
:access_key: AKIAIRMMTDVD7JUI65HA
|
|
7
|
-
:secret_key: jYLxHKjNSnh+t+5kgr2Lx7TZIVNKFwO59MrQDAXC
|
|
8
|
-
:partner_tag: partly0e-21
|
|
9
5
|
- :marketplace: ES
|
|
10
|
-
:access_key:
|
|
11
|
-
:secret_key:
|
|
12
|
-
:partner_tag:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
:access_key: AKIAJJF26BJLZLSJLFBQ
|
|
7
|
+
:secret_key: txz+ESbb9Gzw6adcdKtIsLGOP0POFxtP0GHDw1ul
|
|
8
|
+
:partner_tag: adabo00-21
|
|
9
|
+
- :marketplace: DE
|
|
10
|
+
:access_key: AKIAJGN5UNM43HHV5MZA
|
|
11
|
+
:secret_key: ZdccSATM45MN9mjRTTw89mee5VbFoTRd9hYI2sMV
|
|
12
|
+
:partner_tag: adabo23-21
|
|
13
|
+
- :marketplace: FR
|
|
14
|
+
:access_key: AKIAJDNYBNMN23YBFK3A
|
|
15
|
+
:secret_key: hMet2Z4I5tgT6M8mHlGBGUajGyAZN/h2DPFb9z3j
|
|
16
|
+
:partner_tag: adabo-21
|
|
17
|
+
- :marketplace: IT
|
|
18
|
+
:access_key: AKIAJVBAH4XJHK6YF46Q
|
|
19
|
+
:secret_key: aCb2AeLxjNf4KM+Fxx2+ZOw0ftOnnMkuWqVR1kuE
|
|
20
|
+
:partner_tag: adabo0c-21
|
|
21
21
|
- :marketplace: GB
|
|
22
22
|
:access_key: AKIAJPAXMP45DOQJPHJQ
|
|
23
23
|
:secret_key: feZKxFjRGLtmEO3JXpmCGdDaCPA7AHiVFBhQ/fkf
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
- :marketplace: US
|
|
26
26
|
:access_key: AKIAIWQTVHVWCQA5THXQ
|
|
27
27
|
:secret_key: VOhSIqIY1wF5selhhJYJGVnIET9k5q0J8QjTX38i
|
|
28
|
-
:partner_tag:
|
|
28
|
+
:partner_tag: adabo-20
|
data/test/locales.yml.example
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
:access_key: access_key
|
|
11
11
|
:secret_key: secret_key
|
|
12
12
|
:partner_tag: partner_tag
|
|
13
|
+
- :marketplace: FR
|
|
14
|
+
:access_key: access_key
|
|
15
|
+
:secret_key: secret_key
|
|
16
|
+
:partner_tag: partner_tag
|
|
17
|
+
- :marketplace: IT
|
|
18
|
+
:access_key: access_key
|
|
19
|
+
:secret_key: secret_key
|
|
20
|
+
:partner_tag: partner_tag
|
|
13
21
|
- :marketplace: GB
|
|
14
22
|
:access_key: access_key
|
|
15
23
|
:secret_key: secret_key
|
data/test/vacuum/test_locale.rb
CHANGED
|
@@ -5,31 +5,39 @@ require 'vacuum/locale'
|
|
|
5
5
|
|
|
6
6
|
module Vacuum
|
|
7
7
|
class TestLocale < Minitest::Test
|
|
8
|
-
def
|
|
9
|
-
|
|
8
|
+
def test_host
|
|
9
|
+
locale = Locale.new(:us, credentials)
|
|
10
|
+
assert locale.host
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
def
|
|
13
|
-
|
|
13
|
+
def test_region
|
|
14
|
+
locale = Locale.new(:us, credentials)
|
|
15
|
+
assert locale.region
|
|
14
16
|
end
|
|
15
17
|
|
|
16
|
-
def
|
|
17
|
-
|
|
18
|
+
def test_partner_type_default
|
|
19
|
+
locale = Locale.new(:us, credentials)
|
|
20
|
+
assert locale.partner_type
|
|
18
21
|
end
|
|
19
22
|
|
|
20
|
-
def
|
|
23
|
+
def test_upcased_marketplace
|
|
24
|
+
Locale.new('US', credentials) # does not raise
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_uk
|
|
28
|
+
Locale.new(:uk, credentials) # does not raise
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_not_found
|
|
21
32
|
assert_raises Locale::NotFound do
|
|
22
|
-
Locale.
|
|
33
|
+
Locale.new(:foo, credentials)
|
|
23
34
|
end
|
|
24
35
|
end
|
|
25
36
|
|
|
26
|
-
|
|
27
|
-
assert_equal 'https://webservices.amazon.com/paapi5/foo',
|
|
28
|
-
Locale.find('US').build_url('Foo')
|
|
29
|
-
end
|
|
37
|
+
private
|
|
30
38
|
|
|
31
|
-
def
|
|
32
|
-
|
|
39
|
+
def credentials
|
|
40
|
+
{ access_key: '123', secret_key: '123', partner_tag: 'xyz-20' }
|
|
33
41
|
end
|
|
34
42
|
end
|
|
35
43
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
require 'vacuum/locale'
|
|
5
|
+
require 'vacuum/operation'
|
|
6
|
+
|
|
7
|
+
module Vacuum
|
|
8
|
+
class TestOperation < Minitest::Test
|
|
9
|
+
def setup
|
|
10
|
+
@operation = Operation.new('Action', params: { foo: 1 }, locale: locale)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_body
|
|
14
|
+
assert @operation.body
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_url
|
|
18
|
+
assert @operation.url
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_headers
|
|
22
|
+
assert @operation.headers
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def locale
|
|
28
|
+
Locale.new(:us, access_key: '123', secret_key: '123', partner_tag: 'xyz')
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/test/vacuum/test_request.rb
CHANGED
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
require 'integration_helper'
|
|
4
4
|
|
|
5
5
|
module Vacuum
|
|
6
|
-
class
|
|
6
|
+
class TestRequest < IntegrationTest
|
|
7
7
|
def test_get_browse_nodes
|
|
8
8
|
requests.each do |request|
|
|
9
9
|
response = request.get_browse_nodes(browse_node_ids: ['3045'])
|
|
10
|
-
|
|
10
|
+
assert_equal 200, response.status
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def test_get_items
|
|
15
15
|
requests.each do |request|
|
|
16
16
|
response = request.get_items(item_ids: ['B07212L4G2'])
|
|
17
|
-
|
|
17
|
+
assert_equal 200, response.status
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def test_get_items_with_all_resources
|
|
22
22
|
requests.each do |request|
|
|
23
23
|
response = request.get_items(item_ids: 'B07212L4G2',
|
|
24
|
-
resources:
|
|
24
|
+
resources: ALL_RESOURCES)
|
|
25
25
|
item = response.dig('ItemsResult', 'Items').first
|
|
26
26
|
assert item.key?('BrowseNodeInfo')
|
|
27
27
|
end
|
|
@@ -30,15 +30,48 @@ module Vacuum
|
|
|
30
30
|
def test_get_variations
|
|
31
31
|
requests.each do |request|
|
|
32
32
|
response = request.get_variations(asin: 'B07212L4G2')
|
|
33
|
-
|
|
33
|
+
assert_equal 200, response.status
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def test_search_items
|
|
38
38
|
requests.each do |request|
|
|
39
39
|
response = request.search_items(keywords: 'Harry Potter')
|
|
40
|
-
|
|
40
|
+
assert_equal 200, response.status
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
|
+
|
|
44
|
+
def test_persistent
|
|
45
|
+
request = requests.sample
|
|
46
|
+
refute request.client.persistent?
|
|
47
|
+
request.persistent
|
|
48
|
+
assert request.client.persistent?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
ALL_RESOURCES =
|
|
52
|
+
%w[BrowseNodeInfo.BrowseNodes BrowseNodeInfo.BrowseNodes.Ancestor
|
|
53
|
+
BrowseNodeInfo.BrowseNodes.SalesRank BrowseNodeInfo.WebsiteSalesRank
|
|
54
|
+
Images.Primary.Small Images.Primary.Medium Images.Primary.Large
|
|
55
|
+
Images.Variants.Small Images.Variants.Medium Images.Variants.Large
|
|
56
|
+
ItemInfo.ByLineInfo ItemInfo.Classifications ItemInfo.ContentInfo
|
|
57
|
+
ItemInfo.ContentRating ItemInfo.ExternalIds ItemInfo.Features
|
|
58
|
+
ItemInfo.ManufactureInfo ItemInfo.ProductInfo ItemInfo.TechnicalInfo
|
|
59
|
+
ItemInfo.Title ItemInfo.TradeInInfo
|
|
60
|
+
Offers.Listings.Availability.MaxOrderQuantity
|
|
61
|
+
Offers.Listings.Availability.Message
|
|
62
|
+
Offers.Listings.Availability.MinOrderQuantity
|
|
63
|
+
Offers.Listings.Availability.Type Offers.Listings.Condition
|
|
64
|
+
Offers.Listings.Condition.SubCondition
|
|
65
|
+
Offers.Listings.DeliveryInfo.IsAmazonFulfilled
|
|
66
|
+
Offers.Listings.DeliveryInfo.IsFreeShippingEligible
|
|
67
|
+
Offers.Listings.DeliveryInfo.IsPrimeEligible
|
|
68
|
+
Offers.Listings.IsBuyBoxWinner Offers.Listings.LoyaltyPoints.Points
|
|
69
|
+
Offers.Listings.MerchantInfo Offers.Listings.Price
|
|
70
|
+
Offers.Listings.ProgramEligibility.IsPrimeExclusive
|
|
71
|
+
Offers.Listings.ProgramEligibility.IsPrimePantry
|
|
72
|
+
Offers.Listings.Promotions Offers.Listings.SavingBasis
|
|
73
|
+
Offers.Summaries.HighestPrice Offers.Summaries.LowestPrice
|
|
74
|
+
Offers.Summaries.OfferCount ParentASIN].freeze
|
|
75
|
+
private_constant :ALL_RESOURCES
|
|
43
76
|
end
|
|
44
77
|
end
|
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: 3.
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hakan Ensari
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-10
|
|
11
|
+
date: 2019-11-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sigv4
|
|
@@ -25,19 +25,19 @@ dependencies:
|
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '1.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: http
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '4.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: '
|
|
40
|
+
version: '4.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: minitest
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -134,6 +134,7 @@ files:
|
|
|
134
134
|
- lib/vacuum.rb
|
|
135
135
|
- lib/vacuum/locale.rb
|
|
136
136
|
- lib/vacuum/matcher.rb
|
|
137
|
+
- lib/vacuum/operation.rb
|
|
137
138
|
- lib/vacuum/request.rb
|
|
138
139
|
- lib/vacuum/response.rb
|
|
139
140
|
- lib/vacuum/version.rb
|
|
@@ -143,6 +144,7 @@ files:
|
|
|
143
144
|
- test/locales.yml
|
|
144
145
|
- test/locales.yml.example
|
|
145
146
|
- test/vacuum/test_locale.rb
|
|
147
|
+
- test/vacuum/test_operation.rb
|
|
146
148
|
- test/vacuum/test_request.rb
|
|
147
149
|
- test/vacuum/test_response.rb
|
|
148
150
|
homepage: https://github.com/hakanensari/vacuum
|
|
@@ -169,6 +171,7 @@ signing_key:
|
|
|
169
171
|
specification_version: 4
|
|
170
172
|
summary: Amazon Product Advertising in Ruby
|
|
171
173
|
test_files:
|
|
174
|
+
- test/vacuum/test_operation.rb
|
|
172
175
|
- test/vacuum/test_request.rb
|
|
173
176
|
- test/vacuum/test_response.rb
|
|
174
177
|
- test/vacuum/test_locale.rb
|