vacuum 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7930ac186979f816a0d138d66b3a2a560d6237f7a30ee05a93a09f5e6cf4722
4
- data.tar.gz: 7bf258d4f95d9714ca6957240b1070e1394fcb017828d3d23116a6ffa6a7eed1
3
+ metadata.gz: d1b71a457cf1479084393d842f764c235df227e69df803d3831a61ad58c17e58
4
+ data.tar.gz: 58f3653a02464e6c84d2bb6eca1b5ef1d38beef082c08586850fd2819411e2e6
5
5
  SHA512:
6
- metadata.gz: ba541939522a687a4f1fd800232c7f71db4d5d8c87ecf6979d8111f86f27fa8fbb3fba9aca098bb6c8ace24d75e10fef7d6916c69904896312f72d2e41742e17
7
- data.tar.gz: 016a3f3248f2470bfeee5bfc0b4245fed9ea00fba3217056c3f4d65a6c2c4dca92bd0f43687b87a0188c53ddf7e3da74de37ee1e2912fd8dce824b567a971cea
6
+ metadata.gz: 78da469aa7084427b691489bfc180f280cd3dab342665d1ce4b8df5cb996b497a5344bd764fa8122f25a37f9df080580b4057ce70287982654b18b9032a2bc17
7
+ data.tar.gz: 6a5bdede32ec18b191e1204b7fad7a5559ddeed01ab4316131b8349ca8037528612a9c6b0f56f6579e986e85ec644cbfa35c65663129406854dc62ec200f1eca
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Vacuum
2
2
 
