vacuum 1.5.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84a02aea51ba9411d52f270e60d45c5b555d9a05
4
- data.tar.gz: e682feff02577c0013bd000929f55fd9682021b3
3
+ metadata.gz: 7906255d4f787e35bfc22f67b89d406bed807ce0
4
+ data.tar.gz: 13b236b25c20e725bba1248f5c3905c0e8bae1b5
5
5
  SHA512:
6
- metadata.gz: 0312a093309f424e722f427b1768020826d67645630cc1b2e4979f04fdbf8ef536a70383365ffe5f6b5c70c096ca6c628e1b61dcdcc62a1c080b6e0a079b5781
7
- data.tar.gz: 4dfeee9167618fa751b31b20d1b47e9466d53d5eeb95423b5d8d7cfaba53a63c2edc53432e922d963137767955cea93d3abe77d8f3792cbc2da544448d1b02df
6
+ metadata.gz: 0d9102da9a4be4f5d29220d6e4d12569378867da10ce668a2e7f9412ed6f42476a9daf5dcc0cea0c1f02ec37e6ed18aee0b3475b50c207c1d2e70285f06b125d
7
+ data.tar.gz: 290a282d80dfb9a8c7e7c3a386786b615a696c006cf31ee79066dfac6af0395ef874ba88eedb4aa461af5e1423511527874e88d20bae13a559c628d936c4789c
data/README.md CHANGED
@@ -178,12 +178,18 @@ response = request.item_search(
178
178
 
179
179
  ### Response
180
180
 
181
- The quick and dirty way to consume a response is to parse it into a Ruby hash:
181
+ The quick and dirty way to consume a response is to parse into a Ruby hash:
182
182
 
183
183
  ```ruby
184
184
  response.to_h
185
185
  ```
186
186
 
187
+ You can also use the `#dig` polyfill:
188
+
189
+ ```ruby
190
+ response.dig('ItemSearchResponse', 'Items', 'Item')
191
+ ```
192
+
187
193
  In production, you may prefer to use a custom parser to do some XML heavy-lifting:
188
194
 
189
195
  ```ruby
@@ -107,6 +107,7 @@ module Vacuum
107
107
  method_name = operation.gsub(/(.)([A-Z])/, '\1_\2').downcase
108
108
  define_method(method_name) do |params, opts = {}|
109
109
  params.key?(:query) ? opts = params : opts.update(query: params)
110
+ opts[:expects] = [200, 403]
110
111
  opts[:query].update('Operation' => operation)
111
112
 
112
113
  Response.new(get(opts))
@@ -1,19 +1,25 @@
1
1
  require 'delegate'
2
+ require 'dig_rb'
3
+ require 'forwardable'
2
4
  require 'multi_xml'
3
5
 
4
6
  module Vacuum
5
7
  # A wrapper around the Amazon Product Advertising API response.
6
8
  class Response < SimpleDelegator
9
+ extend Forwardable
10
+
7
11
  class << self
8
12
  attr_accessor :parser
9
13
  end
10
14
 
15
+ def_delegator :parse, :dig
16
+
17
+ attr_writer :parser
18
+
11
19
  def parser
12
20
  @parser || self.class.parser
13
21
  end
14
22
 
15
- attr_writer :parser
16
-
17
23
  def parse
18
24
  parser ? parser.parse(body) : to_h
19
25
  end
@@ -1,3 +1,3 @@
1
1
  module Vacuum
2
- VERSION = '1.5.0'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end