mws-orders 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +3 -3
- data/lib/mws/orders/address.rb +38 -0
- data/lib/mws/orders/buyer_customized_info.rb +14 -0
- data/lib/mws/orders/buyer_tax_info.rb +23 -0
- data/lib/mws/orders/collection.rb +1 -0
- data/lib/mws/orders/document.rb +6 -4
- data/lib/mws/orders/entity.rb +26 -15
- data/lib/mws/orders/invoice_data.rb +5 -4
- data/lib/mws/orders/message.rb +3 -2
- data/lib/mws/orders/order.rb +82 -33
- data/lib/mws/orders/order_item.rb +67 -30
- data/lib/mws/orders/order_items.rb +1 -0
- data/lib/mws/orders/orders.rb +1 -0
- data/lib/mws/orders/parser.rb +6 -14
- data/lib/mws/orders/payment_execution_detail_item.rb +3 -2
- data/lib/mws/orders/points_granted.rb +18 -0
- data/lib/mws/orders/product_info.rb +14 -0
- data/lib/mws/orders/service_status.rb +4 -3
- data/lib/mws/orders/tax_classification.rb +18 -0
- data/lib/mws/orders/tax_collection.rb +18 -0
- data/lib/mws/orders/tokenable.rb +2 -2
- data/lib/mws/orders/version.rb +1 -1
- metadata +11 -38
- data/lib/mws/orders/payment_execution_detail.rb +0 -16
- data/lib/mws/orders/shipping_address.rb +0 -37
- data/test/fixtures/order_items.xml +0 -83
- data/test/fixtures/orders.xml +0 -112
- data/test/fixtures/service_status.xml +0 -19
- data/test/mws/orders/test_entity.rb +0 -96
- data/test/mws/orders/test_message.rb +0 -18
- data/test/mws/orders/test_order.rb +0 -99
- data/test/mws/orders/test_order_item.rb +0 -74
- data/test/mws/orders/test_order_items.rb +0 -21
- data/test/mws/orders/test_orders.rb +0 -21
- data/test/mws/orders/test_parser.rb +0 -9
- data/test/mws/orders/test_payment_execution_detail.rb +0 -19
- data/test/mws/orders/test_payment_execution_detail_item.rb +0 -19
- data/test/mws/orders/test_service_status.rb +0 -28
- data/test/mws/orders/test_shipping_address.rb +0 -37
- data/test/mws/orders/test_tokenable.rb +0 -33
- data/test/test_helper.rb +0 -19
@@ -1,109 +1,146 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'mws/orders/entity'
|
4
|
+
require 'mws/orders/buyer_customized_info'
|
4
5
|
require 'mws/orders/invoice_data'
|
6
|
+
require 'mws/orders/points_granted'
|
7
|
+
require 'mws/orders/product_info'
|
8
|
+
require 'mws/orders/tax_collection'
|
5
9
|
|
6
10
|
module MWS
|
7
11
|
module Orders
|
12
|
+
# https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_Datatypes.html#OrderItem
|
8
13
|
class OrderItem < Entity
|
9
14
|
attribute(:asin) do
|
10
|
-
|
15
|
+
string('ASIN')
|
16
|
+
end
|
17
|
+
|
18
|
+
attribute(:order_item_id) do
|
19
|
+
string('OrderItemId')
|
11
20
|
end
|
12
21
|
|
13
22
|
attribute(:seller_sku) do
|
14
|
-
|
23
|
+
string('SellerSKU')
|
15
24
|
end
|
16
25
|
|
17
|
-
attribute(:
|
18
|
-
|
26
|
+
attribute(:buyer_customized_info) do
|
27
|
+
entity('BuyerCustomizedInfo', BuyerCustomizedInfo)
|
19
28
|
end
|
20
29
|
|
21
30
|
attribute(:title) do
|
22
|
-
|
31
|
+
string('Title')
|
23
32
|
end
|
24
33
|
|
25
34
|
attribute(:quantity_ordered) do
|
26
|
-
|
35
|
+
integer('QuantityOrdered')
|
27
36
|
end
|
28
37
|
|
29
38
|
attribute(:quantity_shipped) do
|
30
|
-
|
39
|
+
integer('QuantityShipped')
|
31
40
|
end
|
32
41
|
|
33
|
-
attribute(:
|
34
|
-
|
42
|
+
attribute(:points_granted) do
|
43
|
+
entity('PointsGranted', PointsGranted)
|
35
44
|
end
|
36
45
|
|
37
|
-
attribute(:
|
38
|
-
|
46
|
+
attribute(:product_info) do
|
47
|
+
entity('ProductInfo', ProductInfo)
|
39
48
|
end
|
40
49
|
|
41
50
|
attribute(:item_price) do
|
42
|
-
|
51
|
+
money('ItemPrice')
|
43
52
|
end
|
44
53
|
|
45
54
|
attribute(:shipping_price) do
|
46
|
-
|
55
|
+
money('ShippingPrice')
|
47
56
|
end
|
48
57
|
|
49
58
|
attribute(:gift_wrap_price) do
|
50
|
-
|
59
|
+
money('GiftWrapPrice')
|
60
|
+
end
|
61
|
+
|
62
|
+
attribute(:tax_collection) do
|
63
|
+
entity('TaxCollection', TaxCollection)
|
51
64
|
end
|
52
65
|
|
53
66
|
attribute(:item_tax) do
|
54
|
-
|
67
|
+
money('ItemTax')
|
55
68
|
end
|
56
69
|
|
57
70
|
attribute(:shipping_tax) do
|
58
|
-
|
71
|
+
money('ShippingTax')
|
59
72
|
end
|
60
73
|
|
61
74
|
attribute(:gift_wrap_tax) do
|
62
|
-
|
75
|
+
money('GiftWrapPrice')
|
63
76
|
end
|
64
77
|
|
65
78
|
attribute(:shipping_discount) do
|
66
|
-
|
79
|
+
money('ShippingDiscount')
|
67
80
|
end
|
68
81
|
|
69
82
|
attribute(:promotion_discount) do
|
70
|
-
|
83
|
+
money('PromotionDiscount')
|
71
84
|
end
|
72
85
|
|
73
86
|
attribute(:promotion_ids) do
|
74
|
-
xpath('
|
87
|
+
xpath('PromotionIds').map(&:text)
|
75
88
|
end
|
76
89
|
|
77
90
|
attribute(:cod_fee) do
|
78
|
-
|
91
|
+
money('CODFee')
|
79
92
|
end
|
80
93
|
|
81
94
|
attribute(:cod_fee_discount) do
|
82
|
-
|
95
|
+
money('CODFeeDiscount')
|
96
|
+
end
|
97
|
+
|
98
|
+
attribute(:gift?) do
|
99
|
+
boolean('IsGift')
|
100
|
+
end
|
101
|
+
|
102
|
+
attribute(:gift_message_text) do
|
103
|
+
string('GiftMessageText')
|
104
|
+
end
|
105
|
+
|
106
|
+
attribute(:gift_wrap_level) do
|
107
|
+
string('GiftWrapLevel')
|
83
108
|
end
|
84
109
|
|
85
110
|
attribute(:invoice_data) do
|
86
|
-
|
111
|
+
entity('InvoiceData', InvoiceData)
|
112
|
+
end
|
113
|
+
|
114
|
+
attribute(:condition_note) do
|
115
|
+
string('ConditionNote')
|
87
116
|
end
|
88
117
|
|
89
118
|
attribute(:condition_id) do
|
90
|
-
|
119
|
+
string('ConditionId')
|
91
120
|
end
|
92
121
|
|
93
122
|
attribute(:condition_subtype_id) do
|
94
|
-
|
123
|
+
string('ConditionSubtypeId')
|
95
124
|
end
|
96
125
|
|
97
|
-
attribute(:
|
98
|
-
|
126
|
+
attribute(:scheduled_delivery_starts_at) do
|
127
|
+
time('ScheduledDeliveryStartDate')
|
99
128
|
end
|
100
129
|
|
101
130
|
attribute(:scheduled_delivery_ends_at) do
|
102
|
-
|
131
|
+
time('ScheduledDeliveryEndDate')
|
103
132
|
end
|
104
133
|
|
105
|
-
attribute(:
|
106
|
-
|
134
|
+
attribute(:price_designation) do
|
135
|
+
string('PriceDesignation')
|
136
|
+
end
|
137
|
+
|
138
|
+
attribute(:transparency?) do
|
139
|
+
boolean('IsTransparency')
|
140
|
+
end
|
141
|
+
|
142
|
+
attribute(:serial_number_required?) do
|
143
|
+
boolean('SerialNumberRequired')
|
107
144
|
end
|
108
145
|
|
109
146
|
def to_s
|
data/lib/mws/orders/orders.rb
CHANGED
data/lib/mws/orders/parser.rb
CHANGED
@@ -7,10 +7,15 @@ require 'mws/orders/service_status'
|
|
7
7
|
require 'peddler'
|
8
8
|
|
9
9
|
module MWS
|
10
|
+
# With the MWS Orders API, you can list orders created or updated during a
|
11
|
+
# time frame you specify or retrieve information about specific orders.
|
10
12
|
module Orders
|
13
|
+
# Overrides the default parser in Peddler
|
11
14
|
class Parser
|
12
15
|
include ::Peddler::Headers
|
13
16
|
|
17
|
+
attr_reader :response
|
18
|
+
|
14
19
|
def initialize(response, _encoding)
|
15
20
|
@response = response
|
16
21
|
end
|
@@ -25,18 +30,6 @@ module MWS
|
|
25
30
|
end
|
26
31
|
end
|
27
32
|
|
28
|
-
def headers
|
29
|
-
@response.headers
|
30
|
-
end
|
31
|
-
|
32
|
-
def status_code
|
33
|
-
@response.status
|
34
|
-
end
|
35
|
-
|
36
|
-
def body
|
37
|
-
@response.body
|
38
|
-
end
|
39
|
-
|
40
33
|
private
|
41
34
|
|
42
35
|
def order
|
@@ -60,14 +53,13 @@ module MWS
|
|
60
53
|
end
|
61
54
|
|
62
55
|
def find_result_node
|
63
|
-
xml = Nokogiri(body)
|
56
|
+
xml = Nokogiri(response.body)
|
64
57
|
root = xml.children.first
|
65
58
|
|
66
59
|
root.children.find { |node| node.name.include?('Result') }
|
67
60
|
end
|
68
61
|
end
|
69
62
|
|
70
|
-
# Override Peddler's default Parser.
|
71
63
|
Client.parser = Parser
|
72
64
|
end
|
73
65
|
end
|
@@ -4,13 +4,14 @@ require 'mws/orders/entity'
|
|
4
4
|
|
5
5
|
module MWS
|
6
6
|
module Orders
|
7
|
+
# https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_Datatypes.html#PaymentExecutionDetailItem
|
7
8
|
class PaymentExecutionDetailItem < Entity
|
8
9
|
attribute(:payment) do
|
9
|
-
|
10
|
+
money('Payment')
|
10
11
|
end
|
11
12
|
|
12
13
|
attribute(:payment_method) do
|
13
|
-
|
14
|
+
string('PaymentMethod')
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mws/orders/entity'
|
4
|
+
|
5
|
+
module MWS
|
6
|
+
module Orders
|
7
|
+
# https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_Datatypes.html#PointsGranted
|
8
|
+
class PointsGranted < Entity
|
9
|
+
attribute(:number) do
|
10
|
+
integer('PointsNumber')
|
11
|
+
end
|
12
|
+
|
13
|
+
attribute(:monetary_value) do
|
14
|
+
money('PointsMonetaryValue')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mws/orders/entity'
|
4
|
+
|
5
|
+
module MWS
|
6
|
+
module Orders
|
7
|
+
# https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_Datatypes.html#ProductInfo
|
8
|
+
class ProductInfo < Entity
|
9
|
+
attribute(:number_of_items) do
|
10
|
+
integer('NumberOfItems')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -5,17 +5,18 @@ require 'mws/orders/message'
|
|
5
5
|
|
6
6
|
module MWS
|
7
7
|
module Orders
|
8
|
+
# https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/MWS_GetServiceStatus.html
|
8
9
|
class ServiceStatus < Entity
|
9
10
|
attribute(:status) do
|
10
|
-
|
11
|
+
string('Status')
|
11
12
|
end
|
12
13
|
|
13
14
|
attribute(:timestamp) do
|
14
|
-
|
15
|
+
time('Timestamp')
|
15
16
|
end
|
16
17
|
|
17
18
|
attribute(:message_id) do
|
18
|
-
|
19
|
+
string('MessageId')
|
19
20
|
end
|
20
21
|
|
21
22
|
attribute(:messages) do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mws/orders/entity'
|
4
|
+
|
5
|
+
module MWS
|
6
|
+
module Orders
|
7
|
+
# https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_Datatypes.html#TaxClassification
|
8
|
+
class TaxClassification < Entity
|
9
|
+
attribute :name do
|
10
|
+
string('Name')
|
11
|
+
end
|
12
|
+
|
13
|
+
attribute(:value) do
|
14
|
+
string('Value')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mws/orders/entity'
|
4
|
+
|
5
|
+
module MWS
|
6
|
+
module Orders
|
7
|
+
# https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_Datatypes.html#TaxCollection
|
8
|
+
class TaxCollection < Entity
|
9
|
+
attribute :model do
|
10
|
+
string('Model')
|
11
|
+
end
|
12
|
+
|
13
|
+
attribute(:responsible_party) do
|
14
|
+
string('ResponsibleParty')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/mws/orders/tokenable.rb
CHANGED
data/lib/mws/orders/version.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.
|
4
|
+
version: 0.5.0
|
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-
|
11
|
+
date: 2019-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: money
|
@@ -117,6 +117,9 @@ extra_rdoc_files: []
|
|
117
117
|
files:
|
118
118
|
- LICENSE
|
119
119
|
- README.md
|
120
|
+
- lib/mws/orders/address.rb
|
121
|
+
- lib/mws/orders/buyer_customized_info.rb
|
122
|
+
- lib/mws/orders/buyer_tax_info.rb
|
120
123
|
- lib/mws/orders/collection.rb
|
121
124
|
- lib/mws/orders/document.rb
|
122
125
|
- lib/mws/orders/entity.rb
|
@@ -127,28 +130,14 @@ files:
|
|
127
130
|
- lib/mws/orders/order_items.rb
|
128
131
|
- lib/mws/orders/orders.rb
|
129
132
|
- lib/mws/orders/parser.rb
|
130
|
-
- lib/mws/orders/payment_execution_detail.rb
|
131
133
|
- lib/mws/orders/payment_execution_detail_item.rb
|
134
|
+
- lib/mws/orders/points_granted.rb
|
135
|
+
- lib/mws/orders/product_info.rb
|
132
136
|
- lib/mws/orders/service_status.rb
|
133
|
-
- lib/mws/orders/
|
137
|
+
- lib/mws/orders/tax_classification.rb
|
138
|
+
- lib/mws/orders/tax_collection.rb
|
134
139
|
- lib/mws/orders/tokenable.rb
|
135
140
|
- lib/mws/orders/version.rb
|
136
|
-
- test/fixtures/order_items.xml
|
137
|
-
- test/fixtures/orders.xml
|
138
|
-
- test/fixtures/service_status.xml
|
139
|
-
- test/mws/orders/test_entity.rb
|
140
|
-
- test/mws/orders/test_message.rb
|
141
|
-
- test/mws/orders/test_order.rb
|
142
|
-
- test/mws/orders/test_order_item.rb
|
143
|
-
- test/mws/orders/test_order_items.rb
|
144
|
-
- test/mws/orders/test_orders.rb
|
145
|
-
- test/mws/orders/test_parser.rb
|
146
|
-
- test/mws/orders/test_payment_execution_detail.rb
|
147
|
-
- test/mws/orders/test_payment_execution_detail_item.rb
|
148
|
-
- test/mws/orders/test_service_status.rb
|
149
|
-
- test/mws/orders/test_shipping_address.rb
|
150
|
-
- test/mws/orders/test_tokenable.rb
|
151
|
-
- test/test_helper.rb
|
152
141
|
homepage: https://github.com/hakanensari/mws-orders
|
153
142
|
licenses:
|
154
143
|
- MIT
|
@@ -171,21 +160,5 @@ requirements: []
|
|
171
160
|
rubygems_version: 3.0.3
|
172
161
|
signing_key:
|
173
162
|
specification_version: 4
|
174
|
-
summary: A Ruby
|
175
|
-
test_files:
|
176
|
-
- test/mws/orders/test_orders.rb
|
177
|
-
- test/mws/orders/test_order.rb
|
178
|
-
- test/mws/orders/test_service_status.rb
|
179
|
-
- test/mws/orders/test_shipping_address.rb
|
180
|
-
- test/mws/orders/test_tokenable.rb
|
181
|
-
- test/mws/orders/test_message.rb
|
182
|
-
- test/mws/orders/test_payment_execution_detail_item.rb
|
183
|
-
- test/mws/orders/test_order_items.rb
|
184
|
-
- test/mws/orders/test_entity.rb
|
185
|
-
- test/mws/orders/test_payment_execution_detail.rb
|
186
|
-
- test/mws/orders/test_parser.rb
|
187
|
-
- test/mws/orders/test_order_item.rb
|
188
|
-
- test/fixtures/order_items.xml
|
189
|
-
- test/fixtures/service_status.xml
|
190
|
-
- test/fixtures/orders.xml
|
191
|
-
- test/test_helper.rb
|
163
|
+
summary: A Ruby interface to the Amazon MWS Orders API, built on Peddler
|
164
|
+
test_files: []
|