mws-orders 0.5.1 → 0.6.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: ade6a5c1c3498da87514f76fb4e6304e1914c0f4a520641e0df1cee2533e97b5
4
- data.tar.gz: ce196f172eb0cbaf1f0e994151bff632550cabbe5949d1d72abff1dad3d0ad26
3
+ metadata.gz: 9b9b872550f745217030c7b4b5540a0a268f6661491943041008ae73b9213f35
4
+ data.tar.gz: fe4f6c37733c721c1bf8bf0991ab88448739b614d976445e90ae42f2f6be5569
5
5
  SHA512:
6
- metadata.gz: 19cba4b4ceff9c1889611f27272fcb090e818c1f7bf888108ccf5c5e82a488541c1a3b0d8a6fafd1a96af313fa10d795fcacb6d86d24869cd20ac7705f63296b
7
- data.tar.gz: 493cf6bade595b54da1cee5234e40c79a2de8f01b6281c4843ceb0582ef58327ec0bb4de711dfc229312153b16a530b8df0b0ec38e4ae1687e58fcc9a5928e5e
6
+ metadata.gz: f80e42ed08d572f4e239688fdc7f22b0f41185ae3c85967ab0e4043b0473f4cfdda3138aa73781a71ca47764cfb895dcaac675e362b1f5296a70b36da756ac96
7
+ data.tar.gz: 74ba62af68cba110d61d32f1a4c37caad9dde7e0a26237485184b3f50653f045923ad69349c1f0085ecf6b6a8ad2f6972255458fe4515b923eb3852d4d69823e
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # MWS Orders
2
2
 
3
- [![CircleCI](https://circleci.com/gh/hakanensari/mws-orders.svg?style=svg)](https://circleci.com/gh/hakanensari/mws-orders)
3
+ [![Build](https://github.com/hakanensari/mws-orders/workflows/build/badge.svg)](https://github.com/hakanensari/mws-orders/actions)
4
4
 
5
- **MWS Orders** is a full-featured Ruby interface to the [Amazon Marketplace Web Service (MWS) Orders API](http://docs.developer.amazonservices.com/en_UK/orders/index.html). With the MWS Orders API, you can list orders created or updated during a time frame you specify or retrieve information about specific orders.
5
+ **MWS Orders** is a full-featured Ruby interface to the [Amazon Marketplace Web Service (MWS) Orders API](https://docs.developer.amazonservices.com/en_UK/orders-2013-09-01/). With the MWS Orders API, you can list orders created or updated during a time frame you specify or retrieve information about specific orders.
6
6
 
7
7
  To use Amazon MWS, you must have an eligible seller account.
8
8
 
@@ -27,7 +27,6 @@ response = client.list_orders(created_after: 1.month.ago)
27
27
  orders = response.parse
28
28
  puts orders.count # => 100
29
29
  orders.first.inspect # => #<MWS::Orders::Order 902-3159896-1390916>
30
- )
31
30
  ```
32
31
 
33
32
  List the next page of orders:
@@ -40,8 +39,8 @@ Get one or more orders based on their order numbers:
40
39
 
41
40
  ```ruby
42
41
  response = client.get_order('902-3159896-1390916')
43
- order = response.parse
44
- order.inspect # => #<MWS::Orders::Order 902-3159896-1390916>
42
+ orders = response.parse
43
+ orders.first.inspect # => #<MWS::Orders::Order 902-3159896-1390916>
45
44
  ```
46
45
 
47
46
  ### Order Items
@@ -6,6 +6,8 @@ require 'money'
6
6
  require 'structure'
7
7
  require 'mws/orders/document'
8
8
 
9
+ Money.rounding_mode = BigDecimal::ROUND_HALF_UP
10
+
9
11
  module MWS
10
12
  module Orders
11
13
  # A parsed object
@@ -21,38 +21,34 @@ module MWS
21
21
  end
22
22
 
23
23
  def parse
24
- case result_node.name
25
- when /GetOrder/ then order
26
- when /GetServiceStatus/ then service_status
27
- when /ListOrders/ then orders
28
- when /ListOrderItems/ then order_items
24
+ case payload.name
25
+ when /GetOrderResult/ then orders
26
+ when /ListOrders.*Result/ then orders
27
+ when /ListOrderItems.*Result/ then order_items
28
+ when 'GetServiceStatusResult' then service_status
29
29
  else raise NotImplementedError
30
30
  end
31
31
  end
32
32
 
33
- private
34
-
35
- def order
36
- orders.first
33
+ def payload
34
+ @payload ||= find_payload
37
35
  end
38
36
 
37
+ private
38
+
39
39
  def orders
40
- Orders.new(result_node)
40
+ Orders.new(payload)
41
41
  end
42
42
 
43
43
  def order_items
44
- OrderItems.new(result_node)
44
+ OrderItems.new(payload)
45
45
  end
46
46
 
47
47
  def service_status
48
- ServiceStatus.new(result_node)
49
- end
50
-
51
- def result_node
52
- @result_node ||= find_result_node
48
+ ServiceStatus.new(payload)
53
49
  end
54
50
 
55
- def find_result_node
51
+ def find_payload
56
52
  xml = Nokogiri(response.body)
57
53
  root = xml.children.first
58
54
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module MWS
4
4
  module Orders
5
- VERSION = '0.5.1'
5
+ VERSION = '0.6.1'
6
6
  end
7
7
  end
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.5.1
4
+ version: 0.6.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: 2019-09-07 00:00:00.000000000 Z
11
+ date: 2020-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: money
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.0.3
160
+ rubygems_version: 3.1.2
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: A Ruby interface to the Amazon MWS Orders API, built on Peddler