Skip to content

Commit

Permalink
Add new apis
Browse files Browse the repository at this point in the history
- application integrations 2024-04-01
- finances 2024-06-19
- invoices 2024-06-19
  • Loading branch information
hakanensari committed Oct 4, 2024
1 parent 8295149 commit 56a5421
Show file tree
Hide file tree
Showing 7 changed files with 345 additions and 55 deletions.
3 changes: 3 additions & 0 deletions lib/peddler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require "peddler/api/amazon_warehousing_and_distribution_2024_05_09"
require "peddler/api/aplus_content_2020_11_01"
require "peddler/api/application_integrations_2024_04_01"
require "peddler/api/application_management_2023_11_30"
require "peddler/api/catalog_items_2020_12_01"
require "peddler/api/catalog_items_2022_04_01"
Expand All @@ -11,10 +12,12 @@
require "peddler/api/fba_inbound_eligibility_v1"
require "peddler/api/fba_inventory_v1"
require "peddler/api/feeds_2021_06_30"
require "peddler/api/finances_2024_06_19"
require "peddler/api/finances_v0"
require "peddler/api/fulfillment_inbound_2024_03_20"
require "peddler/api/fulfillment_inbound_v0"
require "peddler/api/fulfillment_outbound_2020_07_01"
require "peddler/api/invoices_2024_06_19"
require "peddler/api/listings_items_2020_09_01"
require "peddler/api/listings_items_2021_08_01"
require "peddler/api/listings_restrictions_2021_08_01"
Expand Down
56 changes: 56 additions & 0 deletions lib/peddler/api/application_integrations_2024_04_01.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# frozen_string_literal: true

require "peddler/api"

module Peddler
class << self
def application_integrations_2024_04_01(...)
API::ApplicationIntegrations20240401.new(...)
end
end

class API
# The Selling Partner API for third party application integrations.
#
# With the AppIntegrations API v2024-04-01, you can send notifications to Amazon Selling Partners and display the
# notifications in Seller Central.
class ApplicationIntegrations20240401 < API
# Create a notification for sellers in Seller Central.
#
# @note This operation can make a static sandbox call.
# @param body [Hash] The request body for the `createNotification` operation.
# @param rate_limit [Float] Requests per second
# @return [Hash] The API response
def create_notification(body, rate_limit: 1.0)
path = "/appIntegrations/2024-04-01/notifications"

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

# Remove your application's notifications from the Appstore notifications dashboard.
#
# @note This operation can make a static sandbox call.
# @param body [Hash] The request body for the `deleteNotifications` operation.
# @param rate_limit [Float] Requests per second
# @return [Hash] The API response
def delete_notifications(body, rate_limit: 1.0)
path = "/appIntegrations/2024-04-01/notifications/deletion"

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

# Records the seller's response to a notification.
#
# @note This operation can make a static sandbox call.
# @param notification_id [String] A `notificationId` uniquely identifies a notification.
# @param body [Hash] The request body for the `recordActionFeedback` operation.
# @param rate_limit [Float] Requests per second
# @return [Hash] The API response
def record_action_feedback(notification_id, body, rate_limit: 1.0)
path = "/appIntegrations/2024-04-01/notifications/#{notification_id}/feedback"

meter(rate_limit).post(path, body:)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/peddler/api/fba_inventory_v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FBAInventoryV1 < API
# sellerSkus. The sellerSku parameter is ignored. - When the sellerSku parameter is provided, the operation
# returns inventory summaries for only the specified sellerSku. Note: The parameters associated with this
# operation may contain special characters that must be encoded to successfully call the API. To avoid errors with
# SKUs when encoding URLs, refer to URL Encoding.
# SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
#
# @note This operation can make a dynamic sandbox call.
# @param details [Boolean] true to return inventory summaries with additional summarized inventory details and
Expand Down
50 changes: 50 additions & 0 deletions lib/peddler/api/finances_2024_06_19.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# frozen_string_literal: true

require "peddler/api"

module Peddler
class << self
def finances_2024_06_19(...)
API::Finances20240619.new(...)
end
end

