finances-api-model

AmzSpApi::FinancesApiModel - the Ruby gem for the 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.

This SDK is automatically generated by the Swagger Codegen project:

Installation

Build a gem

To build the Ruby code into a gem:

gem build finances-api-model.gemspec

Then either install the gem locally:

gem install ./finances-api-model-0.1.0.gem

(for development, run gem install --dev ./finances-api-model-0.1.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'finances-api-model', '~> 0.1.0'

Install from Git

If the Ruby gem is hosted at a git repository: github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'finances-api-model', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'finances-api-model'

api_instance = AmzSpApi::FinancesApiModel::DefaultApi.new
opts = { 
  max_results_per_page: 100, # Integer | The maximum number of results to return per page.
  financial_event_group_started_before: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | 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: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | 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: 'next_token_example' # String | A string token returned in the response of your previous request.
}

begin
  result = api_instance.list_financial_event_groups(opts)
  p result
rescue AmzSpApi::FinancesApiModel::ApiError => e
  puts "Exception when calling DefaultApi->list_financial_event_groups: #{e}"
end

api_instance = AmzSpApi::FinancesApiModel::DefaultApi.new
opts = { 
  max_results_per_page: 100, # Integer | The maximum number of results to return per page.
  posted_after: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | 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: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | 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: 'next_token_example' # String | A string token returned in the response of your previous request.
}

begin
  result = api_instance.list_financial_events(opts)
  p result
rescue AmzSpApi::FinancesApiModel::ApiError => e
  puts "Exception when calling DefaultApi->list_financial_events: #{e}"
end

api_instance = AmzSpApi::FinancesApiModel::DefaultApi.new
event_group_id = 'event_group_id_example' # String | The identifier of the financial event group to which the events belong.
opts = { 
  max_results_per_page: 100, # Integer | The maximum number of results to return per page.
  next_token: 'next_token_example' # String | A string token returned in the response of your previous request.
}

begin
  result = api_instance.list_financial_events_by_group_id(event_group_id, opts)
  p result
rescue AmzSpApi::FinancesApiModel::ApiError => e
  puts "Exception when calling DefaultApi->list_financial_events_by_group_id: #{e}"
end

api_instance = AmzSpApi::FinancesApiModel::DefaultApi.new
order_id = 'order_id_example' # String | An Amazon-defined order identifier, in 3-7-7 format.
opts = { 
  max_results_per_page: 100, # Integer | The maximum number of results to return per page.
  next_token: 'next_token_example' # String | A string token returned in the response of your previous request.
}

begin
  result = api_instance.list_financial_events_by_order_id(order_id, opts)
  p result
rescue AmzSpApi::FinancesApiModel::ApiError => e
  puts "Exception when calling DefaultApi->list_financial_events_by_order_id: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://sellingpartnerapi-na.amazon.com/

Class | Method | HTTP request | Description ———— | ————- | ————- | ————- AmzSpApi::FinancesApiModel::DefaultApi | {list_financial_event_groups} | GET /finances/v0/financialEventGroups | AmzSpApi::FinancesApiModel::DefaultApi | {list_financial_events} | GET /finances/v0/financialEvents | AmzSpApi::FinancesApiModel::DefaultApi | {list_financial_events_by_group_id} | GET /finances/v0/financialEventGroups/{eventGroupId}/financialEvents | AmzSpApi::FinancesApiModel::DefaultApi | {list_financial_events_by_order_id} | GET /finances/v0/orders/{orderId}/financialEvents |

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.