peddler 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +15 -14
  4. data/lib/mws/cart_information/client.rb +72 -0
  5. data/lib/mws/cart_information.rb +1 -69
  6. data/lib/mws/customer_information/client.rb +79 -0
  7. data/lib/mws/customer_information.rb +1 -77
  8. data/lib/mws/feeds/client.rb +112 -0
  9. data/lib/mws/feeds.rb +1 -110
  10. data/lib/mws/fulfillment_inbound_shipment/client.rb +233 -0
  11. data/lib/mws/fulfillment_inbound_shipment.rb +1 -231
  12. data/lib/mws/fulfillment_inventory/client.rb +53 -0
  13. data/lib/mws/fulfillment_inventory.rb +1 -51
  14. data/lib/mws/fulfillment_outbound_shipment/client.rb +171 -0
  15. data/lib/mws/fulfillment_outbound_shipment.rb +1 -168
  16. data/lib/mws/off_amazon_payments/client.rb +362 -0
  17. data/lib/mws/off_amazon_payments.rb +1 -360
  18. data/lib/mws/orders/client.rb +102 -0
  19. data/lib/mws/orders.rb +1 -98
  20. data/lib/mws/products/client.rb +234 -0
  21. data/lib/mws/products.rb +1 -232
  22. data/lib/mws/recommendations/client.rb +71 -0
  23. data/lib/mws/recommendations.rb +1 -66
  24. data/lib/mws/reports/client.rb +220 -0
  25. data/lib/mws/reports.rb +1 -220
  26. data/lib/mws/sellers/client.rb +42 -0
  27. data/lib/mws/sellers.rb +1 -40
  28. data/lib/mws/subscriptions/client.rb +177 -0
  29. data/lib/mws/subscriptions.rb +1 -169
  30. data/lib/mws.rb +2 -2
  31. data/lib/peddler/client.rb +3 -3
  32. data/lib/peddler/flat_file_parser.rb +3 -3
  33. data/lib/peddler/operation.rb +2 -3
  34. data/lib/peddler/structured_list.rb +1 -3
  35. data/lib/peddler/version.rb +1 -1
  36. data/lib/peddler/xml_parser.rb +1 -1
  37. data/test/integration/test_cart_information.rb +2 -2
  38. data/test/integration/test_customer_information.rb +2 -2
  39. data/test/integration/test_feeds.rb +2 -2
  40. data/test/integration/test_fulfillment_inbound_shipment.rb +2 -2
  41. data/test/integration/test_fulfillment_inventory.rb +3 -7
  42. data/test/integration/test_fulfillment_outbound_shipment.rb +2 -49
  43. data/test/integration/test_off_amazon_payments.rb +2 -2
  44. data/test/integration/test_orders.rb +2 -13
  45. data/test/integration/test_products.rb +2 -2
  46. data/test/integration/test_recommendations.rb +2 -11
  47. data/test/integration/test_reports.rb +2 -3
  48. data/test/integration/test_sellers.rb +2 -9
  49. data/test/integration/test_subscriptions.rb +2 -2
  50. data/test/integration_test_helper.rb +49 -0
  51. data/test/mws.yml +16 -0
  52. data/test/mws.yml.bak +16 -0
  53. data/test/test_helper.rb +7 -0
  54. data/test/unit/mws/test_off_amazon_payments_client.rb +9 -0
  55. data/test/unit/mws/test_products_client.rb +9 -0
  56. data/test/unit/peddler/test_client.rb +2 -2
  57. data/test/unit/peddler/test_flat_file_parser.rb +2 -2
  58. data/test/unit/peddler/test_operation.rb +2 -2
  59. data/test/unit/peddler/test_parser.rb +2 -2
  60. data/test/unit/peddler/test_structured_list.rb +2 -2
  61. data/test/unit/peddler/test_xml_parser.rb +2 -2
  62. data/test/unit/test_mws.rb +3 -3
  63. data/test/vcr_cassettes/CartInformation.yml +37 -725
  64. data/test/vcr_cassettes/CustomerInformation.yml +37 -728
  65. data/test/vcr_cassettes/Feeds.yml +100 -528
  66. data/test/vcr_cassettes/FulfillmentInboundShipment.yml +39 -728
  67. data/test/vcr_cassettes/FulfillmentInventory.yml +96 -997
  68. data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +39 -725
  69. data/test/vcr_cassettes/OffAmazonPayments.yml +36 -727
  70. data/test/vcr_cassettes/Orders.yml +38 -29855
  71. data/test/vcr_cassettes/Products.yml +1300 -3871
  72. data/test/vcr_cassettes/Recommendations.yml +8934 -15590
  73. data/test/vcr_cassettes/Reports.yml +288 -1326
  74. data/test/vcr_cassettes/Sellers.yml +38 -1178
  75. data/test/vcr_cassettes/Subscriptions.yml +244 -1066
  76. metadata +27 -98
  77. data/test/helper.rb +0 -3
  78. data/test/integration_helper.rb +0 -49
  79. data/test/mws.yml.1 +0 -32
  80. data/test/mws.yml.example +0 -4
  81. data/test/unit/mws/test_off_amazon_payments.rb +0 -9
  82. data/test/unit/mws/test_products.rb +0 -9