class API
# The Selling Partner API for Finances
#
# The Selling Partner API for Finances provides financial information relevant to a seller's business. You can
# obtain financial events for a given order or date range without having to wait until a statement period closes.
class Finances20240619 < API
# Returns transactions for the given parameters. Orders from the last 48 hours might not be included in financial
# events.
#
# @note This operation can make a static sandbox call.
# @param posted_after [String] The response includes financial events posted after (or on) this date. This date
# must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time
# must be more than two minutes before the time of the request.
# @param posted_before [String] The response includes financial events posted before (but not on) this date. This
# date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The
# date-time must be later than `PostedAfter` and more than two minutes before the request was submitted. If
# `PostedAfter` and `PostedBefore` are more than 180 days apart, the response is empty. **Default:** Two minutes
# before the time of the request.
# @param marketplace_id [String] The ID of the marketplace from which you want to retrieve transactions.
# @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
# `pageSize` value. To get the next page of results, call the operation with this token and include the same
# arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
# is null. Note that this operation can return empty pages.
# @param rate_limit [Float] Requests per second
# @return [Hash] The API response
def list_transactions(posted_after, posted_before: nil, marketplace_id: nil, next_token: nil, rate_limit: 0.5)
path = "/finances/2024-06-19/transactions"
params = {
"postedAfter" => posted_after,
"postedBefore" => posted_before,
"marketplaceId" => marketplace_id,
"nextToken" => next_token,
}.compact

