peddler 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -145
  3. data/lib/mws/feeds/client.rb +7 -1
  4. data/lib/mws/feeds/parsers/feed.rb +3 -3
  5. data/lib/mws/feeds/parsers/feed_submission_count.rb +2 -5
  6. data/lib/mws/feeds/parsers/{feed_submission.rb → feed_submission_info.rb} +1 -1
  7. data/lib/mws/feeds/parsers/feed_submission_list.rb +6 -3
  8. data/lib/mws/feeds/parsers/feed_submissions.rb +2 -2
  9. data/lib/mws/feeds/requests/feed_submission_list.rb +4 -2
  10. data/lib/mws/orders/client.rb +12 -2
  11. data/lib/mws/orders/parsers/order_items.rb +3 -0
  12. data/lib/mws/orders/parsers/orders.rb +6 -3
  13. data/lib/mws/orders/requests/order_items.rb +4 -2
  14. data/lib/mws/orders/requests/orders.rb +4 -2
  15. data/lib/mws/reports/client.rb +243 -0
  16. data/lib/mws/reports/parsers/report.rb +10 -0
  17. data/lib/mws/reports/parsers/report_acknowledgements.rb +20 -0
  18. data/lib/mws/reports/parsers/report_count.rb +10 -0
  19. data/lib/mws/reports/parsers/report_info.rb +29 -0
  20. data/lib/mws/reports/parsers/report_list.rb +23 -0
  21. data/lib/mws/reports/parsers/report_request_count.rb +10 -0
  22. data/lib/mws/reports/parsers/report_request_info.rb +49 -0
  23. data/lib/mws/reports/parsers/report_request_list.rb +23 -0
  24. data/lib/mws/reports/parsers/report_requests.rb +18 -0
  25. data/lib/mws/reports/parsers/report_schedule.rb +21 -0
  26. data/lib/mws/reports/parsers/report_schedule_count.rb +10 -0
  27. data/lib/mws/reports/parsers/report_schedule_list.rb +23 -0
  28. data/lib/mws/reports/parsers/report_scheduler.rb +19 -0
  29. data/lib/mws/reports/requests/report.rb +18 -0
  30. data/lib/mws/reports/requests/report_acknowledgements.rb +27 -0
  31. data/lib/mws/reports/requests/report_count.rb +20 -0
  32. data/lib/mws/reports/requests/report_list.rb +30 -0
  33. data/lib/mws/reports/requests/report_request_count.rb +20 -0
  34. data/lib/mws/reports/requests/report_request_info.rb +21 -0
  35. data/lib/mws/reports/requests/report_request_list.rb +30 -0
  36. data/lib/mws/reports/requests/report_requests.rb +20 -0
  37. data/lib/mws/reports/requests/report_schedule_count.rb +19 -0
  38. data/lib/mws/reports/requests/report_schedule_list.rb +23 -0
  39. data/lib/mws/reports/requests/report_scheduler.rb +29 -0
  40. data/lib/mws/sellers/client.rb +46 -0
  41. data/lib/mws/sellers/parsers/marketplace.rb +33 -0
  42. data/lib/mws/sellers/parsers/marketplace_participations.rb +32 -0
  43. data/lib/mws/sellers/parsers/participation.rb +21 -0
  44. data/lib/mws/sellers/parsers/service_status.rb +36 -0
  45. data/lib/mws/sellers/parsers/service_status_message.rb +17 -0
  46. data/lib/mws/sellers/requests/marketplace_participations.rb +27 -0
  47. data/lib/mws/sellers/requests/service_status.rb +15 -0
  48. data/lib/peddler/parsers/base.rb +2 -2
  49. data/lib/peddler/parsers/counter.rb +13 -0
  50. data/lib/peddler/parsers/model.rb +4 -5
  51. data/lib/peddler/parsers/text.rb +0 -5
  52. data/lib/peddler/parsers/tokenable.rb +13 -0
  53. data/lib/peddler/parsers/xml.rb +10 -5
  54. data/lib/peddler/request/parameters.rb +2 -1
  55. data/lib/peddler/request/structured_list.rb +5 -0
  56. data/lib/peddler/request.rb +13 -15
  57. data/lib/peddler/response/base.rb +0 -0
  58. data/lib/peddler/response/payload/base.rb +0 -0
  59. data/lib/peddler/response/payload/csv.rb +0 -0
  60. data/lib/peddler/response/payload/xml.rb +0 -0
  61. data/lib/peddler/{response_wrapper.rb → response.rb} +6 -11
  62. data/lib/peddler/version.rb +1 -1
  63. data/test/fixtures/mws.yml +4 -0
  64. data/test/fixtures/reports/report.xml +8 -0
  65. data/test/fixtures/reports/report_acknowledgements.xml +18 -0
  66. data/test/fixtures/reports/report_count.xml +9 -0
  67. data/test/fixtures/reports/report_list.xml +17 -0
  68. data/test/fixtures/reports/report_request_count.xml +9 -0
  69. data/test/fixtures/reports/report_request_list.xml +24 -0
  70. data/test/fixtures/reports/report_requests.xml +19 -0
  71. data/test/fixtures/reports/report_schedule_count.xml +10 -0
  72. data/test/fixtures/reports/report_schedule_list.xml +16 -0
  73. data/test/fixtures/reports/report_scheduler.xml +15 -0
  74. data/test/fixtures/sellers/market_participations.xml +27 -0
  75. data/test/fixtures/sellers/service_status.xml +9 -0
  76. data/test/integration/feeds/test_feed_submission_list.rb +2 -0
  77. data/test/integration/orders/test_orders.rb +3 -0
  78. data/test/integration/reports/test_report.rb +15 -0
  79. data/test/integration/reports/test_report_count.rb +13 -0
  80. data/test/integration/reports/test_report_list.rb +17 -0
  81. data/test/integration/reports/test_report_request_count.rb +13 -0
  82. data/test/integration/reports/test_report_request_list.rb +17 -0
  83. data/test/integration/reports/test_report_schedule_count.rb +13 -0
  84. data/test/integration/reports/test_report_schedule_list.rb +13 -0
  85. data/test/integration/reports/test_report_scheduler.rb +16 -0
  86. data/test/integration/sellers/test_marketplace_participations.rb +13 -0
  87. data/test/integration/sellers/test_service_status.rb +12 -0
  88. data/test/integration_helper.rb +3 -0
  89. data/test/mws/feeds/parsers/test_feed.rb +2 -2
  90. data/test/mws/feeds/parsers/{test_feed_submission.rb → test_feed_submission_info.rb} +3 -3
  91. data/test/mws/feeds/parsers/test_feed_submission_list.rb +5 -1
  92. data/test/mws/feeds/parsers/test_feed_submission_result.rb +1 -1
  93. data/test/mws/feeds/requests/test_feed_submission_list.rb +3 -6
  94. data/test/mws/orders/parsers/test_order_items.rb +4 -0
  95. data/test/mws/orders/parsers/test_orders.rb +4 -0
  96. data/test/mws/orders/parsers/test_service_status.rb +1 -1
  97. data/test/mws/orders/requests/test_order_items.rb +3 -6
  98. data/test/mws/orders/requests/test_orders.rb +3 -6
  99. data/test/mws/reports/parsers/test_report_acknowledgments.rb +14 -0
  100. data/test/mws/reports/parsers/test_report_count.rb +13 -0
  101. data/test/mws/reports/parsers/test_report_info.rb +29 -0
  102. data/test/mws/reports/parsers/test_report_list.rb +18 -0
  103. data/test/mws/reports/parsers/test_report_request_count.rb +13 -0
  104. data/test/mws/reports/parsers/test_report_request_info.rb +49 -0
  105. data/test/mws/reports/parsers/test_report_request_list.rb +18 -0
  106. data/test/mws/reports/parsers/test_report_requests.rb +17 -0
  107. data/test/mws/reports/parsers/test_report_schedule_count.rb +13 -0
  108. data/test/mws/reports/parsers/test_report_schedule_list.rb +18 -0
  109. data/test/mws/reports/parsers/test_report_scheduler.rb +17 -0
  110. data/test/mws/reports/requests/test_acknowledgements.rb +36 -0
  111. data/test/mws/reports/requests/test_report_count.rb +23 -0
  112. data/test/mws/reports/requests/test_report_info.rb +29 -0
  113. data/test/mws/reports/requests/test_report_list.rb +39 -0
  114. data/test/mws/reports/requests/test_report_request_count.rb +23 -0
  115. data/test/mws/reports/requests/test_report_request_list.rb +44 -0
  116. data/test/mws/reports/requests/test_report_requests.rb +29 -0
  117. data/test/mws/reports/requests/test_report_schedule_count.rb +22 -0
  118. data/test/mws/reports/requests/test_report_schedule_list.rb +36 -0
  119. data/test/mws/reports/requests/test_report_scheduler.rb +33 -0
  120. data/test/mws/sellers/parsers/test_market_participations.rb +19 -0
  121. data/test/mws/sellers/parsers/test_service_status.rb +35 -0
  122. data/test/mws/sellers/requests/test_marketplace_participation_list.rb +39 -0
  123. data/test/mws/sellers/requests/test_service_status.rb +25 -0
  124. data/test/peddler/parsers/test_model.rb +36 -0
  125. data/test/request_helper.rb +1 -1
  126. metadata +171 -42
  127. data/test/peddler/test_request.rb +0 -18
