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 +4 -4
- data/README.md +3 -2
- data/lib/mws/orders/parser.rb +9 -8
- data/lib/mws/orders/version.rb +1 -1
- data/test/test_helper.rb +5 -1
- metadata +2 -4
- data/test/integration/test_mws_orders.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffeac9dc8722894336970c9aff3a24f421cdf781299f4b71f7a17337666e29ee
|
4
|
+
data.tar.gz: f6696c0924e4f4d4e1a1ea39c01e74e8638a57e5fd12aa74d6c3eb8969087b3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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#
|
19
|
+
Set up credentials [when instantiating or with environment variables](https://github.com/hakanensari/peddler#usage).
|
19
20
|
|
20
21
|
### Orders
|
21
22
|
|
data/lib/mws/orders/parser.rb
CHANGED
@@ -8,10 +8,7 @@ require 'mws/orders/service_status'
|
|
8
8
|
module MWS
|
9
9
|
module Orders
|
10
10
|
class Parser
|
11
|
-
|
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
|
21
|
+
when /GetServiceStatus/
|
25
22
|
ServiceStatus.new(node)
|
26
|
-
when
|
23
|
+
when /GetOrder/
|
27
24
|
Orders.new(node).first
|
28
|
-
when
|
25
|
+
when /ListOrders/
|
29
26
|
Orders.new(node)
|
30
|
-
when
|
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
|
data/lib/mws/orders/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
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.
|
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:
|
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
|