amazon_mws_products 0.0.2 → 0.0.3

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.
data/README.md CHANGED
@@ -29,7 +29,9 @@ account = OpenStruct.new(seller_id: "your mws seller id",
29
29
  marketplace_id: "the marketplace id",
30
30
  secret_access_key: "your secret access key")
31
31
 
32
- client = AmazonMwsProducts::ListMatchingProducts.new(account, "harry potter dvd")
32
+ client = AmazonMwsProducts::ListMatchingProducts.new(account: account,
33
+ query: "star wars",
34
+ query_context_id: "Toys")
33
35
  response = client.execute # response body will be a Nokogiri::XML::Document
34
36
  puts response.body.to_xml
35
37
  ```
@@ -2,9 +2,9 @@ module AmazonMwsProducts
2
2
  class GetMatchingProducts
3
3
  attr_reader :account, :asins
4
4
 
5
- def initialize(account, asins)
6
- @account = account
7
- @asins = asins
5
+ def initialize(options)
6
+ @account = options.fetch(:account)
7
+ @asins = options.fetch(:asins)
8
8
  end
9
9
 
10
10
  def execute
@@ -2,10 +2,10 @@ module AmazonMwsProducts
2
2
  class ListMatchingProducts
3
3
  attr_reader :account, :query, :query_context_id
4
4
 
5
- def initialize(account, query, query_context_id = nil)
6
- @account = account
7
- @query = query
8
- @query_context_id = query_context_id
5
+ def initialize(options)
6
+ @account = options.fetch(:account)
7
+ @query = options.fetch(:query)
8
+ @query_context_id = options[:query_context_id]
9
9
  end
10
10
 
11
11
  def execute
@@ -1,3 +1,3 @@
1
1
  module AmazonMwsProducts
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -11,7 +11,11 @@ module AmazonMwsProducts
11
11
 
12
12
  let(:asins) {%w{B002QYOP72 B009AWSLFK B008BV6XA6}}
13
13
 
14
- subject { GetMatchingProducts.new(account, asins) }
14
+ let(:options) {{
15
+ account: account,
16
+ asins: asins
17
+ }}
18
+ subject { GetMatchingProducts.new(options) }
15
19
 
16
20
  before(:each) do
17
21
  stub_request(:get, %r{^https://mws.amazonservices.com/Products/2011-10-01}).
@@ -10,8 +10,12 @@ module AmazonMwsProducts
10
10
  end
11
11
 
12
12
  let(:query) { "harry potter dvd" }
13
+ let(:options) {{
14
+ account: account,
15
+ query: query
16
+ }}
13
17
 
14
- subject { ListMatchingProducts.new(account, query) }
18
+ subject { ListMatchingProducts.new(options) }
15
19
 
16
20
  before(:each) do
17
21
  stub_request(:get, %r{^https://mws.amazonservices.com/Products/2011-10-01}).
@@ -39,7 +43,12 @@ module AmazonMwsProducts
39
43
  end
40
44
 
41
45
  context "query context id included in request" do
42
- subject { ListMatchingProducts.new(account, query, "Toys") }
46
+ let(:options) {{
47
+ account: account,
48
+ query: query,
49
+ query_context_id: "Toys"
50
+ }}
51
+
43
52
  it "adds the proper query parameter" do
44
53
  subject.execute
45
54
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: amazon_mws_products
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Donald Plummer