amazon-mws-plus 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.project +12 -0
  4. data/Gemfile +13 -0
  5. data/README.markdown +30 -0
  6. data/Rakefile +50 -0
  7. data/amazon-mws-plus.gemspec +23 -0
  8. data/amazon-mws.tmproj +27 -0
  9. data/examples/xml/cancel_feed_submissions.xml +16 -0
  10. data/examples/xml/cancel_fulfillment_order.xml +6 -0
  11. data/examples/xml/cancel_report_requests.xml +18 -0
  12. data/examples/xml/create_fulfillment_order.xml +6 -0
  13. data/examples/xml/error.xml +10 -0
  14. data/examples/xml/get_feed_submission_count.xml +10 -0
  15. data/examples/xml/get_feed_submission_list.xml +18 -0
  16. data/examples/xml/get_feed_submission_list_by_next_token.xml +16 -0
  17. data/examples/xml/get_feed_submission_result.xml +30 -0
  18. data/examples/xml/get_fulfillment_order.xml +113 -0
  19. data/examples/xml/get_fulfillment_preview.xml +148 -0
  20. data/examples/xml/get_matching_product.xml +115 -0
  21. data/examples/xml/get_matching_product_for_id.xml +119 -0
  22. data/examples/xml/get_report.xml +237 -0
  23. data/examples/xml/get_report_count.xml +9 -0
  24. data/examples/xml/get_report_list.xml +17 -0
  25. data/examples/xml/get_report_request_count.xml +8 -0
  26. data/examples/xml/get_report_request_list.xml +120 -0
  27. data/examples/xml/get_report_request_list_by_next_token.xml +20 -0
  28. data/examples/xml/get_report_schedule_count.xml +10 -0
  29. data/examples/xml/get_report_schedule_list.xml +15 -0
  30. data/examples/xml/get_report_schedule_list_by_next_token.xml +15 -0
  31. data/examples/xml/list_all_fulfillment_orders.xml +69 -0
  32. data/examples/xml/list_all_fulfillment_orders_by_next_token.xml +61 -0
  33. data/examples/xml/manage_report_schedule.xml +14 -0
  34. data/examples/xml/orders_request.xml +39 -0
  35. data/examples/xml/request_order_items.xml +51 -0
  36. data/examples/xml/request_order_items_by_next_token.xml +51 -0
  37. data/examples/xml/request_orders.xml +43 -0
  38. data/examples/xml/request_orders_by_next_token.xml +69 -0
  39. data/examples/xml/request_report.xml +17 -0
  40. data/examples/xml/submit_feed.xml +14 -0
  41. data/examples/xml/update_report_acknowledgements.xml +18 -0
  42. data/examples/xsd/Inventory.xsd +49 -0
  43. data/examples/xsd/Item.xsd +285 -0
  44. data/examples/xsd/Listings.xsd +32 -0
  45. data/examples/xsd/OrderAcknowledgement.xsd +55 -0
  46. data/examples/xsd/OrderAdjustment.xsd +94 -0
  47. data/examples/xsd/OrderFulfillment.xsd +57 -0
  48. data/examples/xsd/Override.xsd +48 -0
  49. data/examples/xsd/Price.xsd +59 -0
  50. data/examples/xsd/ProcessingReport.xsd +87 -0
  51. data/examples/xsd/Product.xsd +220 -0
  52. data/examples/xsd/Product/AutoAccessory.xsd +807 -0
  53. data/examples/xsd/Product/Beauty.xsd +114 -0
  54. data/examples/xsd/Product/CE.xsd +544 -0
  55. data/examples/xsd/Product/CameraPhoto.xsd +2410 -0
  56. data/examples/xsd/Product/FoodAndBeverages.xsd +270 -0
  57. data/examples/xsd/Product/Gourmet.xsd +85 -0
  58. data/examples/xsd/Product/Health.xsd +189 -0
  59. data/examples/xsd/Product/Home.xsd +654 -0
  60. data/examples/xsd/Product/Jewelry.xsd +603 -0
  61. data/examples/xsd/Product/Miscellaneous.xsd +157 -0
  62. data/examples/xsd/Product/MusicalInstruments.xsd +853 -0
  63. data/examples/xsd/Product/Office.xsd +550 -0
  64. data/examples/xsd/Product/PetSupplies.xsd +40 -0
  65. data/examples/xsd/Product/ProductClothing.xsd +197 -0
  66. data/examples/xsd/Product/SWVG.xsd +238 -0
  67. data/examples/xsd/Product/Sports.xsd +308 -0
  68. data/examples/xsd/Product/TiresAndWheels.xsd +159 -0
  69. data/examples/xsd/Product/Tools.xsd +62 -0
  70. data/examples/xsd/Product/ToysBaby.xsd +241 -0
  71. data/examples/xsd/Product/Wireless.xsd +77 -0
  72. data/examples/xsd/ProductImage.xsd +39 -0
  73. data/examples/xsd/Relationship.xsd +47 -0
  74. data/examples/xsd/SettlementReport.xsd +158 -0
  75. data/examples/xsd/amzn-base.xsd +1600 -0
  76. data/examples/xsd/amzn-envelope.xsd +98 -0
  77. data/examples/xsd/amzn-header.xsd +45 -0
  78. data/lib/amazon-mws.rb +6 -0
  79. data/lib/amazon/mws.rb +69 -0
  80. data/lib/amazon/mws/authentication.rb +10 -0
  81. data/lib/amazon/mws/authentication/query_string.rb +36 -0
  82. data/lib/amazon/mws/authentication/signature.rb +43 -0
  83. data/lib/amazon/mws/base.rb +74 -0
  84. data/lib/amazon/mws/connection.rb +107 -0
  85. data/lib/amazon/mws/connection/management.rb +95 -0
  86. data/lib/amazon/mws/connection/request_builder.rb +67 -0
  87. data/lib/amazon/mws/exceptions.rb +55 -0
  88. data/lib/amazon/mws/lib/extensions.rb +178 -0
  89. data/lib/amazon/mws/lib/memoizable.rb +10 -0
  90. data/lib/amazon/mws/request/feed.rb +276 -0
  91. data/lib/amazon/mws/request/feed_builder.rb +83 -0
  92. data/lib/amazon/mws/request/fulfillment.rb +50 -0
  93. data/lib/amazon/mws/request/orders.rb +107 -0
  94. data/lib/amazon/mws/request/products.rb +38 -0
  95. data/lib/amazon/mws/request/report.rb +330 -0
  96. data/lib/amazon/mws/response.rb +43 -0
  97. data/lib/amazon/mws/response/feed/cancel_feed_submissions_response.rb +15 -0
  98. data/lib/amazon/mws/response/feed/get_feed_submission_count_response.rb +13 -0
  99. data/lib/amazon/mws/response/feed/get_feed_submission_list_by_next_token_response.rb +17 -0
  100. data/lib/amazon/mws/response/feed/get_feed_submission_list_response.rb +16 -0
  101. data/lib/amazon/mws/response/feed/get_feed_submission_result_response.rb +54 -0
  102. data/lib/amazon/mws/response/feed/models/feed_submission.rb +16 -0
  103. data/lib/amazon/mws/response/feed/submit_feed_response.rb +15 -0
  104. data/lib/amazon/mws/response/fulfillment_order/cancel_fulfillment_order_response.rb +11 -0
  105. data/lib/amazon/mws/response/fulfillment_order/create_fulfillment_order_response.rb +12 -0
  106. data/lib/amazon/mws/response/fulfillment_order/get_fulfillment_order_response.rb +19 -0
  107. data/lib/amazon/mws/response/fulfillment_order/list_all_fulfillment_orders_by_next_token_response.rb +16 -0
  108. data/lib/amazon/mws/response/fulfillment_order/list_all_fulfillment_orders_response.rb +15 -0
  109. data/lib/amazon/mws/response/fulfillment_order/models/fulfillment_address.rb +18 -0
  110. data/lib/amazon/mws/response/fulfillment_order/models/fulfillment_order.rb +24 -0
  111. data/lib/amazon/mws/response/fulfillment_order/models/fulfillment_order_item.rb +20 -0
  112. data/lib/amazon/mws/response/fulfillment_order/models/fulfillment_shipment.rb +18 -0
  113. data/lib/amazon/mws/response/fulfillment_order/models/fulfillment_shipment_item.rb +14 -0
  114. data/lib/amazon/mws/response/order/models/order.rb +43 -0
  115. data/lib/amazon/mws/response/order/models/order_item.rb +48 -0
  116. data/lib/amazon/mws/response/order/models/promotion_id.rb +9 -0
  117. data/lib/amazon/mws/response/order/request_get_order_response.rb +15 -0
  118. data/lib/amazon/mws/response/order/request_order_items_response.rb +25 -0
  119. data/lib/amazon/mws/response/order/request_orders_response.rb +28 -0
  120. data/lib/amazon/mws/response/product/get_matching_proudct.rb +31 -0
  121. data/lib/amazon/mws/response/product/models/product.rb +36 -0
  122. data/lib/amazon/mws/response/report/cancel_report_requests_response.rb +16 -0
  123. data/lib/amazon/mws/response/report/get_report_count_response.rb +13 -0
  124. data/lib/amazon/mws/response/report/get_report_list_response.rb +17 -0
  125. data/lib/amazon/mws/response/report/get_report_request_count_response.rb +13 -0
  126. data/lib/amazon/mws/response/report/get_report_request_list_by_next_token_response.rb +17 -0
  127. data/lib/amazon/mws/response/report/get_report_request_list_response.rb +17 -0
  128. data/lib/amazon/mws/response/report/get_report_schedule_count_response.rb +13 -0
  129. data/lib/amazon/mws/response/report/get_report_schedule_list_by_next_token_response.rb +17 -0
  130. data/lib/amazon/mws/response/report/get_report_schedule_list_response.rb +17 -0
  131. data/lib/amazon/mws/response/report/manage_report_schedule_response.rb +16 -0
  132. data/lib/amazon/mws/response/report/models/report_info.rb +16 -0
  133. data/lib/amazon/mws/response/report/models/report_request.rb +20 -0
  134. data/lib/amazon/mws/response/report/models/report_schedule.rb +13 -0
  135. data/lib/amazon/mws/response/report/request_report_response.rb +15 -0
  136. data/lib/amazon/mws/response/report/update_reports_acknowledgements_response.rb +16 -0
  137. data/lib/amazon/mws/response/response.rb +43 -0
  138. data/lib/amazon/mws/response/response_error.rb +21 -0
  139. data/test/connection_test.rb +14 -0
  140. data/test/feed_builder_test.rb +74 -0
  141. data/test/feed_test.rb +144 -0
  142. data/test/fulfillment_order.rb +49 -0
  143. data/test/orders_test.rb +78 -0
  144. data/test/products_test.rb +28 -0
  145. data/test/query_string_test.rb +18 -0
  146. data/test/report_test.rb +88 -0
  147. data/test/response_test.rb +172 -0
  148. data/test/signature_test.rb +32 -0
  149. data/test/test_config.yml +6 -0
  150. data/test/test_helper.rb +33 -0
  151. metadata +335 -0
