vacuum 3.4.0 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vacuum/matcher.rb +2 -0
- data/lib/vacuum/request.rb +1 -17
- data/lib/vacuum/version.rb +1 -1
- data/test/integration/test_requests.rb +44 -1
- metadata +9 -14
- data/lib/vacuum/resource.rb +0 -62
- data/test/locales.yml +0 -28
- data/test/unit/test_resource.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61ab29cce33477553968b592986abbc5de22f4885945032313a08dc89174c5c4
|
4
|
+
data.tar.gz: 01b3fddbc4f06899df06c595ff28dc0f812cca8d1b8604771614a077129d4a99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0d2aeb0b372920cca1f68268fe91f80630ca7272e1a6dadb25677aacad9a6ae86fa3ec2056ec5419f3167c2871ed9ffaf4a37dc248b8d0bc50ce51599a08e9a
|
7
|
+
data.tar.gz: 423a1e7ccd04499c3df8a05dde1da3a25f691ef4d846f64bd59ac55af55f9783239efdd537881a0c460900cad326fdd4c50041e0ce7bb9233cd3c934861227ba
|
data/lib/vacuum/matcher.rb
CHANGED
data/lib/vacuum/request.rb
CHANGED
@@ -4,7 +4,6 @@ require 'http'
|
|
4
4
|
|
5
5
|
require 'vacuum/locale'
|
6
6
|
require 'vacuum/operation'
|
7
|
-
require 'vacuum/resource'
|
8
7
|
require 'vacuum/response'
|
9
8
|
|
10
9
|
module Vacuum
|
@@ -155,11 +154,6 @@ module Vacuum
|
|
155
154
|
|
156
155
|
private
|
157
156
|
|
158
|
-
def validate(params)
|
159
|
-
validate_keywords(params)
|
160
|
-
validate_resources(params)
|
161
|
-
end
|
162
|
-
|
163
157
|
def validate_keywords(params)
|
164
158
|
return unless params[:keywords]
|
165
159
|
return if params[:keywords].is_a?(String)
|
@@ -167,18 +161,8 @@ module Vacuum
|
|
167
161
|
raise ArgumentError, ':keyword argument expects a String'
|
168
162
|
end
|
169
163
|
|
170
|
-
def validate_resources(params)
|
171
|
-
return unless params[:resources]
|
172
|
-
|
173
|
-
raise ArgumentError, ':resources argument expects an Array' unless params[:resources].is_a?(Array)
|
174
|
-
|
175
|
-
params[:resources].each do |resource|
|
176
|
-
raise ArgumentError, "There is not such resource: #{resource}" unless Resource.valid?(resource)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
164
|
def request(operation_name, params)
|
181
|
-
|
165
|
+
validate_keywords(params)
|
182
166
|
@operation = Operation.new(operation_name, params: params, locale: locale)
|
183
167
|
response = client.headers(operation.headers)
|
184
168
|
.post(operation.url, body: operation.body)
|
data/lib/vacuum/version.rb
CHANGED
@@ -18,10 +18,53 @@ module Vacuum
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
RESOURCE_ALL = %w[BrowseNodeInfo.BrowseNodes
|
22
|
+
BrowseNodeInfo.BrowseNodes.Ancestor
|
23
|
+
BrowseNodeInfo.BrowseNodes.SalesRank
|
24
|
+
BrowseNodeInfo.WebsiteSalesRank
|
25
|
+
Images.Primary.Small
|
26
|
+
Images.Primary.Medium
|
27
|
+
Images.Primary.Large
|
28
|
+
Images.Variants.Small
|
29
|
+
Images.Variants.Medium
|
30
|
+
Images.Variants.Large
|
31
|
+
ItemInfo.ByLineInfo
|
32
|
+
ItemInfo.Classifications
|
33
|
+
ItemInfo.ContentInfo
|
34
|
+
ItemInfo.ContentRating
|
35
|
+
ItemInfo.ExternalIds
|
36
|
+
ItemInfo.Features
|
37
|
+
ItemInfo.ManufactureInfo
|
38
|
+
ItemInfo.ProductInfo
|
39
|
+
ItemInfo.TechnicalInfo
|
40
|
+
ItemInfo.Title
|
41
|
+
ItemInfo.TradeInInfo
|
42
|
+
Offers.Listings.Availability.MaxOrderQuantity
|
43
|
+
Offers.Listings.Availability.Message
|
44
|
+
Offers.Listings.Availability.MinOrderQuantity
|
45
|
+
Offers.Listings.Availability.Type
|
46
|
+
Offers.Listings.Condition
|
47
|
+
Offers.Listings.Condition.SubCondition
|
48
|
+
Offers.Listings.DeliveryInfo.IsAmazonFulfilled
|
49
|
+
Offers.Listings.DeliveryInfo.IsFreeShippingEligible
|
50
|
+
Offers.Listings.DeliveryInfo.IsPrimeEligible
|
51
|
+
Offers.Listings.IsBuyBoxWinner
|
52
|
+
Offers.Listings.LoyaltyPoints.Points
|
53
|
+
Offers.Listings.MerchantInfo
|
54
|
+
Offers.Listings.Price
|
55
|
+
Offers.Listings.ProgramEligibility.IsPrimeExclusive
|
56
|
+
Offers.Listings.ProgramEligibility.IsPrimePantry
|
57
|
+
Offers.Listings.Promotions
|
58
|
+
Offers.Listings.SavingBasis
|
59
|
+
Offers.Summaries.HighestPrice
|
60
|
+
Offers.Summaries.LowestPrice
|
61
|
+
Offers.Summaries.OfferCount
|
62
|
+
ParentASIN].freeze
|
63
|
+
|
21
64
|
def test_get_items_with_all_resources
|
22
65
|
requests.each do |request|
|
23
66
|
response = request.get_items(item_ids: 'B07212L4G2',
|
24
|
-
resources:
|
67
|
+
resources: RESOURCE_ALL)
|
25
68
|
assert_equal 200, response.status
|
26
69
|
item = response.dig('ItemsResult', 'Items').first
|
27
70
|
assert item.key?('BrowseNodeInfo')
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vacuum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
8
8
|
- Stanislav Katkov
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sigv4
|
@@ -152,7 +152,6 @@ files:
|
|
152
152
|
- lib/vacuum/matcher.rb
|
153
153
|
- lib/vacuum/operation.rb
|
154
154
|
- lib/vacuum/request.rb
|
155
|
-
- lib/vacuum/resource.rb
|
156
155
|
- lib/vacuum/response.rb
|
157
156
|
- lib/vacuum/version.rb
|
158
157
|
- test/cassettes/vacuum.yml
|
@@ -160,18 +159,16 @@ files:
|
|
160
159
|
- test/integration/test_requests.rb
|
161
160
|
- test/integration_helper.rb
|
162
161
|
- test/locales.rb
|
163
|
-
- test/locales.yml
|
164
162
|
- test/locales.yml.example
|
165
163
|
- test/unit/test_locale.rb
|
166
164
|
- test/unit/test_operation.rb
|
167
165
|
- test/unit/test_request.rb
|
168
|
-
- test/unit/test_resource.rb
|
169
166
|
- test/unit/test_response.rb
|
170
167
|
homepage: https://github.com/hakanensari/vacuum
|
171
168
|
licenses:
|
172
169
|
- MIT
|
173
170
|
metadata: {}
|
174
|
-
post_install_message:
|
171
|
+
post_install_message:
|
175
172
|
rdoc_options: []
|
176
173
|
require_paths:
|
177
174
|
- lib
|
@@ -187,19 +184,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
184
|
version: '0'
|
188
185
|
requirements: []
|
189
186
|
rubygems_version: 3.1.2
|
190
|
-
signing_key:
|
187
|
+
signing_key:
|
191
188
|
specification_version: 4
|
192
189
|
summary: Amazon Product Advertising in Ruby
|
193
190
|
test_files:
|
194
191
|
- test/unit/test_operation.rb
|
195
192
|
- test/unit/test_request.rb
|
196
|
-
- test/unit/test_resource.rb
|
197
|
-
- test/unit/test_response.rb
|
198
193
|
- test/unit/test_locale.rb
|
194
|
+
- test/unit/test_response.rb
|
199
195
|
- test/helper.rb
|
200
|
-
- test/
|
196
|
+
- test/locales.yml.example
|
201
197
|
- test/cassettes/vacuum.yml
|
202
|
-
- test/integration_helper.rb
|
203
198
|
- test/locales.rb
|
204
|
-
- test/
|
205
|
-
- test/
|
199
|
+
- test/integration_helper.rb
|
200
|
+
- test/integration/test_requests.rb
|
data/lib/vacuum/resource.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Vacuum
|
4
|
-
# Resources determine what information will be returned in the API response
|
5
|
-
#
|
6
|
-
# @see https://webservices.amazon.com/paapi5/documentation/resources.html
|
7
|
-
class Resource
|
8
|
-
ALL = %w[BrowseNodeInfo.BrowseNodes
|
9
|
-
BrowseNodeInfo.BrowseNodes.Ancestor
|
10
|
-
BrowseNodeInfo.BrowseNodes.SalesRank
|
11
|
-
BrowseNodeInfo.WebsiteSalesRank
|
12
|
-
Images.Primary.Small
|
13
|
-
Images.Primary.Medium
|
14
|
-
Images.Primary.Large
|
15
|
-
Images.Variants.Small
|
16
|
-
Images.Variants.Medium
|
17
|
-
Images.Variants.Large
|
18
|
-
ItemInfo.ByLineInfo
|
19
|
-
ItemInfo.Classifications
|
20
|
-
ItemInfo.ContentInfo
|
21
|
-
ItemInfo.ContentRating
|
22
|
-
ItemInfo.ExternalIds
|
23
|
-
ItemInfo.Features
|
24
|
-
ItemInfo.ManufactureInfo
|
25
|
-
ItemInfo.ProductInfo
|
26
|
-
ItemInfo.TechnicalInfo
|
27
|
-
ItemInfo.Title
|
28
|
-
ItemInfo.TradeInInfo
|
29
|
-
Offers.Listings.Availability.MaxOrderQuantity
|
30
|
-
Offers.Listings.Availability.Message
|
31
|
-
Offers.Listings.Availability.MinOrderQuantity
|
32
|
-
Offers.Listings.Availability.Type
|
33
|
-
Offers.Listings.Condition
|
34
|
-
Offers.Listings.Condition.SubCondition
|
35
|
-
Offers.Listings.DeliveryInfo.IsAmazonFulfilled
|
36
|
-
Offers.Listings.DeliveryInfo.IsFreeShippingEligible
|
37
|
-
Offers.Listings.DeliveryInfo.IsPrimeEligible
|
38
|
-
Offers.Listings.IsBuyBoxWinner
|
39
|
-
Offers.Listings.LoyaltyPoints.Points
|
40
|
-
Offers.Listings.MerchantInfo
|
41
|
-
Offers.Listings.Price
|
42
|
-
Offers.Listings.ProgramEligibility.IsPrimeExclusive
|
43
|
-
Offers.Listings.ProgramEligibility.IsPrimePantry
|
44
|
-
Offers.Listings.Promotions
|
45
|
-
Offers.Listings.SavingBasis
|
46
|
-
Offers.Summaries.HighestPrice
|
47
|
-
Offers.Summaries.LowestPrice
|
48
|
-
Offers.Summaries.OfferCount
|
49
|
-
ParentASIN].freeze
|
50
|
-
private_constant :ALL
|
51
|
-
|
52
|
-
# @!attribute [r] all
|
53
|
-
# @return [Array<String>]
|
54
|
-
def self.all
|
55
|
-
ALL
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.valid?(resource)
|
59
|
-
ALL.include?(resource)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
data/test/locales.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
- :marketplace: CA
|
2
|
-
:access_key: AKIAIWQTVHVWCQA5THXQ
|
3
|
-
:secret_key: VOhSIqIY1wF5selhhJYJGVnIET9k5q0J8QjTX38i
|
4
|
-
:partner_tag: adabo00-20
|
5
|
-
- :marketplace: ES
|
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
|
-
- :marketplace: GB
|
22
|
-
:access_key: AKIAJPAXMP45DOQJPHJQ
|
23
|
-
:secret_key: feZKxFjRGLtmEO3JXpmCGdDaCPA7AHiVFBhQ/fkf
|
24
|
-
:partner_tag: adabo21-21
|
25
|
-
- :marketplace: US
|
26
|
-
:access_key: AKIAIWQTVHVWCQA5THXQ
|
27
|
-
:secret_key: VOhSIqIY1wF5selhhJYJGVnIET9k5q0J8QjTX38i
|
28
|
-
:partner_tag: adabo-20
|