3
3
  [![Build](https://github.com/hakanensari/vacuum/workflows/build/badge.svg)](https://github.com/hakanensari/vacuum/actions)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/ffbab4aa5fedf5780332/maintainability)](https://codeclimate.com/github/hakanensari/vacuum/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/ffbab4aa5fedf5780332/test_coverage)](https://codeclimate.com/github/hakanensari/vacuum/test_coverage)
4
6
 
5
7
  Vacuum is a Ruby wrapper to [Amazon Product Advertising API 5.0](https://webservices.amazon.com/paapi5/documentation/). The API provides programmatic access to query product information on the Amazon marketplaces.
6
8
 
data/lib/vacuum/locale.rb CHANGED
@@ -19,6 +19,7 @@ module Vacuum
19
19
  it: ['webservices.amazon.it', 'eu-west-1'],
20
20
  jp: ['webservices.amazon.co.jp', 'us-west-2'],
21
21
  mx: ['webservices.amazon.com.mx', 'us-east-1'],
22
+ sg: ['webservices.amazon.sg', 'us-west-2'],
22
23
  es: ['webservices.amazon.es', 'eu-west-1'],
23
24
  tr: ['webservices.amazon.com.tr', 'eu-west-1'],
24
25
  ae: ['webservices.amazon.ae', 'eu-west-1'],
@@ -28,7 +28,7 @@ module Vacuum
28
28
  # @param [String] partner_type
29
29
  # @raise [Locale::NotFound] if marketplace is not found
30
30
  def initialize(marketplace: :us, **args)
31
- @locale = Locale.new(marketplace, args)
31
+ @locale = Locale.new(marketplace, **args)
32
32
  @client = HTTP::Client.new
33
33
  end
34
34
 
@@ -10,24 +10,29 @@ module Vacuum
10
10
  extend Forwardable
11
11
 
12
12
  # @!method dig(*key)
13
- # Delegates to {Response#to_h} to extract a nested value specified by the
14
- # sequence of keys
15
- # @param [String] key
13
+ # Delegates to the Hash returned by {Response#to_h} to extract a nested
14
+ # value specified by the sequence of keys
15
+ # @param [String] key one or more keys
16
16
  # @see https://ruby-doc.org/core/Hash.html#method-i-dig
17
17
  def_delegator :to_h, :dig
18
18
 
19
19
  class << self
20
+ # @return [nil,.parse] an optional custom parser
20
21
  attr_accessor :parser
21
22
  end
22
23
 
23
- def_delegator :to_h, :dig
24
-
24
+ # @return [nil,.parse] an optional custom parser
25
25
  attr_writer :parser
26
26
 
27
+ # @!attribute [r] parser
28
+ # @return [nil,.parse] an optional custom parser
27
29
  def parser
28
30
  @parser || self.class.parser
29
31
  end
30
32
 
33
+ # Parses the response body
34
+ #
35
+ # @note Delegates to {#to_h} if no custom parser is set
31
36
  def parse
32
37
  parser ? parser.parse(body) : to_h
33
38
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vacuum
4
- VERSION = '3.2.0'
4
+ VERSION = '3.3.0'
5
5
  end
data/test/helper.rb ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Keep SimpleCov at top.
4
+ require 'simplecov'
5
+
6
+ SimpleCov.start do
7
+ add_filter '/test/'
8
+ end
9
+
10
+ require 'minitest/autorun'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'minitest/autorun'
3
+ require 'helper'
4
4
  require 'vcr'
5
5
 
6
6
  require 'locales'
@@ -45,7 +45,7 @@ module Vacuum
45
45
  private
46
46
 
47
47
  def requests
48
- Locales.map { |credentials| Vacuum.new(credentials) }.shuffle
48
+ Locales.map { |credentials| Vacuum.new(**credentials) }.shuffle
49
49
  end
50
50
  end
51
51
  end
data/test/locales.yml ADDED
@@ -0,0 +1,28 @@
1
+ - :marketplace: CA
2
+ :access_key: AKIAIWQTVHVWCQA5THXQ
3
+ :secret_key: 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
4
+ :partner_tag: adabo00-20
5
+ - :marketplace: ES
6
+ :access_key: AKIAJJF26BJLZLSJLFBQ
7
+ :secret_key: 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
8
+ :partner_tag: adabo00-21
9
+ - :marketplace: DE
10
+ :access_key: AKIAJGN5UNM43HHV5MZA
11
+ :secret_key: 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
12
+ :partner_tag: adabo23-21
13
+ - :marketplace: FR
14
+ :access_key: AKIAJDNYBNMN23YBFK3A
15
+ :secret_key: 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
16
+ :partner_tag: adabo-21
17
+ - :marketplace: IT
18
+ :access_key: AKIAJVBAH4XJHK6YF46Q
19
+ :secret_key: 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
20
+ :partner_tag: adabo0c-21
21
+ - :marketplace: GB
22
+ :access_key: AKIAJPAXMP45DOQJPHJQ
23
+ :secret_key: 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
24
+ :partner_tag: adabo21-21
25
+ - :marketplace: US
26
+ :access_key: AKIAIWQTVHVWCQA5THXQ
27
+ :secret_key: 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
28
+ :partner_tag: adabo-20
@@ -1,36 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'minitest/autorun'
3
+ require 'helper'
4
4
  require 'vacuum/locale'
5
5
 
6
6
  module Vacuum
7
7
  class TestLocale < Minitest::Test
8
8
  def test_host
9
- locale = Locale.new(:us, credentials)
9
+ locale = Locale.new(:us, **credentials)
10
10
  assert locale.host
11
11
  end
12
12
 
13
13
  def test_region
14
- locale = Locale.new(:us, credentials)
14
+ locale = Locale.new(:us, **credentials)
15
15
  assert locale.region
16
16
  end
17
17
 
18
18
  def test_partner_type_default
19
- locale = Locale.new(:us, credentials)
19
+ locale = Locale.new(:us, **credentials)
20
20
  assert locale.partner_type
21
21
  end
22
22
 
23
23
  def test_upcased_marketplace
24
- Locale.new('US', credentials) # does not raise
24
+ Locale.new('US', **credentials) # does not raise
25
25
  end
26
26
 
27
27
  def test_uk
28
- Locale.new(:uk, credentials) # does not raise
28
+ Locale.new(:uk, **credentials) # does not raise
29
29
  end
30
30
 
31
31
  def test_not_found
32
32
  assert_raises Locale::NotFound do
33
- Locale.new(:foo, credentials)
33
+ Locale.new(:foo, **credentials)
34
34
  end
35
35
  end
36
36
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'minitest/autorun'
3
+ require 'helper'
4
4
  require 'vacuum/locale'
5
5
  require 'vacuum/operation'
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'minitest/autorun'
3
+ require 'helper'
4
4
  require 'vacuum/response'
5
5
 
6
6
  module Vacuum
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.2.0
4
+ version: 3.3.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-11-13 00:00:00.000000000 Z
11
+ date: 2020-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sigv4
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: vcr
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -139,8 +153,10 @@ files:
139
153
  - lib/vacuum/response.rb
140
154
  - lib/vacuum/version.rb
141
155
  - test/cassettes/vacuum.yml
156
+ - test/helper.rb
142
157
  - test/integration_helper.rb
143
158
  - test/locales.rb
159
+ - test/locales.yml
144
160
  - test/locales.yml.example
145
161
  - test/vacuum/test_locale.rb
146
162
  - test/vacuum/test_operation.rb
@@ -165,11 +181,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
181
  - !ruby/object:Gem::Version
166
182
  version: '0'
167
183
  requirements: []
168
- rubygems_version: 3.0.3
184
+ rubygems_version: 3.1.2
169
185
  signing_key:
170
186
  specification_version: 4
171
187
  summary: Amazon Product Advertising in Ruby
172
188
  test_files:
189
+ - test/helper.rb
173
190
  - test/vacuum/test_operation.rb
174
191
  - test/vacuum/test_request.rb
175
192
  - test/vacuum/test_response.rb
@@ -177,4 +194,5 @@ test_files:
177
194
  - test/cassettes/vacuum.yml
178
195
  - test/integration_helper.rb
179
196
  - test/locales.rb
197
+ - test/locales.yml
180
198
  - test/locales.yml.example