peddler 2.4.4 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +406 -134
  3. data/lib/peddler/access_token.rb +76 -0
  4. data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +80 -0
  5. data/lib/peddler/api/aplus_content_2020_11_01.rb +208 -0
  6. data/lib/peddler/api/application_management_2023_11_30.rb +25 -0
  7. data/lib/peddler/api/catalog_items_2020_12_01.rb +70 -0
  8. data/lib/peddler/api/catalog_items_2022_04_01.rb +83 -0
  9. data/lib/peddler/api/catalog_items_v0.rb +90 -0
  10. data/lib/peddler/api/data_kiosk_2023_11_15.rb +92 -0
  11. data/lib/peddler/api/easy_ship_2022_03_23.rb +108 -0
  12. data/lib/peddler/api/fba_inbound_eligibility_v1.rb +36 -0
  13. data/lib/peddler/api/fba_inventory_v1.rb +106 -0
  14. data/lib/peddler/api/feeds_2021_06_30.rb +104 -0
  15. data/lib/peddler/api/finances_v0.rb +121 -0
  16. data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +660 -0
  17. data/lib/peddler/api/fulfillment_inbound_v0.rb +314 -0
  18. data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +222 -0
  19. data/lib/peddler/api/listings_items_2020_09_01.rb +84 -0
  20. data/lib/peddler/api/listings_items_2021_08_01.rb +154 -0
  21. data/lib/peddler/api/listings_restrictions_2021_08_01.rb +37 -0
  22. data/lib/peddler/api/merchant_fulfillment_v0.rb +64 -0
  23. data/lib/peddler/api/messaging_v1.rb +241 -0
  24. data/lib/peddler/api/notifications_v1.rb +114 -0
  25. data/lib/peddler/api/orders_v0.rb +264 -0
  26. data/lib/peddler/api/product_fees_v0.rb +69 -0
  27. data/lib/peddler/api/product_pricing_2022_05_01.rb +43 -0
  28. data/lib/peddler/api/product_pricing_v0.rb +144 -0
  29. data/lib/peddler/api/product_type_definitions_2020_09_01.rb +75 -0
  30. data/lib/peddler/api/replenishment_2022_11_07.rb +45 -0
  31. data/lib/peddler/api/reports_2021_06_30.rb +139 -0
  32. data/lib/peddler/api/sales_v1.rb +69 -0
  33. data/lib/peddler/api/sellers_v1.rb +33 -0
  34. data/lib/peddler/api/services_v1.rb +308 -0
  35. data/lib/peddler/api/shipment_invoicing_v0.rb +46 -0
  36. data/lib/peddler/api/shipping_v1.rb +107 -0
  37. data/lib/peddler/api/shipping_v2.rb +267 -0
  38. data/lib/peddler/api/solicitations_v1.rb +53 -0
  39. data/lib/peddler/api/supply_sources_2020_07_01.rb +82 -0
  40. data/lib/peddler/api/tokens_2021_03_01.rb +30 -0
  41. data/lib/peddler/api/uploads_2020_11_01.rb +40 -0
  42. data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +24 -0
  43. data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +72 -0
  44. data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +72 -0
  45. data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +23 -0
  46. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +35 -0
  47. data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +177 -0
  48. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +165 -0
  49. data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +24 -0
  50. data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +24 -0
  51. data/lib/peddler/api/vendor_invoices_v1.rb +22 -0
  52. data/lib/peddler/api/vendor_orders_v1.rb +148 -0
  53. data/lib/peddler/api/vendor_shipments_v1.rb +120 -0
  54. data/lib/peddler/api/vendor_transaction_status_v1.rb +24 -0
  55. data/lib/peddler/api.rb +115 -0
  56. data/lib/peddler/error.rb +30 -0
  57. data/lib/peddler/region.rb +30 -0
  58. data/lib/peddler/version.rb +1 -1
  59. data/lib/peddler.rb +52 -1
  60. metadata +70 -80
  61. data/lib/mws/easy_ship/client.rb +0 -93
  62. data/lib/mws/easy_ship.rb +0 -3
  63. data/lib/mws/feeds/client.rb +0 -122
  64. data/lib/mws/feeds.rb +0 -3
  65. data/lib/mws/finances/client.rb +0 -82
  66. data/lib/mws/finances.rb +0 -3
  67. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
  68. data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
  69. data/lib/mws/fulfillment_inventory/client.rb +0 -57
  70. data/lib/mws/fulfillment_inventory.rb +0 -3
  71. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
  72. data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
  73. data/lib/mws/merchant_fulfillment/client.rb +0 -87
  74. data/lib/mws/merchant_fulfillment.rb +0 -3
  75. data/lib/mws/off_amazon_payments.rb +0 -3
  76. data/lib/mws/orders/client.rb +0 -120
  77. data/lib/mws/orders.rb +0 -3
  78. data/lib/mws/products/client.rb +0 -268
  79. data/lib/mws/products.rb +0 -3
  80. data/lib/mws/recommendations/client.rb +0 -72
  81. data/lib/mws/recommendations.rb +0 -3
  82. data/lib/mws/reports/client.rb +0 -236
  83. data/lib/mws/reports.rb +0 -3
  84. data/lib/mws/sellers/client.rb +0 -44
  85. data/lib/mws/sellers.rb +0 -3
  86. data/lib/mws/shipment_invoicing/client.rb +0 -74
  87. data/lib/mws/shipment_invoicing.rb +0 -3
  88. data/lib/mws/subscriptions/client.rb +0 -179
  89. data/lib/mws/subscriptions.rb +0 -3
  90. data/lib/mws.rb +0 -29
  91. data/lib/peddler/client.rb +0 -159
  92. data/lib/peddler/errors/builder.rb +0 -64
  93. data/lib/peddler/errors/class_generator.rb +0 -40
  94. data/lib/peddler/errors/error.rb +0 -45
  95. data/lib/peddler/errors/parser.rb +0 -28
  96. data/lib/peddler/flat_file_parser.rb +0 -56
  97. data/lib/peddler/headers.rb +0 -102
  98. data/lib/peddler/marketplace.rb +0 -78
  99. data/lib/peddler/operation.rb +0 -78
  100. data/lib/peddler/parser.rb +0 -33
  101. data/lib/peddler/structured_list.rb +0 -23
  102. data/lib/peddler/vcr_matcher.rb +0 -97
  103. data/lib/peddler/xml_parser.rb +0 -38
  104. data/lib/peddler/xml_response_parser.rb +0 -25
