Class: Peddler::APIs::Reports20210630

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/reports_2021_06_30.rb

Overview

Selling Partner API for Reports

The Selling Partner API for Reports lets you retrieve and manage a variety of reports that can help selling partners manage their businesses.

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #parser

Instance Method Summary collapse

Methods inherited from Peddler::API

#endpoint_uri, #http, #initialize, #meter, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#cancel_report(report_id, rate_limit: 0.0222) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Cancels the report that you specify. Only reports with processingStatus=IN_QUEUE can be cancelled. Cancelled reports are returned in subsequent calls to the getReport and getReports operations.

Parameters:

  • report_id (String)

    The identifier for the report. This identifier is unique only in combination with a seller ID.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



76
77
78
79
80
# File 'lib/peddler/apis/reports_2021_06_30.rb', line 76

def cancel_report(report_id, rate_limit: 0.0222)
  path = "/reports/2021-06-30/reports/#{report_id}"

  meter(rate_limit).delete(path)
end

#cancel_report_schedule(report_schedule_id, rate_limit: 0.0222) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Cancels the report schedule that you specify.

Parameters:

  • report_schedule_id (String)

    The identifier for the report schedule. This identifier is unique only in combination with a seller ID.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



131
132
133
134
135
# File 'lib/peddler/apis/reports_2021_06_30.rb', line 131

def cancel_report_schedule(report_schedule_id, rate_limit: 0.0222)
  path = "/reports/2021-06-30/schedules/#{report_schedule_id}"

  meter(rate_limit).delete(path)
end

#create_report(body, rate_limit: 0.0167) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Creates a report.

Parameters:

  • body (Hash)

    Information required to create the report.

  • rate_limit (Float) (defaults to: 0.0167)

    Requests per second

Returns:



62
63
64
65
66
# File 'lib/peddler/apis/reports_2021_06_30.rb', line 62

def create_report(body, rate_limit: 0.0167)
  path = "/reports/2021-06-30/reports"

  meter(rate_limit).post(path, body:)
end

#create_report_schedule(body, rate_limit: 0.0222) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it will be cancelled and replaced with this one.

Parameters:

  • body (Hash)

    Information required to create the report schedule.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



118
119
120
121
122
# File 'lib/peddler/apis/reports_2021_06_30.rb', line 118

def create_report_schedule(body, rate_limit: 0.0222)
  path = "/reports/2021-06-30/schedules"

  meter(rate_limit).post(path, body:)
end

#get_report(report_id, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns report details (including the reportDocumentId, if available) for the report that you specify.

Parameters:

  • report_id (String)

    The identifier for the report. This identifier is unique only in combination with a seller ID.

  • rate_limit (Float) (defaults to: 2.0)

    Requests per second

Returns:



89
90
91
92
93
# File 'lib/peddler/apis/reports_2021_06_30.rb', line 89

def get_report(report_id, rate_limit: 2.0)
  path = "/reports/2021-06-30/reports/#{report_id}"

  meter(rate_limit).get(path)
end

#get_report_document(report_document_id, rate_limit: 0.0167) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the information required for retrieving a report document's contents.

Parameters:

  • report_document_id (String)

    The identifier for the report document.

  • rate_limit (Float) (defaults to: 0.0167)

    Requests per second

Returns:



156
157
158
159
160
# File 'lib/peddler/apis/reports_2021_06_30.rb', line 156

def get_report_document(report_document_id, rate_limit: 0.0167)
  path = "/reports/2021-06-30/documents/#{report_document_id}"

  meter(rate_limit).get(path)
end

#get_report_schedule(report_schedule_id, rate_limit: 0.0222) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns report schedule details for the report schedule that you specify.

Parameters:

  • report_schedule_id (String)

    The identifier for the report schedule. This identifier is unique only in combination with a seller ID.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



144
145
146
147
148
# File 'lib/peddler/apis/reports_2021_06_30.rb', line 144

def get_report_schedule(report_schedule_id, rate_limit: 0.0222)
  path = "/reports/2021-06-30/schedules/#{report_schedule_id}"

  meter(rate_limit).get(path)
end

#get_report_schedules(report_types, rate_limit: 0.0222) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns report schedule details that match the filters that you specify.

Parameters:

  • report_types (Array<String>)

    A list of report types used to filter report schedules. Refer to Report Type Values for more information.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



102
103
104
105
106
107
108
109
# File 'lib/peddler/apis/reports_2021_06_30.rb', line 102

def get_report_schedules(report_types, rate_limit: 0.0222)
  path = "/reports/2021-06-30/schedules"
  params = {
    "reportTypes" => report_types,
  }.compact

  meter(rate_limit).get(path, params:)
end

#get_reports(report_types: nil, processing_statuses: nil, marketplace_ids: nil, page_size: 10, created_since: nil, created_until: nil, next_token: nil, rate_limit: 0.0222) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns report details for the reports that match the filters that you specify.

Parameters:

  • report_types (Array<String>) (defaults to: nil)

    A list of report types used to filter reports. Refer to Report Type Values for more information. When reportTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either reportTypes or nextToken is required.

  • processing_statuses (Array<String>) (defaults to: nil)

    A list of processing statuses used to filter reports.

  • marketplace_ids (Array<String>) (defaults to: nil)

    A list of marketplace identifiers used to filter reports. The reports returned will match at least one of the marketplaces that you specify.

  • page_size (Integer) (defaults to: 10)

    The maximum number of reports to return in a single call.

  • created_since (String) (defaults to: nil)

    The earliest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is 90 days ago. Reports are retained for a maximum of 90 days.

  • created_until (String) (defaults to: nil)

    The latest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is now.

  • next_token (String) (defaults to: nil)

    A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getReports operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/peddler/apis/reports_2021_06_30.rb', line 40

def get_reports(report_types: nil, processing_statuses: nil, marketplace_ids: nil, page_size: 10,
  created_since: nil, created_until: nil, next_token: nil, rate_limit: 0.0222)
  path = "/reports/2021-06-30/reports"
  params = {
    "reportTypes" => report_types,
    "processingStatuses" => processing_statuses,
    "marketplaceIds" => marketplace_ids,
    "pageSize" => page_size,
    "createdSince" => created_since,
    "createdUntil" => created_until,
    "nextToken" => next_token,
  }.compact

  meter(rate_limit).get(path, params:)
end