@@ -0,0 +1,171 @@
1
+ require 'peddler/client'
2
+ require 'excon'
3
+
4
+ module MWS
5
+ module FulfillmentOutboundShipment
6
+ # The Fulfillment Outbound Shipment API enables you to fulfill orders placed
7
+ # through channels other than Amazon's retail web site, using your inventory
8
+ # in the Amazon Fulfillment Network. You can request previews of potential
9
+ # fulfillment orders that return estimated shipping fees and shipping dates
10
+ # based on shipping speed. You can get detailed item-level, shipment-level,
11
+ # and order-level information for any existing fulfillment order that you
12
+ # specify. You can also request lists of existing fulfillment orders based
13
+ # on when they were fulfilled and by the fulfillment method associated with
14
+ # them.
15
+ class Client < ::Peddler::Client
16
+ path '/FulfillmentOutboundShipment/2010-10-01'
17
+
18
+ # Lists fulfillment order previews
19
+ #
20
+ # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_GetFulfillmentPreview.html
21
+ # @param address [Struct, Hash]
22
+ # @param items [Array<Struct, Hash>]
23
+ # @param opts [Hash]
24
+ # @option opts Array[String] :shipping_speed_categories
25
+ # @option opts [Boolean] :include_cod_fulfillment_preview
26
+ # @return [Peddler::XMLParser]
27
+ def get_fulfillment_preview(address, items, opts = {})
28
+ if opts.key?(:include_cod_fulfillment_preview)
29
+ opts['IncludeCODFulfillmentPreview'] = opts.delete(:include_cod_fulfillment_preview)
30
+ end
31
+
32
+ operation('GetFulfillmentPreview')
33
+ .add(opts.merge('Address' => address, 'Items' => items))
34
+ .structure!('Items', 'member')
35
+ .structure!('ShippingSpeedCategories')
36
+
37
+ run
38
+ end
39
+
40
+ # Requests that Amazon ship items from the seller's Amazon Fulfillment
41
+ # Network inventory to a destination address
42
+ #
43
+ # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_CreateFulfillmentOrder.html
44
+ # @param seller_fulfillment_order_id [String]
45
+ # @param displayable_order_id [String]
46
+ # @param displayable_order_date_time [String, #iso8601]
47
+ # @param displayable_order_comment [String]
48
+ # @param shipping_speed_category [String]
49
+ # @param destination_address [Struct, Hash]
50
+ # @params items [Array<Struct, Hash>]
51
+ # @param opts [Hash]
52
+ # @option opts [String] :fulfillment_action
53
+ # @option opts [String] :fulfillment_policy
54
+ # @option opts [Array<String>] :notification_email_list
55
+ # @option opts [Struct, Hash] :cod_settings
56
+ # @return [Peddler::XMLParser]
57
+ def create_fulfillment_order(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time, displayable_order_comment, shipping_speed_category, destination_address, items, opts = {})
58
+ if opts.key?(:cod_settings)
59
+ opts['CODSettings'] = opts.delete(:cod_settings)
60
+ end
61
+
62
+ operation('CreateFulfillmentOrder')
63
+ .add(opts
64
+ .merge(
65
+ 'SellerFulfillmentOrderId' => seller_fulfillment_order_id,
66
+ 'DisplayableOrderId' => displayable_order_id,
67
+ 'DisplayableOrderDateTime' => displayable_order_date_time,
68
+ 'DisplayableOrderComment' => displayable_order_comment,
69
+ 'ShippingSpeedCategory' => shipping_speed_category,
70
+ 'DestinationAddress' => destination_address,
71
+ 'Items' => items
72
+ )
73
+ )
74
+ .structure!('Items', 'member')
75
+ .structure!('NotificationEmailList', 'member')
76
+
77
+ run
78
+ end
79
+
80
+ # Updates and/or requests shipment for a fulfillment order with an order
81
+ # hold on it
82
+ #
83
+ # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_UpdateFulfillmentOrder.html
84
+ # @param seller_fulfillment_order_id [String]
85
+ # @param opts [Hash]
86
+ # @option opts [String] :fulfillment_action
87
+ # @option opts [String] :displayable_order_id
88
+ # @option opts [String, #iso8601] :displayable_order_date_time
89
+ # @option opts [String] :displayable_order_comment
90
+ # @option opts [String] :shipping_speed_category
91
+ # @option opts [Struct, Hash] :destination_address
92
+ # @option opts [String] :fulfillment_policy
93
+ # @option opts [Array<String>] :notification_email_list
94
+ # @option opts [Array<Struct, Hash>] :items
95
+ # @return [Peddler::XMLParser]
96
+ def update_fulfillment_order(seller_fulfillment_order_id, opts = {})
97
+ operation('UpdateFulfillmentOrder')
98
+ .add(opts.merge('SellerFulfillmentOrderId' => seller_fulfillment_order_id))
99
+ .structure!('NotificationEmailList', 'member')
100
+ .structure!('Items', 'member')
101
+
102
+ run
103
+ end
104
+
105
+ # Gets a fulfillment order
106
+ #
107
+ # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_GetFulfillmentOrder.html
108
+ # @param seller_fulfillment_order_id [String]
109
+ # @return [Peddler::XMLParser]
110
+ def get_fulfillment_order(seller_fulfillment_order_id)
111
+ operation('GetFulfillmentOrder')
112
+ .add('SellerFulfillmentOrderId' => seller_fulfillment_order_id)
113
+
114
+ run
115
+ end
116
+
117
+ # Returns a list of fulfillment orders fulfilled on or after a date
118
+ #
119
+ # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_ListAllFulfillmentOrders.html
120
+ # @param opts [Hash]
121
+ # @option opts [String, #iso8601] :query_start_date_time
122
+ # @return [Peddler::XMLParser]
123
+ def list_all_fulfillment_orders(query_start_date_time = nil)
124
+ opts = query_start_date_time ? { 'QueryStartDateTime' => query_start_date_time } : {}
125
+ operation('ListAllFulfillmentOrders').add(opts)
126
+
127
+ run
128
+ end
129
+
130
+ # Returns the next page of fulfillment orders
131
+ #
132
+ # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_ListAllFulfillmentOrdersByNextToken.html
133
+ # @param next_token [String]
134
+ # @return [Peddler::XMLParser]
135
+ def list_all_fulfillment_orders_by_next_token(next_token)
136
+ operation('ListAllFulfillmentOrdersByNextToken')
137
+ .add('NextToken' => next_token)
138
+
139
+ run
140
+ end
141
+
142
+ # Returns delivery tracking information for a package in an outbound
143
+ # shipment for a Multi-Channel Fulfillment order
144
+ def get_package_tracking_details
145
+ fail NotImplementedError
146
+ end
147
+
148
+ # Requests that Amazon stop attempting to fulfill an existing fulfillment
149
+ # order
150
+ #
151
+ # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_CancelFulfillmentOrder.html
152
+ # @param seller_fulfillment_order_id [String]
153
+ # @return [Peddler::XMLParser]
154
+ def cancel_fulfillment_order(seller_fulfillment_order_id)
155
+ operation('CancelFulfillmentOrder')
156
+ .add('SellerFulfillmentOrderId' => seller_fulfillment_order_id)
157
+
158
+ run
159
+ end
160
+
161
+ # Gets the operational status of the API
162
+ #
163
+ # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/MWS_GetServiceStatus.html
164
+ # @return [Peddler::XMLParser]
165
+ def get_service_status
166
+ operation('GetServiceStatus')
167
+ run
168
+ end
169
+ end
170
+ end
171
+ end
@@ -1,168 +1 @@
1
- require 'peddler/client'
2
- require 'excon'
3
-
4
- module MWS
5
- # The Fulfillment Outbound Shipment API enables you to fulfill orders placed
6
- # through channels other than Amazon's retail web site, using your inventory
7
- # in the Amazon Fulfillment Network. You can request previews of potential
8
- # fulfillment orders that return estimated shipping fees and shipping dates
9
- # based on shipping speed. You can get detailed item-level, shipment-level,
10
- # and order-level information for any existing fulfillment order that you
11
- # specify. You can also request lists of existing fulfillment orders based on
12
- # when they were fulfilled and by the fulfillment method associated with them.
13
- class FulfillmentOutboundShipment < ::Peddler::Client
14
- path '/FulfillmentOutboundShipment/2010-10-01'
15
-
16
- # Lists fulfillment order previews
17
- #
18
- # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_GetFulfillmentPreview.html
19
- # @param address [Struct, Hash]
20
- # @param items [Array<Struct, Hash>]
21
- # @param opts [Hash]
22
- # @option opts Array[String] :shipping_speed_categories
23
- # @option opts [Boolean] :include_cod_fulfillment_preview
24
- # @return [Peddler::XMLParser]
25
- def get_fulfillment_preview(address, items, opts = {})
26
- if opts.has_key?(:include_cod_fulfillment_preview)
27
- opts['IncludeCODFulfillmentPreview'] = opts.delete(:include_cod_fulfillment_preview)
28
- end
29
-
30
- operation('GetFulfillmentPreview')
31
- .add(opts.merge('Address' => address, 'Items' => items))
32
- .structure!('Items', 'member')
33
- .structure!('ShippingSpeedCategories')
34
-
35
- run
36
- end
37
-
38
- # Requests that Amazon ship items from the seller's Amazon Fulfillment
39
- # Network inventory to a destination address
40
- #
41
- # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_CreateFulfillmentOrder.html
42
- # @param seller_fulfillment_order_id [String]
43
- # @param displayable_order_id [String]
44
- # @param displayable_order_date_time [String, #iso8601]
45
- # @param displayable_order_comment [String]
46
- # @param shipping_speed_category [String]
47
- # @param destination_address [Struct, Hash]
48
- # @params items [Array<Struct, Hash>]
49
- # @param opts [Hash]
50
- # @option opts [String] :fulfillment_action
51
- # @option opts [String] :fulfillment_policy
52
- # @option opts [Array<String>] :notification_email_list
53
- # @option opts [Struct, Hash] :cod_settings
54
- # @return [Peddler::XMLParser]
55
- def create_fulfillment_order(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time, displayable_order_comment, shipping_speed_category, destination_address, items, opts = {})
56
- if opts.has_key?(:cod_settings)
57
- opts['CODSettings'] = opts.delete(:cod_settings)
58
- end
59
-
60
- operation('CreateFulfillmentOrder')
61
- .add(opts
62
- .merge(
63
- 'SellerFulfillmentOrderId' => seller_fulfillment_order_id,
64
- 'DisplayableOrderId' => displayable_order_id,
65
- 'DisplayableOrderDateTime' => displayable_order_date_time,
66
- 'DisplayableOrderComment' => displayable_order_comment,
67
- 'ShippingSpeedCategory' => shipping_speed_category,
68
- 'DestinationAddress' => destination_address,
69
- 'Items' => items
70
- )
71
- )
72
- .structure!('Items', 'member')
73
- .structure!('NotificationEmailList', 'member')
74
-
75
- run
76
- end
77
-
78
- # Updates and/or requests shipment for a fulfillment order with an order
79
- # hold on it
80
- #
81
- # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_UpdateFulfillmentOrder.html
82
- # @param seller_fulfillment_order_id [String]
83
- # @param opts [Hash]
84
- # @option opts [String] :fulfillment_action
85
- # @option opts [String] :displayable_order_id
86
- # @option opts [String, #iso8601] :displayable_order_date_time
87
- # @option opts [String] :displayable_order_comment
88
- # @option opts [String] :shipping_speed_category
89
- # @option opts [Struct, Hash] :destination_address
90
- # @option opts [String] :fulfillment_policy
91
- # @option opts [Array<String>] :notification_email_list
92
- # @option opts [Array<Struct, Hash>] :items
93
- # @return [Peddler::XMLParser]
94
- def update_fulfillment_order(seller_fulfillment_order_id, opts = {})
95
- operation('UpdateFulfillmentOrder')
96
- .add(opts.merge('SellerFulfillmentOrderId' => seller_fulfillment_order_id))
97
- .structure!('NotificationEmailList', 'member')
98
- .structure!('Items', 'member')
99
-
100
- run
101
- end
102
-
103
- # Gets a fulfillment order
104
- #
105
- # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_GetFulfillmentOrder.html
106
- # @param seller_fulfillment_order_id [String]
107
- # @return [Peddler::XMLParser]
108
- def get_fulfillment_order(seller_fulfillment_order_id)
109
- operation('GetFulfillmentOrder')
110
- .add('SellerFulfillmentOrderId' => seller_fulfillment_order_id)
111
-
112
- run
113
- end
114
-
115
- # Returns a list of fulfillment orders fulfilled on or after a date
116
- #
117
- # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_ListAllFulfillmentOrders.html
118
- # @param opts [Hash]
119
- # @option opts [String, #iso8601] :query_start_date_time
120
- # @return [Peddler::XMLParser]
121
- def list_all_fulfillment_orders(query_start_date_time = nil)
122
- opts = query_start_date_time ? { 'QueryStartDateTime' => query_start_date_time } : {}
123
- operation('ListAllFulfillmentOrders').add(opts)
124
-
125
- run
126
- end
127
-
128
- # Returns the next page of fulfillment orders
129
- #
130
- # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_ListAllFulfillmentOrdersByNextToken.html
131
- # @param next_token [String]
132
- # @return [Peddler::XMLParser]
133
- def list_all_fulfillment_orders_by_next_token(next_token)
134
- operation('ListAllFulfillmentOrdersByNextToken')
135
- .add('NextToken' => next_token)
136
-
137
- run
138
- end
139
-
140
- # Returns delivery tracking information for a package in an outbound
141
- # shipment for a Multi-Channel Fulfillment order
142
- def get_package_tracking_details
143
- raise NotImplementedError
144
- end
145
-
146
- # Requests that Amazon stop attempting to fulfill an existing fulfillment
147
- # order
148
- #
149
- # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_CancelFulfillmentOrder.html
150
- # @param seller_fulfillment_order_id [String]
151
- # @return [Peddler::XMLParser]
152
- def cancel_fulfillment_order(seller_fulfillment_order_id)
153
- operation('CancelFulfillmentOrder')
154
- .add('SellerFulfillmentOrderId' => seller_fulfillment_order_id)
155
-
156
- run
157
- end
158
-
159
- # Gets the operational status of the API
160
- #
161
- # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/MWS_GetServiceStatus.html
162
- # @return [Peddler::XMLParser]
163
- def get_service_status
164
- operation('GetServiceStatus')
165
- run
166
- end
167
- end
168
- end
1
+ require 'mws/fulfillment_outbound_shipment/client'