@@ -0,0 +1,9 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class PromotionId < Response
5
+ xml_name "PromotionId"
6
+ xml_reader :promotion_id
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'models/order'
2
+ module Amazon
3
+ module MWS
4
+
5
+ class RequestGetOrderResponse < Response
6
+ xml_name "GetOrderResponse"
7
+ result = "GetOrderResult"
8
+ namespace = "xmlns:"
9
+
10
+ xml_reader :request_id, :in => "ResponseMetadata"
11
+ xml_reader :orders, :as => [Order], :in => namespace + result + "/" + namespace + "Orders"
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'models/order_item'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class RequestOrderItemsResponse < Response
7
+ xml_name "ListOrderItemsResponse"
8
+ result = "ListOrderItemsResult"
9
+ xml_reader :next_token, :in => result
10
+ xml_reader :amazon_order_id, :in=> result
11
+ xml_reader :order_items, :as => [OrderItem], :in => "xmlns:ListOrderItemsResult/xmlns:OrderItems"
12
+ xml_reader :request_id, :in => "ResponseMetadata"
13
+ end
14
+
15
+ class RequestOrderItemsByNextTokenResponse < Response
16
+ xml_name "ListOrderItemsByNextTokenResponse"
17
+ result = "ListOrderItemsByNextTokenResult"
18
+ xml_reader :next_token, :in => result
19
+ xml_reader :amazon_order_id, :in=> result
20
+ xml_reader :order_items, :as => [OrderItem], :in => "xmlns:ListOrderItemsByNextTokenResult/xmlns:OrderItems"
21
+ xml_reader :request_id, :in => "ResponseMetadata"
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ require_relative 'models/order'
2
+ module Amazon
3
+ module MWS
4
+
5
+ class RequestOrdersResponse < Response
6
+ xml_name "ListOrdersResponse"
7
+ result = "ListOrdersResult"
8
+ namespace = "xmlns:"
9
+
10
+ xml_reader :next_token, :in => result
11
+ xml_reader :last_updated_before, :in => result, :as => DateTime
12
+ xml_reader :request_id, :in => "ResponseMetadata"
13
+ xml_reader :orders, :as => [Order], :in => namespace + result + "/" + namespace + "Orders"
14
+ end
15
+
16
+ class RequestOrdersByNextTokenResponse < Response
17
+ xml_name "ListOrdersByNextTokenResponse"
18
+ result = "ListOrdersByNextTokenResult"
19
+ namespace = "xmlns:"
20
+
21
+ xml_reader :next_token, :in => result
22
+ xml_reader :last_updated_before, :in => result, :as => DateTime
23
+ xml_reader :request_id, :in => "ResponseMetadata"
24
+ xml_reader :orders, :as => [Order], :in => namespace + result + "/" + namespace + "Orders"
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ require_relative 'models/product'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class GetMatchingProductResponse < Response
7
+ xml_name "GetMatchingProductResponse"
8
+ namespace = "xmlns:"
9
+
10
+ xml_reader :product, :as => [ProductRequest], :in => namespace + "GetMatchingProductResult/"
11
+ end
12
+
13
+ class GetMatchingProductForIdResult < Response
14
+ xml_name "GetMatchingProductForIdResult"
15
+ namespace = "xmlns:"
16
+
17
+ xml_reader :products, :as => [ProductRequest], :in => namespace + "Products"
18
+
19
+ end
20
+
21
+
22
+ class GetMatchingProductForIdResponse < Response
23
+ xml_name "GetMatchingProductForIdResponse"
24
+ namespace = "xmlns:"
25
+
26
+ xml_reader :results, :as => [GetMatchingProductForIdResult]
27
+ xml_reader :products, :as => [ProductRequest], :in => namespace + "GetMatchingProductForIdResult/" + namespace + "Products"
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,36 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class ProductRequest < Response
5
+
6
+ xml_name "Product"
7
+
8
+ xml_namespaces \
9
+ :xmlns => "http://mws.amazonservices.com/schema/Products/2011-10-01",
10
+ "xmlns2:ns2" => "http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd"
11
+
12
+ xml_reader :asin, :in => "xmlns:Identifiers/xmlns:MarketplaceASIN", :from => "ASIN"
13
+ xml_reader :binding, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
14
+ xml_reader :title, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
15
+ xml_reader :studio, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
16
+ xml_reader :brand, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
17
+ xml_reader :color, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
18
+ xml_reader :features, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2", :as => [], :from => "Feature"
19
+ xml_reader :label, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
20
+ xml_reader :manufacturer, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
21
+ xml_reader :package_quantity, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
22
+ xml_reader :product_group, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
23
+ xml_reader :product_type_name, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
24
+ xml_reader :publisher, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
25
+ xml_reader :size, :in => "xmlns:AttributeSets/ns2:ItemAttributes", :namespace => "ns2"
26
+ xml_reader :small_img_uri, :in => "xmlns:AttributeSets/ns2:ItemAttributes/ns2:SmallImage", :namespace => "ns2", :from => "URL"
27
+
28
+ xml_reader :list_price, :in => "xmlns:AttributesSets/ns2:ItemAttributes/ns2:ListPrice", :namespace => "ns2", :from => "Amount"
29
+ xml_reader :list_price_currency_code, :in => "xmlns:AttributesSets/ns2:ItemAttributes/ns2:ListPrice", :namespace => "ns2", :from => "CurrencyCode"
30
+
31
+ xml_reader :categories, :in => "xmlns:SalesRankings/xmlns:SalesRank", :from => "ProductCategoryId", :as => []
32
+
33
+ end
34
+ end
35
+ end
36
+
@@ -0,0 +1,16 @@
1
+ require_relative 'models/report_request'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class CancelReportRequestsResponse < Response
7
+ xml_name "CancelReportRequestsResponse"
8
+ result = "CancelReportRequestsResult"
9
+
10
+ xml_reader :count, :in => result, :as => Integer
11
+ xml_reader :report_requests, :as => [ReportRequest], :in => result
12
+ xml_reader :request_id, :in => "ResponseMetadata"
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class GetReportCountResponse < Response
5
+ xml_name "GetReportCountResponse"
6
+ result = "GetReportCountResult"
7
+
8
+ xml_reader :count, :in => result, :as => Integer
9
+ xml_reader :request_id, :in => "ResponseMetadata"
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'models/report_info'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class GetReportListResponse < Response
7
+ xml_name "GetReportListResponse"
8
+ result = "GetReportListResult"
9
+
10
+ xml_reader :has_next?, :in => result
11
+ xml_reader :next_token, :in => result
12
+ xml_reader :reports, :as => [ReportInfo], :in => result
13
+ xml_reader :request_id, :in => "ResponseMetadata"
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class GetReportRequestCountResponse < Response
5
+ xml_name "GetReportRequestCountResponse"
6
+ result = "GetReportRequestCountResult"
7
+
8
+ xml_reader :count, :in => result, :as => Integer
9
+ xml_reader :request_id, :in => "ResponseMetadata"
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'models/report_request'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class GetReportRequestListByNextTokenResponse < Response
7
+ xml_name "GetReportRequestListByNextTokenResponse"
8
+ result = "GetReportRequestListByNextTokenResult"
9
+
10
+ xml_reader :has_next?, :in => result
11
+ xml_reader :next_token, :in => result
12
+ xml_reader :report_requests, :as => [ReportRequest], :in => result
13
+ xml_reader :request_id, :in => "ResponseMetadata"
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'models/report_request'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class GetReportRequestListResponse < Response
7
+ xml_name "GetReportRequestListResponse"
8
+ result = "GetReportRequestListResult"
9
+
10
+ xml_reader :has_next?, :in => result
11
+ xml_reader :next_token, :in => result
12
+ xml_reader :report_requests, :as => [ReportRequest], :in => result
13
+ xml_reader :request_id, :in => "ResponseMetadata"
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class GetReportScheduleCountResponse < Response
5
+ xml_name "GetReportScheduleCountResponse"
6
+ result = "GetReportScheduleCountResult"
7
+
8
+ xml_reader :count, :in => result, :as => Integer
9
+ xml_reader :request_id, :in => "ResponseMetadata"
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'models/report_schedule'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class GetReportScheduleListByNextTokenResponse < Response
7
+ xml_name "GetReportScheduleListByNextTokenResponse"
8
+ result = "GetReportScheduleListByNextTokenResult"
9
+
10
+ xml_reader :has_next?, :in => result
11
+ xml_reader :next_token, :in => result
12
+ xml_reader :report_schedules, :as => [ReportSchedule], :in => result
13
+ xml_reader :request_id, :in => "ResponseMetadata"
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'models/report_schedule'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class GetReportScheduleListResponse < Response
7
+ xml_name "GetReportScheduleListResponse"
8
+ result = "GetReportScheduleListResult"
9
+
10
+ xml_reader :has_next?, :in => result
11
+ xml_reader :next_token, :in => result
12
+ xml_reader :report_schedules, :as => [ReportSchedule], :in => result
13
+ xml_reader :request_id, :in => "ResponseMetadata"
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'models/report_schedule'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class ManageReportScheduleResponse < Response
7
+ xml_name "ManageReportScheduleResponse"
8
+ result = "ManageReportScheduleResult"
9
+
10
+ xml_reader :count, :in => result, :as => Integer
11
+ xml_reader :request_id, :in => "ResponseMetadata"
12
+ xml_reader :report_schedule, :in => result, :as => ReportSchedule
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class ReportInfo < Response
5
+ xml_name "ReportInfo"
6
+
7
+ xml_reader :id, :from => "ReportId", :as => Integer
8
+ xml_reader :type, :from => "ReportType"
9
+ xml_reader :report_request_id, :as => Integer
10
+ xml_reader :available_date, :as => Time
11
+ xml_reader :acknowledged?
12
+ xml_reader :acknowledged_date, :as => Time
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class ReportRequest < Response
5
+ xml_name "ReportRequestInfo"
6
+
7
+ xml_reader :id, :from => "ReportRequestId", :as => Integer
8
+ xml_reader :report_id, :from => "GeneratedReportId", :as => Integer
9
+ xml_reader :report_type
10
+ xml_reader :start_date, :as => Time
11
+ xml_reader :end_date, :as => Time
12
+ xml_reader :scheduled?
13
+ xml_reader :submitted_date, :as => Time
14
+ xml_reader :report_processing_status
15
+ #xml_reader :started_processing_date, :as => Time
16
+ #xml_reader :completed_processing_date, :as => Time
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class ReportSchedule < Response
5
+ xml_name "ReportSchedule"
6
+
7
+ xml_reader :report_type
8
+ xml_reader :schedule
9
+ xml_reader :scheduled_date, :as => Time
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'models/report_request'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class RequestReportResponse < Response
7
+ xml_name "RequestReportResponse"
8
+ result = "RequestReportResult"
9
+
10
+ xml_reader :request_id, :in => "ResponseMetadata"
11
+ xml_reader :report_request, :in => result, :as => ReportRequest
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'models/report_info'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class UpdateReportAcknowledgementsResponse < Response
7
+ xml_name "UpdateReportAcknowledgementsResponse"
8
+ result = "UpdateReportAcknowledgementsResult"
9
+
10
+ xml_reader :count, :as => Integer, :in => result
11
+ xml_reader :reports, :as => [ReportInfo], :in => result
12
+ xml_reader :request_id, :in => "ResponseMetadata"
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,43 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class Response
5
+ include ROXML
6
+ xml_convention :camelcase
7
+
8
+ # This is the factoryish method that is called!, not new
9
+ def self.format(response)
10
+ if response.content_type =~ /xml/ || response.body =~ /<?xml/
11
+ parse_xml(response)
12
+ else
13
+ response.body
14
+ end
15
+ end
16
+
17
+ def self.parse_xml(response)
18
+ if [Net::HTTPClientError, Net::HTTPServerError].any? {|error| response.is_a? error }
19
+ return ResponseError.from_xml(response.body)
20
+ else
21
+ return self.from_xml(response.body)
22
+ end
23
+ end
24
+
25
+ def accessors
26
+ roxml_references.map {|r| r.accessor}
27
+ end
28
+
29
+ # render a ROXML object as a normal hash, eliminating the @ and some unneeded admin fields
30
+ def as_hash
31
+ obj_hash = {}
32
+ self.instance_variables.each do |v|
33
+ m = v.to_s.sub('@','')
34
+ if m != 'roxml_references' && m!= 'promotion_ids'
35
+ obj_hash[m.to_sym] = self.instance_variable_get(v)
36
+ end
37
+ end
38
+ obj_hash
39
+ end
40
+
41
+ end
42
+ end
43
+ end