peddler 0.6.5 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +62 -81
  4. data/lib/mws/cart_information.rb +13 -0
  5. data/lib/mws/customer_information.rb +16 -0
  6. data/lib/mws/feeds.rb +110 -1
  7. data/lib/mws/fulfillment_inbound_shipment.rb +13 -1
  8. data/lib/mws/fulfillment_inventory.rb +15 -1
  9. data/lib/mws/fulfillment_outbound_shipment.rb +17 -1
  10. data/lib/mws/off_amazon_payments.rb +15 -1
  11. data/lib/mws/orders.rb +100 -1
  12. data/lib/mws/products.rb +238 -1
  13. data/lib/mws/recommendations.rb +13 -1
  14. data/lib/mws/reports.rb +221 -1
  15. data/lib/mws/sellers.rb +40 -1
  16. data/lib/mws/subscriptions.rb +175 -1
  17. data/lib/peddler/client.rb +77 -37
  18. data/lib/peddler/csv_parser.rb +42 -0
  19. data/lib/peddler/operation.rb +44 -0
  20. data/lib/peddler/parser.rb +21 -0
  21. data/lib/peddler/structured_list.rb +22 -0
  22. data/lib/peddler/version.rb +1 -1
  23. data/lib/peddler/xml_parser.rb +25 -0
  24. data/lib/peddler.rb +2 -0
  25. data/test/helper.rb +1 -1
  26. data/test/integration/test_feeds.rb +18 -0
  27. data/test/integration/test_orders.rb +22 -0
  28. data/test/integration/test_products.rb +53 -0
  29. data/test/integration/test_reports.rb +47 -0
  30. data/test/integration/test_sellers.rb +18 -0
  31. data/test/integration/test_subscriptions.rb +26 -0
  32. data/test/integration_helper.rb +41 -8
  33. data/test/mws.yml +32 -0
  34. data/test/mws.yml.example +4 -0
  35. data/test/unit/peddler/test_client.rb +97 -0
  36. data/test/unit/peddler/test_csv_parser.rb +24 -0
  37. data/test/unit/peddler/test_operation.rb +34 -0
  38. data/test/{peddler/request → unit/peddler}/test_structured_list.rb +5 -5
  39. data/test/unit/peddler/test_xml_parser.rb +19 -0
  40. data/test/{test_peddler.rb → unit/test_peddler.rb} +2 -2
  41. data/test/vcr_cassettes/Feeds.yml +695 -0
  42. data/test/vcr_cassettes/Orders.yml +29855 -0
  43. data/test/vcr_cassettes/Products.yml +8597 -0
  44. data/test/vcr_cassettes/Reports.yml +1881 -0
  45. data/test/vcr_cassettes/Sellers.yml +697 -0
  46. data/test/vcr_cassettes/Subscriptions.yml +1369 -0
  47. metadata +91 -297
  48. data/lib/mws/feeds/client.rb +0 -116
  49. data/lib/mws/feeds/parsers/feed.rb +0 -14
  50. data/lib/mws/feeds/parsers/feed_submission_count.rb +0 -10
  51. data/lib/mws/feeds/parsers/feed_submission_info.rb +0 -25
  52. data/lib/mws/feeds/parsers/feed_submission_list.rb +0 -23
  53. data/lib/mws/feeds/parsers/feed_submission_result.rb +0 -10
  54. data/lib/mws/feeds/parsers/feed_submissions.rb +0 -18
  55. data/lib/mws/feeds/requests/feed.rb +0 -38
  56. data/lib/mws/feeds/requests/feed_submission_count.rb +0 -20
  57. data/lib/mws/feeds/requests/feed_submission_list.rb +0 -30
  58. data/lib/mws/feeds/requests/feed_submission_result.rb +0 -18
  59. data/lib/mws/feeds/requests/feed_submissions.rb +0 -20
  60. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -7
  61. data/lib/mws/fulfillment_inventory/client.rb +0 -7
  62. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -7
  63. data/lib/mws/off_amazon_payments/client.rb +0 -7
  64. data/lib/mws/orders/client.rb +0 -98
  65. data/lib/mws/orders/parsers/invoice_data.rb +0 -25
  66. data/lib/mws/orders/parsers/order.rb +0 -113
  67. data/lib/mws/orders/parsers/order_item.rb +0 -110
  68. data/lib/mws/orders/parsers/order_items.rb +0 -23
  69. data/lib/mws/orders/parsers/orders.rb +0 -23
  70. data/lib/mws/orders/parsers/payment_execution_detail.rb +0 -20
  71. data/lib/mws/orders/parsers/payment_execution_detail_item.rb +0 -17
  72. data/lib/mws/orders/parsers/service_status.rb +0 -36
  73. data/lib/mws/orders/parsers/service_status_message.rb +0 -17
  74. data/lib/mws/orders/parsers/shipping_address.rb +0 -37
  75. data/lib/mws/orders/requests/order_items.rb +0 -28
  76. data/lib/mws/orders/requests/orders.rb +0 -41
  77. data/lib/mws/orders/requests/service_status.rb +0 -15
  78. data/lib/mws/products/client.rb +0 -7
  79. data/lib/mws/recommendations/client.rb +0 -7
  80. data/lib/mws/reports/client.rb +0 -249
  81. data/lib/mws/reports/parsers/report.rb +0 -10
  82. data/lib/mws/reports/parsers/report_acknowledgements.rb +0 -20
  83. data/lib/mws/reports/parsers/report_count.rb +0 -10
  84. data/lib/mws/reports/parsers/report_info.rb +0 -29
  85. data/lib/mws/reports/parsers/report_list.rb +0 -23
  86. data/lib/mws/reports/parsers/report_request.rb +0 -14
  87. data/lib/mws/reports/parsers/report_request_count.rb +0 -10
  88. data/lib/mws/reports/parsers/report_request_info.rb +0 -49
  89. data/lib/mws/reports/parsers/report_request_list.rb +0 -23
  90. data/lib/mws/reports/parsers/report_requests.rb +0 -18
  91. data/lib/mws/reports/parsers/report_schedule.rb +0 -21
  92. data/lib/mws/reports/parsers/report_schedule_count.rb +0 -10
  93. data/lib/mws/reports/parsers/report_schedule_list.rb +0 -23
  94. data/lib/mws/reports/parsers/report_scheduler.rb +0 -19
  95. data/lib/mws/reports/requests/report.rb +0 -18
  96. data/lib/mws/reports/requests/report_acknowledgements.rb +0 -27
  97. data/lib/mws/reports/requests/report_count.rb +0 -20
  98. data/lib/mws/reports/requests/report_list.rb +0 -30
  99. data/lib/mws/reports/requests/report_request.rb +0 -21
  100. data/lib/mws/reports/requests/report_request_count.rb +0 -20
  101. data/lib/mws/reports/requests/report_request_list.rb +0 -30
  102. data/lib/mws/reports/requests/report_requests.rb +0 -20
  103. data/lib/mws/reports/requests/report_schedule_count.rb +0 -19
  104. data/lib/mws/reports/requests/report_schedule_list.rb +0 -23
  105. data/lib/mws/reports/requests/report_scheduler.rb +0 -29
  106. data/lib/mws/sellers/client.rb +0 -53
  107. data/lib/mws/sellers/parsers/marketplace.rb +0 -33
  108. data/lib/mws/sellers/parsers/marketplace_participations.rb +0 -32
  109. data/lib/mws/sellers/parsers/participation.rb +0 -21
  110. data/lib/mws/sellers/parsers/service_status.rb +0 -36
  111. data/lib/mws/sellers/parsers/service_status_message.rb +0 -17
  112. data/lib/mws/sellers/requests/marketplace_participations.rb +0 -27
  113. data/lib/mws/sellers/requests/service_status.rb +0 -15
  114. data/lib/mws/subscriptions/client.rb +0 -7
  115. data/lib/peddler/parsers/base.rb +0 -15
  116. data/lib/peddler/parsers/collection.rb +0 -23
  117. data/lib/peddler/parsers/counter.rb +0 -13
  118. data/lib/peddler/parsers/model.rb +0 -42
  119. data/lib/peddler/parsers/text.rb +0 -8
  120. data/lib/peddler/parsers/tokenable.rb +0 -13
  121. data/lib/peddler/parsers/xml.rb +0 -30
  122. data/lib/peddler/request/parameters.rb +0 -57
  123. data/lib/peddler/request/structured_list.rb +0 -48
  124. data/lib/peddler/request.rb +0 -52
  125. data/lib/peddler/response/base.rb +0 -0
  126. data/lib/peddler/response/payload/base.rb +0 -0
  127. data/lib/peddler/response/payload/csv.rb +0 -0
  128. data/lib/peddler/response/payload/xml.rb +0 -0
  129. data/lib/peddler/response.rb +0 -27
  130. data/test/fixtures/feeds/feed_submission.xml +0 -14
  131. data/test/fixtures/feeds/feed_submission_count.xml +0 -9
  132. data/test/fixtures/feeds/feed_submission_list.xml +0 -17
  133. data/test/fixtures/feeds/feed_submissions.xml +0 -15
  134. data/test/fixtures/mws.yml +0 -12
  135. data/test/fixtures/mws.yml.example +0 -4
  136. data/test/fixtures/orders/order_items.xml +0 -83
  137. data/test/fixtures/orders/orders.xml +0 -109
  138. data/test/fixtures/orders/service_status.xml +0 -19
  139. data/test/fixtures/reports/report.xml +0 -8
  140. data/test/fixtures/reports/report_acknowledgements.xml +0 -18
  141. data/test/fixtures/reports/report_count.xml +0 -9
  142. data/test/fixtures/reports/report_list.xml +0 -17
  143. data/test/fixtures/reports/report_request_count.xml +0 -9
  144. data/test/fixtures/reports/report_request_list.xml +0 -24
  145. data/test/fixtures/reports/report_requests.xml +0 -19
  146. data/test/fixtures/reports/report_schedule_count.xml +0 -10
  147. data/test/fixtures/reports/report_schedule_list.xml +0 -16
  148. data/test/fixtures/reports/report_scheduler.xml +0 -15
  149. data/test/fixtures/sellers/market_participations.xml +0 -27
  150. data/test/fixtures/sellers/service_status.xml +0 -9
  151. data/test/integration/feeds/test_feed_submission_count.rb +0 -13
  152. data/test/integration/feeds/test_feed_submission_list.rb +0 -17
  153. data/test/integration/feeds/test_feed_submission_result.rb +0 -15
  154. data/test/integration/orders/test_order_items.rb +0 -19
  155. data/test/integration/orders/test_orders.rb +0 -23
  156. data/test/integration/orders/test_service_status.rb +0 -12
  157. data/test/integration/reports/test_report.rb +0 -15
  158. data/test/integration/reports/test_report_count.rb +0 -13
  159. data/test/integration/reports/test_report_list.rb +0 -17
  160. data/test/integration/reports/test_report_request_count.rb +0 -13
  161. data/test/integration/reports/test_report_request_list.rb +0 -17
  162. data/test/integration/reports/test_report_schedule_count.rb +0 -13
  163. data/test/integration/reports/test_report_schedule_list.rb +0 -13
  164. data/test/integration/reports/test_report_scheduler.rb +0 -16
  165. data/test/integration/sellers/test_marketplace_participations.rb +0 -13
  166. data/test/integration/sellers/test_service_status.rb +0 -12
  167. data/test/mws/feeds/parsers/test_feed.rb +0 -13
  168. data/test/mws/feeds/parsers/test_feed_submission_count.rb +0 -13
  169. data/test/mws/feeds/parsers/test_feed_submission_info.rb +0 -25
  170. data/test/mws/feeds/parsers/test_feed_submission_list.rb +0 -18
  171. data/test/mws/feeds/parsers/test_feed_submission_result.rb +0 -13
  172. data/test/mws/feeds/parsers/test_feed_submissions.rb +0 -17
  173. data/test/mws/feeds/requests/test_feed.rb +0 -63
  174. data/test/mws/feeds/requests/test_feed_submission_count.rb +0 -23
  175. data/test/mws/feeds/requests/test_feed_submission_list.rb +0 -37
  176. data/test/mws/feeds/requests/test_feed_submissions.rb +0 -29
  177. data/test/mws/orders/parsers/test_order.rb +0 -86
  178. data/test/mws/orders/parsers/test_order_item.rb +0 -69
  179. data/test/mws/orders/parsers/test_order_items.rb +0 -18
  180. data/test/mws/orders/parsers/test_orders.rb +0 -18
  181. data/test/mws/orders/parsers/test_payment_execution_detail.rb +0 -14
  182. data/test/mws/orders/parsers/test_payment_execution_detail_item.rb +0 -17
  183. data/test/mws/orders/parsers/test_service_status.rb +0 -39
  184. data/test/mws/orders/parsers/test_service_status_message.rb +0 -17
  185. data/test/mws/orders/parsers/test_shipping_address.rb +0 -36
  186. data/test/mws/orders/requests/test_order_items.rb +0 -36
  187. data/test/mws/orders/requests/test_orders.rb +0 -46
  188. data/test/mws/orders/requests/test_service_status.rb +0 -25
  189. data/test/mws/reports/parsers/test_report_acknowledgments.rb +0 -14
  190. data/test/mws/reports/parsers/test_report_count.rb +0 -13
  191. data/test/mws/reports/parsers/test_report_info.rb +0 -29
  192. data/test/mws/reports/parsers/test_report_list.rb +0 -18
  193. data/test/mws/reports/parsers/test_report_request.rb +0 -13
  194. data/test/mws/reports/parsers/test_report_request_count.rb +0 -13
  195. data/test/mws/reports/parsers/test_report_request_info.rb +0 -49
  196. data/test/mws/reports/parsers/test_report_request_list.rb +0 -18
  197. data/test/mws/reports/parsers/test_report_requests.rb +0 -17
  198. data/test/mws/reports/parsers/test_report_schedule_count.rb +0 -13
  199. data/test/mws/reports/parsers/test_report_schedule_list.rb +0 -18
  200. data/test/mws/reports/parsers/test_report_scheduler.rb +0 -17
  201. data/test/mws/reports/requests/test_acknowledgements.rb +0 -36
  202. data/test/mws/reports/requests/test_report_count.rb +0 -23
  203. data/test/mws/reports/requests/test_report_list.rb +0 -39
  204. data/test/mws/reports/requests/test_report_request.rb +0 -31
  205. data/test/mws/reports/requests/test_report_request_count.rb +0 -23
  206. data/test/mws/reports/requests/test_report_request_list.rb +0 -44
  207. data/test/mws/reports/requests/test_report_requests.rb +0 -29
  208. data/test/mws/reports/requests/test_report_schedule_count.rb +0 -22
  209. data/test/mws/reports/requests/test_report_schedule_list.rb +0 -36
  210. data/test/mws/reports/requests/test_report_scheduler.rb +0 -33
  211. data/test/mws/sellers/parsers/test_market_participations.rb +0 -19
  212. data/test/mws/sellers/parsers/test_service_status.rb +0 -35
  213. data/test/mws/sellers/requests/test_marketplace_participation_list.rb +0 -39
  214. data/test/mws/sellers/requests/test_service_status.rb +0 -25
  215. data/test/parser_helper.rb +0 -11
  216. data/test/peddler/parsers/test_collection.rb +0 -8
  217. data/test/peddler/parsers/test_model.rb +0 -70
  218. data/test/peddler/request/test_parameters.rb +0 -35
  219. data/test/peddler/test_client.rb +0 -42
  220. data/test/request_helper.rb +0 -20