@@ -1,6 +1,249 @@
1
+ require 'mws/reports/requests/report_request_list'
2
+ require 'mws/reports/requests/report_request_info'
3
+ require 'mws/reports/requests/report_request_count'
4
+ require 'mws/reports/requests/report_requests'
5
+ require 'mws/reports/requests/report_list'
6
+ require 'mws/reports/requests/report_count'
7
+ require 'mws/reports/requests/report'
8
+ require 'mws/reports/requests/report_scheduler'
9
+ require 'mws/reports/requests/report_schedule_list'
10
+ require 'mws/reports/requests/report_schedule_count'
11
+ require 'mws/reports/requests/report_acknowledgements'
12
+ require 'peddler/client'
13
+
1
14
  module MWS
2
15
  module Reports
16
+ # The Reports API lets you request reports about your inventory and orders.
3
17
  class Client < ::Peddler::Client
18
+ # Public: Create a report request.
19
+ #
20
+ # type - The String type of report to request.
21
+ # options - The Hash query parameters used to narrow the list. Refer to
22
+ # the MWS Reports API for available parameters.
23
+ #
24
+ # Examples
25
+ #
26
+ # client.request_report('_GET_ORDERS_DATA_')
27
+ #
28
+ # Returns the Report Request Info.
29
+ def_delegator :report_request_info, :request, :request_report
30
+
31
+ # Public: Get a list of report requests submitted during a specified time
32
+ # frame.
33
+ #
34
+ # options - The Hash query parameters used to narrow the list. Refer to
35
+ # the MWS Reports API for available parameters.
36
+ #
37
+ # Examples
38
+ #
39
+ # client.get_report_request_list(submitted_from_date: 1.week.ago)
40
+ #
41
+ # Returns an enumerable Report Request List.
42
+ def_delegator :report_request_list, :get, :get_report_request_list
43
+
44
+ # Public: List the next page of the list of report requests.
45
+ #
46
+ # token - A String token (default: The token returned in the last
47
+ # request).
48
+ #
49
+ # Examples
50
+ #
51
+ # client.get_report_request_list_by_next_token
52
+ #
53
+ # Returns an enumerable Report Request List.
54
+ def_delegator :report_request_list, :get_by_next_token, :get_report_request_list_by_next_token
55
+
56
+ # Public: Get a count of the reports requested during a specified time
57
+ # frame.
58
+ #
59
+ # options - The Hash query parameters used to narrow the list. Refer to
60
+ # the MWS Reports API for available parameters.
61
+ #
62
+ # Examples
63
+ #
64
+ # client.get_report_request_count(submitted_from_date: 1.week.ago)
65
+ #
66
+ # Returns the Report Request Count.
67
+ def_delegator :report_request_count, :get, :get_report_request_count
68
+
69
+ # Public: Cancel one or more report requests.
70
+ #
71
+ # options - The Hash query parameters used to narrow the list. Refer to
72
+ # the MWS Reports API for available parameters.
73
+ #
74
+ # Examples
75
+ #
76
+ # client.cancel_report_requests(submitted_to_date: 1.hour.ago)
77
+ #
78
+ # Returns the canceled report requests and their count.
79
+ def_delegator :report_requests, :cancel, :cancel_report_requests
80
+
81
+ # Public: Get a list of reports created during a specified time frame.
82
+ #
83
+ # options - The Hash query parameters used to narrow the list. Refer to
84
+ # the MWS Reports API for available parameters.
85
+ #
86
+ # Examples
87
+ #
88
+ # client.get_report_list
89
+ #
90
+ # Returns an enumerable Report List.
91
+ def_delegator :report_list, :get, :get_report_list
92
+
93
+ # Public: List the next page of the list of reports.
94
+ #
95
+ # token - A String token (default: The token returned in the last
96
+ # request).
97
+ #
98
+ # Examples
99
+ #
100
+ # client.get_report_list_by_next_token
101
+ #
102
+ # Returns an enumerable Report List.
103
+ def_delegator :report_list, :get_by_next_token, :get_report_list_by_next_token
104
+
105
+ # Public: Get a count of the reports created during a specified time
106
+ # frame, with a status of _DONE_ and that are available for download.
107
+ #
108
+ # options - The Hash query parameters used to narrow the list. Refer to
109
+ # the MWS Reports API for available parameters.
110
+ #
111
+ # Examples
112
+ #
113
+ # client.get_report_count
114
+ #
115
+ # Returns a Report Count.
116
+ def_delegator :report_count, :get, :get_report_count
117
+
118
+ # Public: Get the contents of a report and the Content-MD5 header for the
119
+ # returned report body.
120
+ #
121
+ # id - The String generated report id.
122
+ #
123
+ # Examples
124
+ #
125
+ # client.get_report('123456')
126
+ #
127
+ # Returns a Report.
128
+ def_delegator :report, :get, :get_report
129
+
130
+ # Public: Create, update, or delete a report request schedule.
131
+ #
132
+ # type - The String report type.
133
+ # schedule - The String value that indicates how often a report
134
+ # request should be created.
135
+ # scheduled_at - The Time when the next report request is scheduled to be
136
+ # submitted (default: Now).
137
+ #
138
+ # Examples
139
+ #
140
+ # client.manage_report_schedule('_GET_ORDERS_DATA_', '_1_HOUR_')
141
+ #
142
+ # Returns a Report Schedule.
143
+ def_delegator :report_scheduler, :manage, :manage_report_schedule
144
+
145
+ # Public: Delete a report request schedule.
146
+ #
147
+ # type - The String report type.
148
+ #
149
+ # Examples
150
+ #
151
+ # client.delete_report_schedule('_GET_ORDERS_DATA_')
152
+ #
153
+ # Returns a Report Schedule.
154
+ def_delegator :report_scheduler, :delete, :delete_report_schedule
155
+
156
+ # Public: Get a list of order report requests that are scheduled to be
157
+ # submitted to MWS for processing.
158
+ #
159
+ # types - One or more String report types (default: all report types).
160
+ #
161
+ # Examples
162
+ #
163
+ # client.get_report_schedule_list
164
+ #
165
+ # Returns a Report Schedule List.
166
+ def_delegator :report_schedule_list, :get, :get_report_schedule_list
167
+
168
+ # Public: Get a count of order report requests that are scheduled to be
169
+ # submitted to MWS.
170
+ #
171
+ # types - One or more String report types (default: all report types).
172
+ #
173
+ # Examples
174
+ #
175
+ # client.get_report_schedule_count
176
+ #
177
+ # Returns the Report Schedule Count.
178
+ def_delegator :report_schedule_count, :get, :get_report_schedule_count
179
+
180
+ # Public: Update acknowledged status of one or more reports to true.
181
+ #
182
+ # ids - One or more Integer report ids.
183
+ #
184
+ # Examples
185
+ #
186
+ # client.acknowledge_reports(123)
187
+ #
188
+ # Returns Report Acknowledgements.
189
+ def_delegator :report_acknowledgements, :acknowledge, :acknowledge_reports
190
+
191
+ # Public: Update acknowledged status of one or more reports to false.
192
+ #
193
+ # ids - One or more Integer report ids.
194
+ #
195
+ # Examples
196
+ #
197
+ # client.unacknowledge_reports(123)
198
+ #
199
+ # Returns Report Acknowledgements.
200
+ def_delegator :report_acknowledgements, :unacknowledge, :unacknowledge_reports
201
+
202
+ private
203
+
204
+ def report_request_info
205
+ @report_request_info ||= Requests::ReportRequestInfo.new(self)
206
+ end
207
+
208
+ def report_request_list
209
+ @report_request_list ||= Requests::ReportRequestList.new(self)
210
+ end
211
+
212
+ def report_request_count
213
+ @report_request_count ||= Requests::ReportRequestCount.new(self)
214
+ end
215
+
216
+ def report_requests
217
+ @report_requests ||= Requests::ReportRequests.new(self)
218
+ end
219
+
220
+ def report_list
221
+ @report_list ||= Requests::ReportList.new(self)
222
+ end
223
+
224
+ def report_count
225
+ @report_count ||= Requests::ReportCount.new(self)
226
+ end
227
+
228
+ def report
229
+ @report ||= Requests::Report.new(self)
230
+ end
231
+
232
+ def report_scheduler
233
+ @report_scheduler ||= Requests::ReportScheduler.new(self)
234
+ end
235
+
236
+ def report_schedule_list
237
+ @report_schedule_list ||= Requests::ReportScheduleList.new(self)
238
+ end
239
+
240
+ def report_schedule_count
241
+ @report_schedule_count ||= Requests::ReportScheduleCount.new(self)
242
+ end
243
+
244
+ def report_acknowledgements
245
+ @report_acknowledgements ||= Requests::ReportAcknowledgements.new(self)
246
+ end
4
247
  end
