mws-orders 0.3.0 → 0.3.1

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: 8a053556ba512ddb90a000741d9e1e3b243ac37b15f3ce0827983e52996506e6
4
- data.tar.gz: 8379ac232066da3a4d0d668361a8d610ffa975cba2598b31bdb3294579ebf0ff
3
+ metadata.gz: ffeac9dc8722894336970c9aff3a24f421cdf781299f4b71f7a17337666e29ee
4
+ data.tar.gz: f6696c0924e4f4d4e1a1ea39c01e74e8638a57e5fd12aa74d6c3eb8969087b3b
5
5
  SHA512:
6
- metadata.gz: d814f02e115ed54126c089e9f7978609e4e37f710af9fe4a4b0afb57cec2fd9a0a36e40dcf1070f6a0cdb7db6e0922a368fa4d02496a291ea7cfd6d863f1d0cf
7
- data.tar.gz: 6b9e133c1fd5fb86ee764c5ba89832622a6f17eb9edbca0eadad7d789ce480699344af4a6c3314251beb42e36fa62f7846bf73b51d652a359f25d628a075701d
6
+ metadata.gz: 49b0857eaafcecd6f75220b6961b9a7e82b4dc3a5f53ed2f635f63979b7991781325be5e1b363f664576426b67af88d72d8c7cddd475c629803dbde4f16669b0
7
+ data.tar.gz: f00ddc5e0649389dcc953c09725d5bec260261832e11848a5b0e05425fe1b0dc85ecfea895a5affa3b9a17ca80767914c028965e670f75fa7cd386ca135fb80c
data/README.md CHANGED
@@ -12,10 +12,11 @@ Create a client:
12
12
 
13
13
  ```ruby
14
14
  require "mws-orders"
15
- client = MWS.orders
15
+ client = MWS.orders(marketplace: "ATVPDKIKX0DER",
16
+ merchant_id: "123")
16
17
  ```
17
18
 
18
- Set up credentials [when instantiating or with environment variables](https://github.com/hakanensari/peddler#quick-start).
19
+ Set up credentials [when instantiating or with environment variables](https://github.com/hakanensari/peddler#usage).
19
20
 
20
21
  ### Orders
21
22
 
@@ -8,10 +8,7 @@ require 'mws/orders/service_status'
8
8
  module MWS
9
9
  module Orders
10
10
  class Parser
11
- SERVICE_STATUS = /GetServiceStatus/
12
- ORDER = /GetOrder/
13
- ORDERS = /ListOrders/
14
- ORDER_ITEMS = /ListOrderItems/
11
+ include ::Peddler::Headers
15
12
 
16
13
  def initialize(response, _encoding)
17
14
  @response = response
@@ -21,19 +18,23 @@ module MWS
21
18
  node = find_result_node
22
19
 
23
20
  case node.name
24
- when SERVICE_STATUS
21
+ when /GetServiceStatus/
25
22
  ServiceStatus.new(node)
26
- when ORDER
23
+ when /GetOrder/
27
24
  Orders.new(node).first
28
- when ORDERS
25
+ when /ListOrders/
29
26
  Orders.new(node)
30
- when ORDER_ITEMS
27
+ when /ListOrderItems/
31
28
  OrderItems.new(node)
32
29
  else
33
30
  raise NotImplementedError
34
31
  end
35
32
  end
36
33
 
34
+ def headers
35
+ @response.headers
36
+ end
37
+
37
38
  private
38
39
 
39
40
  def find_result_node
@@ -2,6 +2,6 @@
2
2
 
3
3
  module MWS
4
4
  module Orders
5
- VERSION = '0.3.0'
5
+ VERSION = '0.3.1'
6
6
  end
7
7
  end
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'minitest/autorun'
4
- require 'pry'
5
4
  require 'mws-orders'
6
5
 
6
+ begin
7
+ require 'pry'
8
+ rescue LoadError
9
+ end
10
+
7
11
  I18n.enforce_available_locales = false
8
12
 
9
13
  module MiniTest
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mws-orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-18 00:00:00.000000000 Z
11
+ date: 2019-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: money
@@ -95,7 +95,6 @@ files:
95
95
  - test/fixtures/order_items.xml
96
96
  - test/fixtures/orders.xml
97
97
  - test/fixtures/service_status.xml
98
- - test/integration/test_mws_orders.rb
99
98
  - test/mws/orders/test_entity.rb
100
99
  - test/mws/orders/test_order.rb
101
100
  - test/mws/orders/test_order_item.rb
@@ -134,7 +133,6 @@ signing_key:
134
133
  specification_version: 4
135
134
  summary: Wraps the Amazon MWS Orders API
136
135
  test_files:
137
- - test/integration/test_mws_orders.rb
138
136
  - test/mws/orders/test_orders.rb
139
137
  - test/mws/orders/test_service_status_message.rb
140
138
  - test/mws/orders/test_order.rb
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class TestMWSOrders < MiniTest::Test
6
- def setup
7
- skip unless ENV['AWS_ACCESS_KEY_ID']
8
- @client = MWS.orders
9
- end
10
-
11
- def test_gets_service_status
12
- assert_kind_of ServiceStatus, @client.get_service_status.parse
13
- end
14
-
15
- def test_lists_orders_and_their_items
16
- orders = @client.list_orders(created_after: one_year_ago).parse
17
- refute_empty orders
18
- amazon_order_id = orders.to_a.sample.amazon_order_id
19
- assert_kind_of MWS::Orders::Order, @client.get_order(amazon_order_id).parse
20
- order_items = @client.list_order_items(amazon_order_id).parse
21
- refute_empty order_items
22
- end
23
-
24
- private
25
-
26
- def one_year_ago
27
- Date.today - 365
28
- end
29
- end