Module: Amazon::MWS::Report
- Defined in:
- lib/amazon/mws/request/report.rb
Constant Summary collapse
- REPORT_TYPES =
{ :flat_file_open_listings => '_GET_FLAT_FILE_OPEN_LISTINGS_DATA_', :merchant_listing => '_GET_MERCHANT_LISTINGS_DATA_', :merchant_listings_lite => '_GET_MERCHANT_LISTINGS_DATA_LITE_', :merchant_listings_liter => '_GET_MERCHANT_LISTINGS_DATA_LITER_', :merchant_canceled_listings => '_GET_MERCHANT_CANCELLED_LISTINGS_DATA_', :nemo_merchant_listings => '_GET_NEMO_MERCHANT_LISTINGS_DATA_', :afn_inventory => '_GET_AFN_INVENTORY_DATA_', :flat_file_actionable_order => '_GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_', :orders => '_GET_ORDERS_DATA_', #API Function: ManageReportSchedule :flat_file_order_report => '_GET_FLAT_FILE_ORDER_REPORT_DATA_', #API Function: ManageReportSchedule :flat_file_orders => '_GET_FLAT_FILE_ORDERS_DATA_', :converged_flat_file_order_report => '_GET_CONVERGED_FLAT_FILE_ORDER_REPORT_DATA_' }
- SCHEDULE =
{ '15 minutes' => '_15_MINUTES_', '30 minutes' => '_30_MINUTES_', '1 hour' => '_1_HOUR_', '2 hours' => '_2_HOURS_', '4 hours' => '_4_HOURS_', '8 hours' => '_8_HOURS_', '12 hours' => '_12_HOURS_', '1 day' => '_1_DAY_', '2 days' => '_2_DAYS_', '3 days' => '_72_HOURS_', '7 days' => '_7_DAYS_', '14 days' => '_14_DAYS_', '15 days' => '_15_DAYS_', '30 days' => '_30_DAYS_', 'Delete' => '_NEVER_' }
Instance Method Summary collapse
-
#cancel_report_requests(params = {}) ⇒ Object
ReportRequestIdList A structured list of report request IDs.
-
#get_report(report_id, params = {}) ⇒ Object
(also: #report)
GetReport Description.
-
#get_report_count(params = {}) ⇒ Object
(also: #report_count)
ReportTypeList A structured ReportType list by which to filter reports.
-
#get_report_list(params = {}) ⇒ Object
(also: #report_list)
GetReportList The GetReportList operation returns a list of reports within the previous 90 days that match the query parameters.
-
#get_report_request_count(params = {}) ⇒ Object
(also: #report_request_count)
GetReportRequestCount The GetReportRequestCount returns a count of report requests.
-
#get_report_request_list(params = {}) ⇒ Object
(also: #report_request_list)
Optional Request Parameters.
-
#get_report_request_list_by_next_token(next_token) ⇒ Object
(also: #report_request_list_by_next_token)
NextToken Token returned in a previous call to either GetReportRequestList or GetReportRequestListByNextToken when the value of HasNext was true.
- #get_report_schedule_count(params = {}) ⇒ Object (also: #report_schedule_count)
-
#get_report_schedule_list(params = {}) ⇒ Object
(also: #report_schedule_list)
GetReportScheduleList The GetReportScheduleList operation returns a list of report schedules that match the query parameters.
- #get_report_schedule_list_by_next_token(next_token) ⇒ Object (also: #report_schedule_list_by_next_token)
-
#manage_report_schedule(report_type, schedule, params = {}) ⇒ Object
ManageReportSchedule The ManageReportSchedule operation creates, updates, or deletes a report schedule for a particular report type.
-
#request_report(report_type, params = {}) ⇒ Object
The RequestReport operation requests the generation of a report, which creates a report request.
Instance Method Details
#cancel_report_requests(params = {}) ⇒ Object
ReportRequestIdList A structured list of report request IDs. If you pass in explicit IDs in this call, the other conditions, if specified, will be ignored.
ReportTypeList A structured ReportType list by which to filter reports.
ReportProcessingStatusList A structured list of report processing statuses by which to filter report requests.
ReportProcessingStatus SUBMITTED IN_PROGRESS CANCELLED DONE DONE_NO_DATA
RequestedFromDate The earliest date you are looking for, in ISO8601 date format (for example, “2008-07-03T18:12:22Z” or “2008-07-03T18:12:22.093-07:00”).
RequestedToDate The most recent date you are looking for.
178 179 180 181 |
# File 'lib/amazon/mws/request/report.rb', line 178 def cancel_report_requests(params = {}) response = get("/", {"Action" => "CancelReportRequests"}.merge(params)) CancelReportRequestsResponse.format(response) end |
#get_report(report_id, params = {}) ⇒ Object Also known as: report
GetReport Description
The GetReport operation returns the contents of a report and the Content-MD5 header for the returned body. Reports are retained for 90 days from the time they have been generated.
Amazon MWS limits calls to 1,000 total calls per hour per seller account, including a limit of 60 calls per hour to GetReport.
You should compute the MD5 hash of the HTTP body and compare that with the returned Content-MD5 header value. If they do not match, which means the body was corrupted during transmission, you should discard the result and automatically retry the call for up to three more times. Please notify us if you ever see such a corrupted body. You can contact us by using the contact form at mws.amazon.com (mws.amazon.com). For more information, see Using the Content-MD5 Header with SubmitFeed.
247 248 249 250 |
# File 'lib/amazon/mws/request/report.rb', line 247 def get_report(report_id, params = {}) response = get("/", {"Action" => "GetReport", "ReportId" => report_id}) #TODO format response end |
#get_report_count(params = {}) ⇒ Object Also known as: report_count
ReportTypeList A structured ReportType list by which to filter reports.
Acknowledged Set to true to list reports that have been acknowledged with a prior call to UpdateReportAcknowledgements. Set to false to list reports that have not been acknowledged.
AvailableFromDate The earliest date you are looking for, in ISO8601 date format (for example, “2008-07-03T18:12:22Z” or “2008-07-03T18:12:22.093-07:00”).
AvailableToDate The most recent date you are looking for.
220 221 222 223 |
# File 'lib/amazon/mws/request/report.rb', line 220 def get_report_count(params = {}) response = get("/", {"Action" => "GetReportCount"}) GetReportCountResponse.format(response) end |
#get_report_list(params = {}) ⇒ Object Also known as: report_list
GetReportList The GetReportList operation returns a list of reports within the previous 90 days that match the query parameters. The maximum number of results that will be returned in one call is one hundred. If there are additional results to return, HasNext will be returned in the response with a true value. To retrieve all the results, you can use the value of the NextToken parameter to call GetReportListByNextToken until HasNext is false.
Request Parameters
194 195 196 197 |
# File 'lib/amazon/mws/request/report.rb', line 194 def get_report_list(params = {}) response = get("/", {"Action" => "GetReportList"}.merge(params)) GetReportListResponse.format(response) end |
#get_report_request_count(params = {}) ⇒ Object Also known as: report_request_count
GetReportRequestCount The GetReportRequestCount returns a count of report requests.
138 139 140 141 |
# File 'lib/amazon/mws/request/report.rb', line 138 def get_report_request_count(params = {}) response = get("/", {"Action" => "GetReportRequestCount"}) GetReportRequestCountResponse.format(response) end |
#get_report_request_list(params = {}) ⇒ Object Also known as: report_request_list
Optional Request Parameters
ReportRequestIdList - A structured list of report request IDs. If you pass in explicit IDs in this call, the other conditions, if specified, will be ignored.
ReportTypeList - A structured ReportType list by which to filter reports.
ReportProcessingStatusList -A structured list of report processing statuses by which to filter report requests.
ReportProcessingStatus values:
SUBMITTED IN_PROGRESS CANCELLED DONE DONE_NO_DATA
MaxCount - Maximum number of reports to return in the list. If you specify a number greater than 100, the call will be rejected.
RequestedFromDate - The earliest date you are looking for, in ISO8601 date format (for example, “2008-07-03T18:12:22Z” or “2008-07-03T18:12:22.093-07:00”).
RequestedToDate - The most recent date you are looking for.
103 104 105 106 |
# File 'lib/amazon/mws/request/report.rb', line 103 def get_report_request_list(params = {}) response = get("/", {"Action" => "GetReportRequestList"}.merge(params)) GetReportRequestListResponse.format(response) end |
#get_report_request_list_by_next_token(next_token) ⇒ Object Also known as: report_request_list_by_next_token
NextToken Token returned in a previous call to either GetReportRequestList or GetReportRequestListByNextToken when the value of HasNext was true.
123 124 125 126 127 128 129 130 131 |
# File 'lib/amazon/mws/request/report.rb', line 123 def get_report_request_list_by_next_token(next_token) response = post("/", { "Action" => "GetReportRequestListByNextToken", "NextToken" => next_token }) GetReportRequestListByNextTokenResponse.format(response) end |
#get_report_schedule_count(params = {}) ⇒ Object Also known as: report_schedule_count
321 322 323 324 |
# File 'lib/amazon/mws/request/report.rb', line 321 def get_report_schedule_count(params = {}) response = get("/", {"Action" => "GetReportScheduleCount"}) GetReportScheduleCountResponse.format(response) end |
#get_report_schedule_list(params = {}) ⇒ Object Also known as: report_schedule_list
GetReportScheduleList The GetReportScheduleList operation returns a list of report schedules that match the query parameters. Currently, only order reports can be scheduled.
The maximum number of results that will be returned in one call is one hundred. If there are additional results to return, HasNext will be returned in the response with a true value. To retrieve all the results, you can use the value of the NextToken parameter to call GetReportScheduleListByNextToken until HasNext is false.
- Note
-
Note
For this release of Amazon MWS, only order reports can be scheduled, so HasNext will always be False.
302 303 304 305 |
# File 'lib/amazon/mws/request/report.rb', line 302 def get_report_schedule_list(params = {}) response = get("/", {"Action" => "GetReportScheduleList"}.merge(params)) GetReportScheduleListResponse.format(response) end |
#get_report_schedule_list_by_next_token(next_token) ⇒ Object Also known as: report_schedule_list_by_next_token
309 310 311 312 313 314 315 316 317 |
# File 'lib/amazon/mws/request/report.rb', line 309 def get_report_schedule_list_by_next_token(next_token) response = get("/", { "Action" => "GetReportScheduleListByNextToken", "NextToken" => next_token }) GetReportScheduleListByNextTokenResponse.format(response) end |
#manage_report_schedule(report_type, schedule, params = {}) ⇒ Object
ManageReportSchedule The ManageReportSchedule operation creates, updates, or deletes a report schedule for a particular report type. Currently, only order reports can be scheduled.
Request Parameters
ReportType The type of reports that you want to schedule generation of. Currently, only order reports can be scheduled.
Schedule A string that describes how often a ReportRequest should be created. The list of enumerated values is found in the enumeration topic, Schedule.
ScheduledDate The date when the next report is scheduled to run. Limited to no more than 366 days in the future.
273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/amazon/mws/request/report.rb', line 273 def manage_report_schedule(report_type, schedule, params={}) raise InvalidReportType if !REPORT_TYPES.include?(report_type) raise InvalidSchedule if !SCHEDULE.include?(schedule) response = get("/", { "Action" => "ManageReportSchedule", "Schedule" => SCHEDULE[schedule], "ReportType" => REPORT_TYPES[report_type] }) ManageReportScheduleResponse.format(response) end |
#request_report(report_type, params = {}) ⇒ Object
The RequestReport operation requests the generation of a report, which creates a report request. Reports are retained for 90 days. Required Request Parameters ReportType - The type of report to request.
Optional Request Parameters StartDate - Start of a date range used for selecting the data to report. EndDate - End of a date range used for selecting the data to report.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/amazon/mws/request/report.rb', line 49 def request_report(report_type, params ={}) raise InvalidReportType if !REPORT_TYPES.include?(report_type) query_params = { "Action" => "RequestReport", "ReportType" => REPORT_TYPES[report_type] } query_params.merge!({"StartDate" => params[:start_date]}) if params[:start_date] query_params.merge!({"EndDate" => params[:end_date]}) if params[:end_date] response = get("/", query_params) RequestReportResponse.format(response) end |