5
248
  end
6
249
  end
@@ -0,0 +1,10 @@
1
+ require 'peddler/parsers/text'
2
+
3
+ module MWS
4
+ module Reports
5
+ module Parsers
6
+ class Report < ::Peddler::Parsers::Text
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,20 @@
1
+ require 'peddler/parsers/collection'
2
+ require 'mws/reports/parsers/report_info'
3
+
4
+ module MWS
5
+ module Reports
6
+ module Parsers
7
+ class ReportAcknowledgements < ::Peddler::Parsers::Collection
8
+ def each(&blk)
9
+ report_info_nodes.each { |node| yield ReportInfo.new(node) }
10
+ end
11
+
12
+ private
13
+
14
+ def report_info_nodes
15
+ xpath('ReportInfo')
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+ require 'peddler/parsers/counter'
2
+
3
+ module MWS
4
+ module Reports
5
+ module Parsers
6
+ class ReportCount < ::Peddler::Parsers::Counter
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,29 @@
1
+ require 'peddler/parsers/model'
2
+
3
+ module MWS
4
+ module Reports
5
+ module Parsers
6
+ class ReportInfo < ::Peddler::Parsers::Model
7
+ value :id do
8
+ text_at_xpath('ReportId')
9
+ end
10
+
11
+ value :type do
12
+ text_at_xpath('ReportType')
13
+ end
14
+
15
+ value :request_id do
16
+ text_at_xpath('ReportRequestId')
17
+ end
18
+
19
+ value :available_at do
20
+ time_at_xpath('AvailableDate')
21
+ end
22
+
23
+ value :acknowledged? do
24
+ boolean_at_xpath('Acknowledged')
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ require 'peddler/parsers/collection'
2
+ require 'mws/reports/parsers/report_info'
3
+ require 'peddler/parsers/tokenable'
4
+
5
+ module MWS
6
+ module Reports
7
+ module Parsers
8
+ class ReportList < ::Peddler::Parsers::Collection
9
+ include ::Peddler::Parsers::Tokenable
10
+
11
+ def each(&blk)
12
+ report_info_nodes.each { |node| yield ReportInfo.new(node) }
13
+ end
14
+
15
+ private
16
+
17
+ def report_info_nodes
18
+ xpath('ReportInfo')
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,10 @@
1
+ require 'peddler/parsers/counter'
2
+
3
+ module MWS
4
+ module Reports
5
+ module Parsers
6
+ class ReportRequestCount < ::Peddler::Parsers::Counter
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,49 @@
1
+ require 'peddler/parsers/model'
2
+
3
+ module MWS
4
+ module Reports
5
+ module Parsers
6
+ class ReportRequestInfo < ::Peddler::Parsers::Model
7
+ value :id do
8
+ text_at_xpath('ReportRequestId')
9
+ end
10
+
11
+ value :type do
12
+ text_at_xpath('ReportType')
13
+ end
14
+
15
+ value :started_at do
16
+ time_at_xpath('StartDate')
17
+ end
18
+
19
+ value :ended_at do
20
+ time_at_xpath('EndDate')
21
+ end
22
+
23
+ value :scheduled? do
24
+ boolean_at_xpath('Scheduled')
25
+ end
26
+
27
+ value :submitted_at do
28
+ time_at_xpath('SubmittedDate')
29
+ end
30
+
31
+ value :processing_status do
32
+ text_at_xpath('ReportProcessingStatus')
33
+ end
34
+
35
+ value :generated_report_id do
36
+ text_at_xpath('GeneratedReportId')
37
+ end
38
+
39
+ value :started_processing_at do
40
+ time_at_xpath('StartedProcessingDate')
41
+ end
42
+
43
+ value :completed_at do
44
+ time_at_xpath('CompletedDate')
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,23 @@
1
+ require 'peddler/parsers/collection'
2
+ require 'mws/reports/parsers/report_request_info'
3
+ require 'peddler/parsers/tokenable'
4
+
5
+ module MWS
6
+ module Reports
7
+ module Parsers
8
+ class ReportRequestList < ::Peddler::Parsers::Collection
9
+ include ::Peddler::Parsers::Tokenable
10
+
11
+ def each(&blk)
12
+ report_request_info_nodes.each { |node| yield ReportRequestInfo.new(node) }
13
+ end
14
+
15
+ private
16
+
17
+ def report_request_info_nodes
18
+ xpath('ReportRequestInfo')
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ require 'peddler/parsers/model'
2
+ require 'mws/reports/parsers/report_request_info'
3
+
4
+ module MWS
5
+ module Reports
6
+ module Parsers
7
+ class ReportRequests < ::Peddler::Parsers::Model
8
+ value :count do
9
+ integer_at_xpath('Count')
10
+ end
11
+
12
+ def report_request_infos
13
+ xpath('ReportRequestInfo').map { |node| ReportRequestInfo.new(node) }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ require 'peddler/parsers/model'
2
+
3
+ module MWS
4
+ module Reports
5
+ module Parsers
6
+ class ReportSchedule < ::Peddler::Parsers::Model
7
+ value :type do
8
+ text_at_xpath('ReportType')
9
+ end
10
+
11
+ value :schedule do
12
+ text_at_xpath('Schedule')
13
+ end
14
+
15
+ value :scheduled_at do
16
+ time_at_xpath('ScheduledDate')
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ require 'peddler/parsers/counter'
2
+
3
+ module MWS
4
+ module Reports
5
+ module Parsers
6
+ class ReportScheduleCount < ::Peddler::Parsers::Counter
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ require 'peddler/parsers/collection'
2
+ require 'mws/reports/parsers/report_schedule'
3
+ require 'peddler/parsers/tokenable'
4
+
5
+ module MWS
6
+ module Reports
7
+ module Parsers
8
+ class ReportScheduleList < ::Peddler::Parsers::Collection
9
+ include ::Peddler::Parsers::Tokenable
10
+
11
+ def each(&blk)
12
+ report_schedule_nodes.each { |node| yield ReportSchedule.new(node) }
13
+ end
14
+
15
+ private
16
+
17
+ def report_schedule_nodes
18
+ xpath('ReportSchedule')
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ require 'peddler/parsers/model'
2
+ require 'mws/reports/parsers/report_schedule'
3
+
4
+ module MWS
5
+ module Reports
6
+ module Parsers
7
+ class ReportScheduler < ::Peddler::Parsers::Model
8
+ value :count do
9
+ integer_at_xpath('Count')
10
+ end
11
+
12
+ value :report_schedule do
13
+ node = at_xpath('ReportSchedule')
14
+ ReportSchedule.new(node) if node
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ require 'peddler/request'
2
+ require 'mws/reports/parsers/report'
3
+
4
+ module MWS
5
+ module Reports
6
+ module Requests
7
+ class Report < ::Peddler::Request
8
+ def get(id)
9
+ parameters(:get_report)
10
+ .update(report_id: id)
11
+ .camelize_keys!
12
+
13
+ execute
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,27 @@
1
+ require 'peddler/request'
2
+ require 'mws/reports/parsers/report_acknowledgements'
3
+
4
+ module MWS
5
+ module Reports
6
+ module Requests
7
+ class ReportAcknowledgements < ::Peddler::Request
8
+ def update(acknowledged, *ids)
9
+ parameters(:update_report_acknowledgements)
10
+ .update(report_id_list: ids, acknowledged: acknowledged)
11
+ .format_structured_lists!
12
+ .camelize_keys!
13
+
14
+ execute
15
+ end
16
+
17
+ def acknowledge(*ids)
18
+ update(true, *ids)
19
+ end
20
+
21
+ def unacknowledge(*ids)
22
+ update(false, *ids)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ require 'peddler/request'
2
+ require 'mws/reports/parsers/report_count'
3
+
4
+ module MWS
5
+ module Reports
6
+ module Requests
7
+ class ReportCount < ::Peddler::Request
8
+ def get(options = {})
9
+ parameters(:get_report_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
@@ -0,0 +1,30 @@
1
+ require 'peddler/request'
2
+ require 'mws/reports/parsers/report_list'
3
+
4
+ module MWS
5
+ module Reports
6
+ module Requests
7
+ class ReportList < ::Peddler::Request
8
+ def get(options = {})
9
+ parameters(:get_report_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_report_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
@@ -0,0 +1,20 @@
1
+ require 'peddler/request'
2
+ require 'mws/reports/parsers/report_request_count'
3
+
4
+ module MWS
5
+ module Reports
6
+ module Requests
7
+ class ReportRequestCount < ::Peddler::Request
8
+ def get(options = {})
9
+ parameters(:get_report_request_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
@@ -0,0 +1,21 @@
1
+ require 'peddler/request'
2
+ require 'mws/reports/parsers/report_request_info'
3
+
4
+ module MWS
5
+ module Reports
6
+ module Requests
7
+ class ReportRequestInfo < ::Peddler::Request
8
+ def request(type, options = {})
9
+ parameters(:request_report)
10
+ .update(type: type)
11
+ .update(options)
12
+ .timestamp!
13
+ .format_structured_lists!
14
+ .camelize_keys!
15
+
16
+ execute
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end