@@ -1,236 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'peddler/client'
4
-
5
- module MWS
6
- module Reports
7
- # The Reports API lets you request reports about your inventory and orders.
8
- class Client < ::Peddler::Client
9
- self.version = '2009-01-01'
10
- self.path = "/Reports/#{version}"
11
-
12
- # Creates a report request
13
- #
14
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_RequestReport.html
15
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
16
- # @param [String] report_type
17
- # @param [Hash] opts
18
- # @option opts [String, #iso8601] :start_date
19
- # @option opts [String, #iso8601] :end_date
20
- # @option opts [String] :report_options
21
- # @option opts [Array<String>, String] :marketplace_id_list
22
- # @return [Peddler::XMLParser]
23
- def request_report(report_type, opts = {})
24
- operation('RequestReport')
25
- .add(opts)
26
- .add('ReportType' => report_type)
27
- .structure!('MarketplaceIdList', 'Id')
28
-
29
- run
30
- end
31
-
32
- # Lists report requests
33
- #
34
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportRequestList.html
35
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
36
- # @param [Hash] opts
37
- # @option opts [Array<String>, String] :report_request_id_list
38
- # @option opts [Array<String>, String] :report_type_list
39
- # @option opts [Array<String>, String] :report_processing_status_list
40
- # @option opts [Integer] :max_count
41
- # @option opts [String, #iso8601] :requested_from_date
42
- # @option opts [String, #iso8601] :requested_to_date
43
- # @return [Peddler::XMLParser]
44
- def get_report_request_list(opts = {})
45
- operation('GetReportRequestList')
46
- .add(opts)
47
- .structure!('ReportRequestIdList', 'Id')
48
- .structure!('ReportTypeList', 'Type')
49
- .structure!('ReportProcessingStatusList', 'Status')
50
-
51
- run
52
- end
53
-
54
- # Lists the next page of the report requests
55
- #
56
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportRequestListByNextToken.html
57
- # @param [String] next_token
58
- # @return [Peddler::XMLParser]
59
- def get_report_request_list_by_next_token(next_token)
60
- operation('GetReportRequestListByNextToken')
61
- .add('NextToken' => next_token)
62
-
63
- run
64
- end
65
-
66
- # Counts requested reports
67
- #
68
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportRequestCount.html
69
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
70
- # @param [Hash] opts
71
- # @option opts [Array<String>, String] :report_type_list
72
- # @option opts [Array<String>, String] :report_processing_status_list
73
- # @option opts [String, #iso8601] :requested_from_date
74
- # @option opts [String, #iso8601] :requested_to_date
75
- # @return [Peddler::XMLParser]
76
- def get_report_request_count(opts = {})
77
- operation('GetReportRequestCount')
78
- .add(opts)
79
- .structure!('ReportTypeList', 'Type')
80
- .structure!('ReportProcessingStatusList', 'Status')
81
-
82
- run
83
- end
84
-
85
- # Cancels one or more report requests
86
- #
87
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_CancelReportRequests.html
88
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
89
- # @param [Hash] opts
90
- # @option opts [Array<String>, String] :report_type_list
91
- # @option opts [Array<String>, String] :report_processing_status_list
92
- # @option opts [String, #iso8601] :requested_from_date
93
- # @option opts [String, #iso8601] :requested_to_date
94
- # @return [Peddler::XMLParser]
95
- def cancel_report_requests(opts = {})
96
- operation('CancelReportRequests')
97
- .add(opts)
98
- .structure!('ReportTypeList', 'Type')
99
- .structure!('ReportProcessingStatusList', 'Status')
100
-
101
- run
102
- end
103
-
104
- # Lists reports
105
- #
106
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportList.html
107
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
108
- # @param [Hash] opts
109
- # @option opts [Integer] :max_count
110
- # @option opts [Array<String>, String] :report_type_list
111
- # @option opts [Boolean] :acknowledged
112
- # @option opts [String, #iso8601] :available_from_date
113
- # @option opts [String, #iso8601] :available_to_date
114
- # @option opts [Array<String>, String] :report_request_id_list
115
- # @return [Peddler::XMLParser]
116
- def get_report_list(opts = {})
117
- operation('GetReportList')
118
- .add(opts)
119
- .structure!('ReportTypeList', 'Type')
120
- .structure!('ReportRequestIdList', 'Id')
121
-
122
- run
123
- end
124
-
125
- # Lists the next page of reports
126
- #
127
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportListByNextToken.html
128
- # @param [String] next_token
129
- # @return [Peddler::XMLParser]
130
- def get_report_list_by_next_token(next_token)
131
- operation('GetReportListByNextToken')
132
- .add('NextToken' => next_token)
133
-
134
- run
135
- end
136
-
137
- # Counts reports
138
- #
139
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportCount.html
140
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
141
- # @param [Hash] opts
142
- # @option opts [Array<String>, String] :report_type_list
143
- # @option opts [Boolean] :acknowledged
144
- # @option opts [String, #iso8601] :available_from_date
145
- # @option opts [String, #iso8601] :available_to_date
146
- # @return [Peddler::XMLParser]
147
- def get_report_count(opts = {})
148
- operation('GetReportCount')
149
- .add(opts)
150
- .structure!('ReportTypeList', 'Type')
151
-
152
- run
153
- end
154
-
155
- # Gets a report and its Content-MD5 header
156
- #
157
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReport.html
158
- # @param [String] report_id
159
- # @return [Peddler::XMLParser] if report is in XML format
160
- # @return [Peddler::FlatFileParser] if report is a flat file
161
- def get_report(report_id, &blk)
162
- operation('GetReport')
163
- .add('ReportId' => report_id)
164
-
165
- run(&blk)
166
- end
167
-
168
- # Creates, updates, or deletes a report request schedule
169
- #
170
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ManageReportSchedule.html
171
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
172
- # @param [String] report_type
173
- # @param [String] schedule
174
- # @param [Hash] opts
175
- # @option opts [String, #iso8601] :schedule_date
176
- # @return [Peddler::XMLParser]
177
- def manage_report_schedule(report_type, schedule, opts = {})
178
- operation('ManageReportSchedule')
179
- .add(opts)
180
- .add('ReportType' => report_type, 'Schedule' => schedule)
181
-
182
- run
183
- end
184
-
185
- # Lists scheduled reports
186
- #
187
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportScheduleList.html
188
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
189
- # @param [Array<String>] report_type_list
190
- # @return [Peddler::XMLParser]
191
- def get_report_schedule_list(*report_type_list)
192
- operation('GetReportScheduleList')
193
- .add('ReportTypeList' => report_type_list)
194
- .structure!('ReportTypeList', 'Type')
195
-
196
- run
197
- end
198
-
199
- # Lists next page of scheduled reports
200
- #
201
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportScheduleListByNextToken.html
202
- # @raise [NotImplementedError]
203
- def get_report_schedule_list_by_next_token(*)
204
- raise NotImplementedError
205
- end
206
-
207
- # Counts scheduled reports
208
- #
209
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportScheduleCount.html
210
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
211
- # @param [Array<String>] report_type_list
212
- # @return [Peddler::XMLParser]
213
- def get_report_schedule_count(*report_type_list)
214
- operation('GetReportScheduleCount')
215
- .add('ReportTypeList' => report_type_list)
216
- .structure!('ReportTypeList', 'Type')
217
-
218
- run
219
- end
220
-
221
- # Updates acknowledged status of one or more reports
222
- #
223
- # @see https://docs.developer.amazonservices.com/en_US/reports/Reports_UpdateReportAcknowledgements.html
224
- # @param [Boolean] acknowledged
225
- # @param [Array<String>] report_id_list
226
- # @return [Peddler::XMLParser]
227
- def update_report_acknowledgements(acknowledged, *report_id_list)
228
- operation('UpdateReportAcknowledgements')
229
- .add('ReportIdList' => report_id_list, 'Acknowledged' => acknowledged)
230
- .structure!('ReportIdList', 'Id')
231
-
232
- run
233
- end
234
- end
235
- end
236
- end
data/lib/mws/reports.rb DELETED
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'mws/reports/client'
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'peddler/client'
4
-
5
- module MWS
6
- module Sellers
7
- # The Sellers API lets sellers retrieve information about their seller
8
- # account, such as the marketplaces they participate in.
9
- class Client < ::Peddler::Client
10
- self.version = '2011-07-01'
11
- self.path = "/Sellers/#{version}"
12
-
13
- # Lists the marketplaces the seller participates in
14
- #
15
- # @see https://docs.developer.amazonservices.com/en_US/sellers/Sellers_ListMarketplaceParticipations.html
16
- # @return [Peddler::XMLParser]
17
- def list_marketplace_participations
18
- operation('ListMarketplaceParticipations')
19
- run
20
- end
21
-
22
- # Lists the next page of marketplaces the seller participates in
23
- #
24
- # @see https://docs.developer.amazonservices.com/en_US/sellers/Sellers_ListMarketplaceParticipationsByNextToken.html
25
- # @param [String] next_token
26
- # @return [Peddler::XMLParser]
27
- def list_marketplace_participations_by_next_token(next_token)
28
- operation('ListMarketplaceParticipationsByNextToken')
29
- .add('NextToken' => next_token)
30
-
31
- run
32
- end
33
-
34
- # Gets the service status of the API
35
- #
36
- # @see https://docs.developer.amazonservices.com/en_US/sellers/Sellers_GetServiceStatus.html
37
- # @return [Peddler::XMLParser]
38
- def get_service_status
39
- operation('GetServiceStatus')
40
- run
41
- end
42
- end
43
- end
44
- end
data/lib/mws/sellers.rb DELETED
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'mws/sellers/client'
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'peddler/client'
4
-
5
- module MWS
6
- module ShipmentInvoicing
7
- # With the Shipment Invoicing API section, you can integrate invoicing into
8
- # Amazon's shipping process for a seller's FBA order.
9
- #
10
- # @note This functionality is available only in the Brazil marketplace.
11
- class Client < ::Peddler::Client
12
- self.version = '2018-09-01'
13
- self.path = "/ShipmentInvoicing/#{version}"
14
-
15
- # Returns the information required to generate an invoice for the shipment
16
- # of a Fulfillment by Amazon order
17
- #
18
- # @see https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_GetFBAOutboundShipmentDetail.html
19
- # @param [String] marketplace_id
20
- # @param [String] amazon_shipment_id
21
- # @return [Peddler::XMLParser]
22
- def get_fba_outbound_shipment_detail(marketplace_id, amazon_shipment_id)
23
- operation('GetFBAOutboundShipmentDetail')
24
- .add('MarketplaceId' => marketplace_id,
25
- 'AmazonShipmentId' => amazon_shipment_id)
26
-
27
- run
28
- end
29
-
30
- # Submits shipment invoice data for a given shipment
31
- #
32
- # @see https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_SubmitFBAOutboundShipmentInvoice.html
33
- # @param [String] marketplace_id
34
- # @param [String] amazon_shipment_id
35
- # @param [String] invoice_content
36
- # @return [Peddler::XMLParser]
37
- def submit_fba_outbound_shipment_invoice(marketplace_id,
38
- amazon_shipment_id,
39
- invoice_content)
40
- self.body = invoice_content
41
-
42
- operation('SubmitFBAOutboundShipmentInvoice')
43
- .add('MarketplaceId' => marketplace_id,
44
- 'AmazonShipmentId' => amazon_shipment_id)
45
-
46
- run
47
- end
48
-
49
- # Gets the invoice processing status for the shipments that you specify
50
- #
51
- # @see https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_GetFBAOutboundShipmentInvoiceStatus.html
52
- # @param [String] marketplace_id
53
- # @param [String] amazon_shipment_id
54
- # @return [Peddler::XMLParser]
55
- def get_fba_outbound_shipment_invoice_status(marketplace_id,
56
- amazon_shipment_id)
57
- operation('GetFBAOutboundShipmentInvoiceStatus')
58
- .add('MarketplaceId' => marketplace_id,
59
- 'AmazonShipmentId' => amazon_shipment_id)
60
-
61
- run
62
- end
63
-
64
- # Gets the operational status of the API
65
- #
66
- # @see https://docs.developer.amazonservices.com/en_US/shipment_invoicing/ShipmentInvoicing_GetServiceStatus.html
67
- # @return [Peddler::XMLParser]
68
- def get_service_status
69
- operation('GetServiceStatus')
70
- run
71
- end
72
- end
73
- end
74
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'mws/shipment_invoicing/client'
@@ -1,179 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'peddler/client'
4
-
5
- module MWS
6
- module Subscriptions
7
- # The Amazon MWS Subscriptions API section enables you to subscribe to
8
- # receive notifications that are relevant to your business with Amazon. With
9
- # the operations in the Subscriptions API section, you can register to
10
- # receive important information from Amazon without having to poll the
11
- # Amazon MWS service. Instead, the information is sent directly to you when
12
- # an event occurs to which you are subscribed.
13
- class Client < ::Peddler::Client
14
- self.version = '2013-07-01'
15
- self.path = "/Subscriptions/#{version}"
16
-
17
- # Registers a new destination to receive notifications
18
- #
19
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_RegisterDestination.html
20
- # @param [String] sqs_queue_url
21
- # @param [String] marketplace_id
22
- # @return [Peddler::XMLParser]
23
- def register_destination(sqs_queue_url, marketplace_id)
24
- operation('RegisterDestination')
25
- .add('MarketplaceId' => marketplace_id)
26
- .add(build_destination(sqs_queue_url))
27
-
28
- run
29
- end
30
-
31
- # Removes an existing destination from the list of registered destinations
32
- #
33
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_DeregisterDestination.html
34
- # @param [String] sqs_queue_url
35
- # @param [String] marketplace_id
36
- # @return [Peddler::XMLParser]
37
- def deregister_destination(sqs_queue_url, marketplace_id)
38
- operation('DeregisterDestination')
39
- .add('MarketplaceId' => marketplace_id)
40
- .add(build_destination(sqs_queue_url))
41
-
42
- run
43
- end
44
-
45
- # Lists all registered destinations
46
- #
47
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListRegisteredDestinations.html
48
- # @param [String] marketplace_id
49
- # @return [Peddler::XMLParser]
50
- def list_registered_destinations(marketplace_id)
51
- operation('ListRegisteredDestinations')
52
- .add('MarketplaceId' => marketplace_id)
53
-
54
- run
55
- end
56
-
57
- # Sends a test notification to an existing destination
58
- #
59
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_SendTestNotificationToDestination.html
60
- # @param [String] sqs_queue_url
61
- # @param [String] marketplace_id
62
- # @return [Peddler::XMLParser]
63
- def send_test_notification_to_destination(sqs_queue_url, marketplace_id)
64
- operation('SendTestNotificationToDestination')
65
- .add('MarketplaceId' => marketplace_id)
66
- .add(build_destination(sqs_queue_url))
67
-
68
- run
69
- end
70
-
71
- # Creates a new subscription
72
- #
73
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_CreateSubscription.html
74
- # @param [String] notification_type
75
- # @param [String] sqs_queue_url
76
- # @param [String] marketplace_id
77
- # @return [Peddler::XMLParser]
78
- def create_subscription(notification_type, sqs_queue_url, marketplace_id)
79
- operation('CreateSubscription')
80
- .add('MarketplaceId' => marketplace_id)
81
- .add(build_subscription(notification_type, sqs_queue_url))
82
-
83
- run
84
- end
85
-
86
- # Gets a subscription
87
- #
88
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_GetSubscription.html
89
- # @param [String] notification_type
90
- # @param [String] sqs_queue_url
91
- # @param [String] marketplace_id
92
- # @return [Peddler::XMLParser]
93
- def get_subscription(notification_type, sqs_queue_url, marketplace_id)
94
- operation('GetSubscription')
95
- .add('MarketplaceId' => marketplace_id,
96
- 'NotificationType' => notification_type)
97
- .add(build_destination(sqs_queue_url))
98
-
99
- run
100
- end
101
-
102
- # Deletes a subscription
103
- #
104
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_DeleteSubscription.html
105
- # @param [String] notification_type
106
- # @param [String] sqs_queue_url
107
- # @param [String] marketplace_id
108
- # @return [Peddler::XMLParser]
109
- def delete_subscription(notification_type, sqs_queue_url, marketplace_id)
110
- operation('DeleteSubscription')
111
- .add('MarketplaceId' => marketplace_id,
112
- 'NotificationType' => notification_type)
113
- .add(build_destination(sqs_queue_url))
114
-
115
- run
116
- end
117
-
118
- # Lists current subscriptions
119
- #
120
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListSubscriptions.html
121
- # @param [String] marketplace_id
122
- # @return [Peddler::XMLParser]
123
- def list_subscriptions(marketplace_id)
124
- operation('ListSubscriptions')
125
- .add('MarketplaceId' => marketplace_id)
126
-
127
- run
128
- end
129
-
130
- # Updates a subscription
131
- #
132
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_UpdateSubscription.html
133
- # @param [String] notification_type
134
- # @param [String] sqs_queue_url
135
- # @param [Boolean] enabled
136
- # @param [String] marketplace_id
137
- # @return [Peddler::XMLParser]
138
- def update_subscription(notification_type, sqs_queue_url, enabled,
139
- marketplace_id)
140
- operation('UpdateSubscription')
141
- .add('MarketplaceId' => marketplace_id)
142
- .add(build_subscription(notification_type, sqs_queue_url, enabled: enabled))
143
-
144
- run
145
- end
146
-
147
- # Gets the service status of the API
148
- #
149
- # @see https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_GetServiceStatus.html
150
- # @return [Peddler::XMLParser]
151
- def get_service_status
152
- operation('GetServiceStatus')
153
- run
154
- end
155
-
156
- private
157
-
158
- def build_destination(sqs_queue_url)
159
- {
160
- 'Destination.DeliveryChannel' => 'SQS',
161
- 'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
162
- 'Destination.AttributeList.member.1.Value' => sqs_queue_url
163
- }
164
- end
165
-
166
- def build_subscription(notification_type, sqs_queue_url, enabled: true)
167
- {
168
- 'Subscription.IsEnabled' => enabled,
169
- 'Subscription.NotificationType' => notification_type,
170
- 'Subscription.Destination.DeliveryChannel' => 'SQS',
171
- 'Subscription.Destination.AttributeList.member.1.Key' =>
172
- 'sqsQueueUrl',
173
- 'Subscription.Destination.AttributeList.member.1.Value' =>
174
- sqs_queue_url
175
- }
176
- end
177
- end
178
- end
179
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'mws/subscriptions/client'
data/lib/mws.rb DELETED
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'forwardable'
4
- require 'mws/easy_ship'
5
- require 'mws/feeds'
6
- require 'mws/finances'
7
- require 'mws/fulfillment_inbound_shipment'
8
- require 'mws/fulfillment_inventory'
9
- require 'mws/fulfillment_outbound_shipment'
10
- require 'mws/merchant_fulfillment'
11
- require 'mws/orders'
12
- require 'mws/products'
13
- require 'mws/recommendations'
14
- require 'mws/reports'
15
- require 'mws/sellers'
16
- require 'mws/shipment_invoicing'
17
- require 'mws/subscriptions'
18
-
19
- # The various Amazon MWS API sections.
20
- module MWS
21
- class << self
22
- extend Forwardable
23
-
24
- MWS.constants.each do |klass|
25
- method_name = klass.to_s.gsub(/(.)([A-Z])/, '\1_\2').downcase
26
- def_delegator MWS.const_get(klass).const_get(:Client), :new, method_name
27
- end
28
- end
29
- end