meter(rate_limit).get(path, params:)
end
end
end
end
97 changes: 55 additions & 42 deletions lib/peddler/api/finances_v0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,32 @@ def finances_v0(...)
class API
# Selling Partner API for Finances
#
# The Selling Partner API for Finances helps you obtain financial information relevant to a seller's business. You
# The Selling Partner API for Finances provides financial information that is 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.
class FinancesV0 < API
# Returns financial event groups for a given date range. It may take up to 48 hours for orders to appear in your
# Returns financial event groups for a given date range. Orders from the last 48 hours might not be included in
# financial events.
#
# @note This operation can make a static sandbox call.
# @param max_results_per_page [Integer] 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'.
# @param financial_event_group_started_before [String] A date used for selecting financial event groups that
# opened before (but not at) a specified date and time, in [ISO
# 8601](https://developer-docs.amazon.com/sp-api/docs/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
# @param max_results_per_page [Integer] The maximum number of results per page. If the response exceeds the
# maximum number of transactions or 10 MB, the response is `InvalidInput`.
# @param financial_event_group_started_before [String] A date that selects financial event groups that opened
# before (but not at) a specified date and time, in [ISO
# 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. The date-time must be after
# `FinancialEventGroupStartedAfter` and more than two minutes before the time of request. If
# `FinancialEventGroupStartedAfter` and `FinancialEventGroupStartedBefore` are more than 180 days apart, no
# financial event groups are returned.
# @param financial_event_group_started_after [String] A date used for selecting financial event groups that opened
# after (or at) a specified date and time, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601)
# format. The date-time must be no later than two minutes before the request was submitted.
# @param next_token [String] A string token returned in the response of your previous request.
# @param financial_event_group_started_after [String] A date that selects financial event groups that opened after
# (or at) a specified date and time, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601)
# format. The date-time must be more than two minutes before you submit the request.
# @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
# `pageSize` value. To get the next page of results, call the operation with this token and include the same
# arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
# is null. Note that this operation can return empty pages.
# @param rate_limit [Float] Requests per second
# @return [Hash] The API response
def list_financial_event_groups(max_results_per_page: 100, financial_event_group_started_before: nil,
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 = {
Expand All @@ -47,24 +50,27 @@ def list_financial_event_groups(max_results_per_page: 100, financial_event_group
meter(rate_limit).get(path, params:)
end

# 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.
# Returns all financial events for the specified financial event group. Orders from the last 48 hours might not be
# included in financial events. **Note:** This operation only retrieves a group's data for the past two years. A
# request for data spanning more than two years produces an empty response.
#
# @note This operation can make a static sandbox call.
# @param max_results_per_page [Integer] 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'.
# @param posted_after [String] 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](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format.
# @param posted_before [String] 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](https://developer-docs.amazon.com/sp-api/docs/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.
# the maximum number of transactions or 10 MB, the response is `InvalidInput`.
# @param posted_after [String] The response includes financial events posted after (or on) this date. This date
# must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time
# must be more than two minutes before the time of the request.
# @param posted_before [String] The response includes financial events posted before (but not on) this date. This
# date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The
# date-time must be later than `PostedAfter` and more than two minutes before the requestd was submitted. If
# `PostedAfter` and `PostedBefore` are more than 180 days apart, the response is empty. If you include the
# `PostedBefore` parameter in your request, you must also specify the `PostedAfter` parameter. **Default:** Two
# minutes before the time of the request.
# @param event_group_id [String] The identifier of the financial event group to which the events belong.
# @param next_token [String] A string token returned in the response of your previous request.
# @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
# `pageSize` value. To get the next page of results, call the operation with this token and include the same
# arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
# is null. Note that this operation can return empty pages.
# @param rate_limit [Float] Requests per second
# @return [Hash] The API response
def list_financial_events_by_group_id(event_group_id, max_results_per_page: 100, posted_after: nil,
Expand All @@ -80,14 +86,17 @@ def list_financial_events_by_group_id(event_group_id, max_results_per_page: 100,
meter(rate_limit).get(path, params:)
end

# Returns all financial events for the specified order. It may take up to 48 hours for orders to appear in your
# Returns all financial events for the specified order. Orders from the last 48 hours might not be included in
# financial events.
#
# @note This operation can make a static sandbox call.
# @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
# @param max_results_per_page [Integer] 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'.
# @param next_token [String] A string token returned in the response of your previous request.
# the maximum number of transactions or 10 MB, the response is `InvalidInput`.
# @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
# `pageSize` value. To get the next page of results, call the operation with this token and include the same
# arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
# is null. Note that this operation can return empty pages.
# @param rate_limit [Float] Requests per second
# @return [Hash] The API response
def list_financial_events_by_order_id(order_id, max_results_per_page: 100, next_token: nil, rate_limit: 0.5)
Expand All @@ -100,22 +109,26 @@ def list_financial_events_by_order_id(order_id, max_results_per_page: 100, next_
meter(rate_limit).get(path, params:)
end

# Returns financial events for the specified data range. It may take up to 48 hours for orders to appear in your
# Returns financial events for the specified data range. Orders from the last 48 hours might not be included in
# financial events. **Note:** in `ListFinancialEvents`, deferred events don't show up in responses until in they
# are released.
#
# @note This operation can make a static sandbox call.
# @param max_results_per_page [Integer] 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'.
# @param posted_after [String] 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](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format.
# @param posted_before [String] 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](https://developer-docs.amazon.com/sp-api/docs/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.
# @param next_token [String] A string token returned in the response of your previous request.
# the maximum number of transactions or 10 MB, the response is `InvalidInput`.
# @param posted_after [String] The response includes financial events posted after (or on) this date. This date
# must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time
# must be more than two minutes before the time of the request.
# @param posted_before [String] The response includes financial events posted before (but not on) this date. This
# date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The
# date-time must be later than `PostedAfter` and more than two minutes before the request was submitted. If
# `PostedAfter` and `PostedBefore` are more than 180 days apart, the response is empty. If you include the
# `PostedBefore` parameter in your request, you must also specify the `PostedAfter` parameter. **Default:** Two
# minutes before the time of the request.
# @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
# `pageSize` value. To get the next page of results, call the operation with this token and include the same
# arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
# is null. Note that this operation can return empty pages.
# @param rate_limit [Float] Requests per second
# @return [Hash] The API response
def list_financial_events(max_results_per_page: 100, posted_after: nil, posted_before: nil, next_token: nil,
Expand Down
Loading

0 comments on commit 56a5421

Please sign in to comment.