Class: Peddler::APIs::FinancesV0

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

Overview

Selling Partner API for Finances

The Selling Partner API for Finances helps you obtain financial information relevant to a seller's business. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #parser, #retries

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

#list_financial_event_groups(max_results_per_page: 10, financial_event_group_started_before: nil, financial_event_group_started_after: nil, next_token: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns financial event groups for a given date range. It may take up to 48 hours for orders to appear in your financial events.

Parameters:

  • max_results_per_page (Integer) (defaults to: 10)

    The maximum number of results to return per page. If the response exceeds the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.

  • financial_event_group_started_before (String) (defaults to: nil)

    A date used for selecting financial event groups that opened before (but not at) a specified date and time, in ISO 8601 format. The date-time must be later than FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no financial event groups are returned.

  • financial_event_group_started_after (String) (defaults to: nil)

    A date used for selecting financial event groups that opened after (or at) a specified date and time, in ISO 8601 format. The date-time must be no later than two minutes before the request was submitted.

  • next_token (String) (defaults to: nil)

    A string token returned in the response of your previous request.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/peddler/apis/finances_v0.rb', line 37

def list_financial_event_groups(max_results_per_page: 10, financial_event_group_started_before: nil,
  financial_event_group_started_after: nil, next_token: nil, rate_limit: 0.5)
  path = "/finances/v0/financialEventGroups"
  params = {
    "MaxResultsPerPage" => max_results_per_page,
    "FinancialEventGroupStartedBefore" => financial_event_group_started_before,
    "FinancialEventGroupStartedAfter" => financial_event_group_started_after,
    "NextToken" => next_token,
  }.compact

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

#list_financial_events(max_results_per_page: 100, posted_after: nil, posted_before: nil, next_token: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns financial events for the specified data range. It may take up to 48 hours for orders to appear in your financial events. Note: in ListFinancialEvents, deferred events don't show up in responses until in they are released.

Parameters:

  • max_results_per_page (Integer) (defaults to: 100)

    The maximum number of results to return per page. If the response exceeds the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.

  • posted_after (String) (defaults to: nil)

    A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format.

  • posted_before (String) (defaults to: nil)

    A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes.

  • next_token (String) (defaults to: nil)

    A string token returned in the response of your previous request.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/peddler/apis/finances_v0.rb', line 121

def list_financial_events(max_results_per_page: 100, posted_after: nil, posted_before: nil, next_token: nil,
  rate_limit: 0.5)
  path = "/finances/v0/financialEvents"
  params = {
    "MaxResultsPerPage" => max_results_per_page,
    "PostedAfter" => posted_after,
    "PostedBefore" => posted_before,
    "NextToken" => next_token,
  }.compact

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

#list_financial_events_by_group_id(event_group_id, max_results_per_page: 100, posted_after: nil, posted_before: nil, next_token: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns all financial events for the specified financial event group. It may take up to 48 hours for orders to appear in your financial events. Note: This operation will only retrieve group's data for the past two years. If a request is submitted for data spanning more than two years, an empty response is returned.

Parameters:

  • max_results_per_page (Integer) (defaults to: 100)

    The maximum number of results to return per page. If the response exceeds the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.

  • posted_after (String) (defaults to: nil)

    A date used for selecting financial events posted after (or at) a specified time. The date-time must be more than two minutes before the time of the request, in ISO 8601 date time format.

  • posted_before (String) (defaults to: nil)

    A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes.

  • event_group_id (String)

    The identifier of the financial event group to which the events belong.

  • next_token (String) (defaults to: nil)

    A string token returned in the response of your previous request.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/peddler/apis/finances_v0.rb', line 70

def list_financial_events_by_group_id(event_group_id, max_results_per_page: 100, posted_after: nil,
  posted_before: nil, next_token: nil, rate_limit: 0.5)
  path = "/finances/v0/financialEventGroups/#{event_group_id}/financialEvents"
  params = {
    "MaxResultsPerPage" => max_results_per_page,
    "PostedAfter" => posted_after,
    "PostedBefore" => posted_before,
    "NextToken" => next_token,
  }.compact

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

#list_financial_events_by_order_id(order_id, max_results_per_page: 100, next_token: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns all financial events for the specified order. It may take up to 48 hours for orders to appear in your financial events.

Parameters:

  • order_id (String)

    An Amazon-defined order identifier, in 3-7-7 format.

  • max_results_per_page (Integer) (defaults to: 100)

    The maximum number of results to return per page. If the response exceeds the maximum number of transactions or 10 MB, the API responds with 'InvalidInput'.

  • next_token (String) (defaults to: nil)

    A string token returned in the response of your previous request.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



93
94
95
96
97
98
99
100
101
# File 'lib/peddler/apis/finances_v0.rb', line 93

def list_financial_events_by_order_id(order_id, max_results_per_page: 100, next_token: nil, rate_limit: 0.5)
  path = "/finances/v0/orders/#{order_id}/financialEvents"
  params = {
    "MaxResultsPerPage" => max_results_per_page,
    "NextToken" => next_token,
  }.compact

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