@@ -1,23 +0,0 @@
1
- require 'peddler/parsers/collection'
2
- require 'mws/feeds/parsers/feed_submission_info'
3
- require 'peddler/parsers/tokenable'
4
-
5
- module MWS
6
- module Feeds
7
- module Parsers
8
- class FeedSubmissionList < ::Peddler::Parsers::Collection
9
- include ::Peddler::Parsers::Tokenable
10
-
11
- def each(&blk)
12
- feed_submission_info_nodes.each { |node| yield FeedSubmissionInfo.new(node) }
13
- end
14
-
15
- private
16
-
17
- def feed_submission_info_nodes
18
- xpath('FeedSubmissionInfo')
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,10 +0,0 @@
1
- require 'peddler/parsers/text'
2
-
3
- module MWS
4
- module Feeds
5
- module Parsers
6
- class FeedSubmissionResult < ::Peddler::Parsers::Text
7
- end
8
- end
9
- end
10
- end
@@ -1,18 +0,0 @@
1
- require 'peddler/parsers/model'
2
- require 'mws/feeds/parsers/feed_submission_info'
3
-
4
- module MWS
5
- module Feeds
6
- module Parsers
7
- class FeedSubmissions < ::Peddler::Parsers::Model
8
- value :count do
9
- integer_at_xpath('Count')
10
- end
11
-
12
- def feed_submissions
13
- xpath('FeedSubmissionInfo').map { |node| FeedSubmissionInfo.new(node) }
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,38 +0,0 @@
1
- require 'peddler/request'
2
- require 'mws/feeds/parsers/feed'
3
-
4
- module MWS
5
- module Feeds
6
- module Requests
7
- class Feed < ::Peddler::Request
8
- def submit(content, type, options = {})
9
- self.body = content
10
- set_content_type
11
- parameters(:submit_feed)
12
- .update(feed_type: type)
13
- .update(options)
14
- .format_structured_lists!
15
- .camelize_keys!
16
-
17
- execute
18
- end
19
-
20
- def set_content_type
21
- headers['Content-Type'] =
22
- if body.start_with?('<?xml')
23
- 'text/xml; charset=ISO-8859-1'
24
- else
25
- case client.default_country
26
- when 'JP'
27
- 'text/tab-separated-values; charset=Shift_JIS'
28
- when 'CN'
29
- 'text/tab-separated-values; charset=UTF-16'
30
- else
31
- 'text/tab-separated-values; charset=ISO-8859-1'
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,20 +0,0 @@
1
- require 'peddler/request'
2
- require 'mws/feeds/parsers/feed_submission_count'
3
-
4
- module MWS
5
- module Feeds
6
- module Requests
7
- class FeedSubmissionCount < ::Peddler::Request
8
- def get(options = {})
9
- parameters(:get_feed_submission_count)
10
- .update(options)
11
- .timestamp!
12
- .format_structured_lists!
13
- .camelize_keys!
14
-
15
- execute
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,30 +0,0 @@
1
- require 'peddler/request'
2
- require 'mws/feeds/parsers/feed_submission_list'
3
-
4
- module MWS
5
- module Feeds
6
- module Requests
7
- class FeedSubmissionList < ::Peddler::Request
8
- def get(options = {})
9
- parameters(:get_feed_submission_list)
10
- .update(options)
11
- .timestamp!
12
- .format_structured_lists!
13
- .camelize_keys!
14
-
15
- execute
16
- end
17
-
18
- def get_by_next_token(token = next_token)
19
- return false unless token
20
-
21
- parameters(:get_feed_submission_list_by_next_token)
22
- .update(next_token: token)
23
- .camelize_keys!
24
-
25
- execute
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,18 +0,0 @@
1
- require 'peddler/request'
2
- require 'mws/feeds/parsers/feed_submission_result'
3
-
4
- module MWS
5
- module Feeds
6
- module Requests
7
- class FeedSubmissionResult < ::Peddler::Request
8
- def get(feed_submission_id)
9
- parameters(:get_feed_submission_result)
10
- .update(feed_submission_id: feed_submission_id)
11
- .camelize_keys!
12
-
13
- execute
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,20 +0,0 @@
1
- require 'peddler/request'
2
- require 'mws/feeds/parsers/feed_submissions'
3
-
4
- module MWS
5
- module Feeds
6
- module Requests
7
- class FeedSubmissions < ::Peddler::Request
8
- def cancel(options = {})
9
- parameters(:cancel_feed_submissions)
10
- .update(options)
11
- .timestamp!
12
- .format_structured_lists!
13
- .camelize_keys!
14
-
15
- execute
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,7 +0,0 @@
1
- module MWS
2
- module FulfillmentInboundShipment
3
- class Client < ::Peddler::Client
4
- path 'FulfillmentInboundShipment/2010-10-01'
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module MWS
2
- module FulfillmentInventory
3
- class Client < ::Peddler::Client
4
- path 'FulfillmentInventory/2010-10-01'
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module MWS
2
- module FulfillmentOutboundShipment
3
- class Client < ::Peddler::Client
4
- path 'FulfillmentOutboundShipment/2010-10-01'
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module MWS
2
- module OffAmazonPayments
3
- class Client < ::Peddler::Client
4
- path 'OffAmazonPayments/2013-01-01/'
5
- end
6
- end
7
- end
@@ -1,98 +0,0 @@
1
- require 'mws/orders/requests/orders'
2
- require 'mws/orders/requests/order_items'
3
- require 'mws/orders/requests/service_status'
4
- require 'peddler/client'
5
-
6
- module MWS
7
- module Orders
8
- # With the MWS Orders API, you can list orders created or updated during a
9
- # time frame you specify or retrieve information about specific orders.
10
- class Client < ::Peddler::Client
11
- path 'Orders/2011-01-01'
12
-
13
- # Public: Get one or more orders.
14
- #
15
- # amazon_order_ids - One or more String Amazon order ids.
16
- #
17
- # Examples
18
- #
19
- # client.get_order('123-1234567-1234567')
20
- #
21
- # Returns an enumerable list of Orders.
22
- def_delegator :orders, :get, :get_order
23
-
24
- # Public: List orders created or updated during a specified time frame.
25
- #
26
- # options - The Hash query parameters used to narrow the list. Refer to
27
- # the MWS Orders API for available parameters.
28
- #
29
- # Examples
30
- #
31
- # client.list_orders(created_after: 1.week.ago)
32
- #
33
- # Returns an enumerable list of Orders.
34
- def_delegator :orders, :list, :list_orders
35
-
36
- # Public: List the next page of orders using the NextToken parameter.
37
- #
38
- # token - A String token (default: The token returned in the last
39
- # request).
40
- #
41
- # Examples
42
- #
43
- # client.list_orders_by_next_token
44
- #
45
- # Returns an enumerable list of Orders or false if there are no more pages
46
- # left.
47
- def_delegator :orders, :list_by_next_token, :list_orders_by_next_token
48
-
49
- # Public: List order items for an amazon order.
50
- #
51
- # amazon_order_id - The String Amazon order id.
52
- #
53
- # Examples
54
- #
55
- # client.list_order_items('123-1234567-1234567')
56
- #
57
- # Returns an enumerable list of Order Items.
58
- def_delegator :order_items, :list, :list_order_items
59
-
60
- # Public: List the next page of order items using the NextToken
61
- # parameter.
62
- #
63
- # token - A String token (default: The token returned in the last
64
- # request).
65
- #
66
- # Examples
67
- #
68
- # client.list_order_items_by_next_token
69
- #
70
- # Returns an enumerable list of Order Items or false if there are no more
71
- # pages left.
72
- def_delegator :order_items, :list_by_next_token, :list_order_items_by_next_token
73
-
74
- # Public: Get the service status of the API.
75
- #
76
- # Examples
77
- #
78
- # client.get_service_status
79
- #
80
- # Returns the Service Status.
81
- def_delegator :service_status, :get, :get_service_status
82
-
83
- private
84
-
85
- def orders
86
- @orders ||= Requests::Orders.new(self)
87
- end
88
-
89
- def order_items
90
- @order_items ||= Requests::OrderItems.new(self)
91
- end
92
-
93
- def service_status
94
- @service_status ||= Requests::ServiceStatus.new(self)
95
- end
96
- end
97
- end
98
- end
@@ -1,25 +0,0 @@
1
- require 'peddler/parsers/model'
2
-
3
- module MWS
4
- module Orders
5
- module Parser
6
- class InvoiceData < ::Peddler::Parsers::Model
7
- value :invoice_requirement do
8
- text_at_xpath('InvoiceRequirement')
9
- end
10
-
11
- value :buyer_selected_invoice_category do
12
- text_at_xpath('BuyerSelectedInvoiceCategory')
13
- end
14
-
15
- value :invoice_title do
16
- text_at_xpath('InvoiceTitle')
17
- end
18
-
19
- value :invoice_information do
20
- text_at_xpath('InvoiceInformation')
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,113 +0,0 @@
1
- require 'mws/orders/parsers/shipping_address'
2
- require 'mws/orders/parsers/payment_execution_detail'
3
- require 'peddler/parsers/model'
4
-
5
- module MWS
6
- module Orders
7
- module Parsers
8
- class Order < ::Peddler::Parsers::Model
9
- value :amazon_order_id do
10
- text_at_xpath('AmazonOrderId')
11
- end
12
-
13
- value :seller_order_id do
14
- text_at_xpath('SellerOrderId')
15
- end
16
-
17
- value :purchased_at do
18
- time_at_xpath('PurchaseDate')
19
- end
20
-
21
- value :last_updated_at do
22
- time_at_xpath('LastUpdateDate')
23
- end
24
-
25
- value :status do
26
- text_at_xpath('OrderStatus')
27
- end
28
-
29
- value :fulfillment_channel do
30
- text_at_xpath('FulfillmentChannel')
31
- end
32
-
33
- value :sales_channel do
34
- text_at_xpath('SalesChannel')
35
- end
36
-
37
- value :order_channel do
38
- text_at_xpath('OrderChannel')
39
- end
40
-
41
- value :ship_service_level do
42
- text_at_xpath('ShipServiceLevel')
43
- end
44
-
45
- value :shipping_address do
46
- node = at_xpath('ShippingAddress')
47
- ShippingAddress.new(node) if node
48
- end
49
-
50
- value :total do
51
- money_at_xpath('OrderTotal')
52
- end
53
-
54
- value :number_of_items_shipped do
55
- integer_at_xpath('NumberOfItemsShipped')
56
- end
57
-
58
- value :number_of_items_unshipped do
59
- integer_at_xpath('NumberOfItemsUnshipped')
60
- end
61
-
62
- value :payment_execution_detail do
63
- node = at_xpath('PaymentExecutionDetail')
64
- PaymentExecutionDetail.new(node) if node
65
- end
66
-
67
- value :payment_method do
68
- text_at_xpath('PaymentMethod')
69
- end
70
-
71
- value :marketplace_id do
72
- text_at_xpath('MarketplaceId')
73
- end
74
-
75
- value :buyer_name do
76
- text_at_xpath('BuyerName')
77
- end
78
-
79
- value :buyer_email do
80
- text_at_xpath('BuyerEmail')
81
- end
82
-
83
- value :shipment_service_level_category do
84
- text_at_xpath('ShipmentServiceLevelCategory')
85
- end
86
-
87
- value :cba_displayable_shipping_label do
88
- text_at_xpath('CbaDisplayableShippingLabel')
89
- end
90
-
91
- value :shipped_by_amazon_tfm do
92
- text_at_xpath('ShippedByAmazonTFM')
93
- end
94
-
95
- value :tfm_shipment_status do
96
- text_at_xpath('TFMShipmentStatus')
97
- end
98
-
99
- value :type do
100
- text_at_xpath('OrderType')
101
- end
102
-
103
- value :earliest_shipped_at do
104
- time_at_xpath('EarliestShipDate')
105
- end
106
-
107
- value :latest_shipped_at do
108
- time_at_xpath('LatestShipDate')
109
- end
110
- end
111
- end
112
- end
113
- end
@@ -1,110 +0,0 @@
1
- require 'mws/orders/parsers/invoice_data'
2
- require 'peddler/parsers/model'
3
-
4
- module MWS
5
- module Orders
6
- module Parsers
7
- class OrderItem < ::Peddler::Parsers::Model
8
- value :asin do
9
- text_at_xpath('ASIN')
10
- end
11
-
12
- value :seller_sku do
13
- text_at_xpath('SellerSKU')
14
- end
15
-
16
- value :order_item_id do
17
- text_at_xpath('OrderItemId')
18
- end
19
-
20
- value :title do
21
- text_at_xpath('Title')
22
- end
23
-
24
- value :quantity_ordered do
25
- integer_at_xpath('QuantityOrdered')
26
- end
27
-
28
- value :quantity_shipped do
29
- integer_at_xpath('QuantityShipped')
30
- end
31
-
32
- value :gift_message_text do
33
- text_at_xpath('GiftMessageText')
34
- end
35
-
36
- value :gift_wrap_level do
37
- text_at_xpath('GiftWrapLevel')
38
- end
39
-
40
- value :item_price do
41
- money_at_xpath('ItemPrice')
42
- end
43
-
44
- value :shipping_price do
45
- money_at_xpath('ShippingPrice')
46
- end
47
-
48
- value :gift_wrap_price do
49
- money_at_xpath('GiftWrapPrice')
50
- end
51
-
52
- value :item_tax do
53
- money_at_xpath('ItemTax')
54
- end
55
-
56
- value :shipping_tax do
57
- money_at_xpath('ShippingTax')
58
- end
59
-
60
- value :gift_wrap_tax do
61
- money_at_xpath('GiftWrapPrice')
62
- end
63
-
64
- value :shipping_discount do
65
- money_at_xpath('ShippingDiscount')
66
- end
67
-
68
- value :promotion_discount do
69
- money_at_xpath('PromotionDiscount')
70
- end
71
-
72
- value :promotion_ids do
73
- xpath('PromotionId').map(&:text)
74
- end
75
-
76
- value :cod_fee do
77
- money_at_xpath('CODFee')
78
- end
79
-
80
- value :cod_fee_discount do
81
- money_at_xpath('CODFeeDiscount')
82
- end
83
-
84
- value :invoice_data do
85
- xpath('InvoiceData').map { |node| InvoiceData.new(node) }
86
- end
87
-
88
- value :condition_id do
89
- text_at_xpath('ConditionId')
90
- end
91
-
92
- value :condition_subtype_id do
93
- text_at_xpath('ConditionSubtypeId')
94
- end
95
-
96
- value :condition_note do
97
- text_at_xpath('ConditionNote')
98
- end
99
-
100
- value :scheduled_delivery_ends_at do
101
- time_at_xpath('ScheduledDeliveryEndDate')
102
- end
103
-
104
- value :scheduled_delivery_starts_at do
105
- time_at_xpath('ScheduledDeliveryStartDate')
106
- end
107
- end
108
- end
109
- end
110
- end
@@ -1,23 +0,0 @@
1
- require 'mws/orders/parsers/order_item'
2
- require 'peddler/parsers/collection'
3
- require 'peddler/parsers/tokenable'
4
-
5
- module MWS
6
- module Orders
7
- module Parsers
8
- class OrderItems < ::Peddler::Parsers::Collection
9
- include ::Peddler::Parsers::Tokenable
10
-
11
- def each(&blk)
12
- order_item_nodes.each { |node| yield OrderItem.new(node) }
13
- end
14
-
15
- private
16
-
17
- def order_item_nodes
18
- xpath('OrderItems/OrderItem')
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,23 +0,0 @@
1
- require 'mws/orders/parsers/order'
2
- require 'peddler/parsers/collection'
3
- require 'peddler/parsers/tokenable'
4
-
5
- module MWS
6
- module Orders
7
- module Parsers
8
- class Orders < ::Peddler::Parsers::Collection
9
- include ::Peddler::Parsers::Tokenable
10
-
11
- def each(&blk)
12
- order_nodes.each { |node| yield Order.new(node) }
13
- end
14
-
15
- private
16
-
17
- def order_nodes
18
- xpath('Orders/Order')
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,20 +0,0 @@
1
- require 'mws/orders/parsers/payment_execution_detail_item'
2
- require 'peddler/parsers/collection'
3
-
4
- module MWS
5
- module Orders
6
- module Parsers
7
- class PaymentExecutionDetail < ::Peddler::Parsers::Collection
8
- def each(&blk)
9
- payment_execution_detail_item_nodes.each { |node| yield PaymentExecutionDetailItem.new(node) }
10
- end
11
-
12
- private
13
-
14
- def payment_execution_detail_item_nodes
15
- xpath('PaymentExecutionDetailItem')
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- require 'peddler/parsers/model'
2
-
3
- module MWS
4
- module Orders
5
- module Parsers
6
- class PaymentExecutionDetailItem < ::Peddler::Parsers::Model
7
- value :payment do
8
- money_at_xpath('Payment')
9
- end
10
-
11
- value :payment_method do
12
- text_at_xpath('PaymentMethod')
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,36 +0,0 @@
1
- require 'mws/orders/parsers/service_status_message'
2
- require 'peddler/parsers/model'
3
-
4
- module MWS
5
- module Orders
6
- module Parsers
7
- class ServiceStatus < ::Peddler::Parsers::Model
8
- value :status do
9
- text_at_xpath('Status')
10
- end
11
-
12
- value :timestamp do
13
- time_at_xpath('Timestamp')
14
- end
15
-
16
- value :message_id do
17
- text_at_xpath('MessageId')
18
- end
19
-
20
- value :messages do
21
- xpath('Messages/Message').map { |node| ServiceStatusMessage.new(node) }
22
- end
23
-
24
- def ok?
25
- status == 'GREEN'
26
- end
27
-
28
- def inspect
29
- status
30
- end
31
-
32
- alias :to_s :inspect
33
- end
34
- end
35
- end
36
- end