Module: AmzSpApi
- Defined in:
- lib/api_error.rb,
lib/amz_sp_api.rb,
lib/api_client.rb,
lib/configuration.rb,
lib/sp_api_client.rb,
lib/sp_configuration.rb,
lib/amz_sp_api_version.rb
Overview
#Selling Partner APIs for Fulfillment Outbound
#The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill Multi-Channel Fulfillment orders using their inventory in Amazon’s fulfillment network. You can get information on both potential and existing fulfillment orders.
OpenAPI spec version: 2020-07-01
Generated by: github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 3.0.24
Defined Under Namespace
Modules: AplusContentApiModel, AuthorizationApiModel, CatalogItemsApiModel, FbaInboundEligibilityApiModel, FbaInventoryApiModel, FbaSmallAndLightApiModel, FeedsApiModel, FinancesApiModel, FulfillmentInboundApiModel, FulfillmentOutboundApiModel, MerchantFulfillmentApiModel, MessagingApiModel, NotificationsApiModel, OrdersApiModel, ProductFeesApiModel, ProductPricingApiModel, ReportsApiModel, SalesApiModel, SellersApiModel, ServicesApiModel, ShippingApiModel, SolicitationsApiModel, UploadsApiModel Classes: ApiClient, ApiError, Configuration, SpApiClient, SpConfiguration
Constant Summary collapse
- VERSION =
'0.2.1'
Class Method Summary collapse
-
.configure ⇒ Object
Customize default settings for the SDK using block.
- .decrypt_and_inflate_feed(ciphertext, feed_document_response_payload) ⇒ Object
- .encrypt_feed(feed_content, feed_document_response_payload) ⇒ Object
- .feed_cipher(response, encrypt:) ⇒ Object
Class Method Details
.configure ⇒ Object
Customize default settings for the SDK using block.
AmzSpApi.configure do |config|
end
If no block given, return the default Configuration object.
11 12 13 14 15 16 17 |
# File 'lib/amz_sp_api.rb', line 11 def configure if block_given? yield(SpConfiguration.default) else SpConfiguration.default end end |
.decrypt_and_inflate_feed(ciphertext, feed_document_response_payload) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/amz_sp_api.rb', line 24 def decrypt_and_inflate_feed(ciphertext, feed_document_response_payload) cipher = feed_cipher(feed_document_response_payload, encrypt: false) compression = feed_document_response_payload[:compressionAlgorithm] raise "unknown compressionAlgorithm #{compression}" if compression && compression != "GZIP" result = cipher.update(ciphertext) + cipher.final result = Zlib::Inflate.inflate(result) if compression result end |
.encrypt_feed(feed_content, feed_document_response_payload) ⇒ Object
19 20 21 22 |
# File 'lib/amz_sp_api.rb', line 19 def encrypt_feed(feed_content, feed_document_response_payload) cipher = feed_cipher(feed_document_response_payload, encrypt: true) cipher.update(feed_content) + cipher.final end |
.feed_cipher(response, encrypt:) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/amz_sp_api.rb', line 36 def feed_cipher(response, encrypt:) key = Base64.decode64(response.dig(:encryptionDetails, :key)) cipher = case response.dig(:encryptionDetails, :standard) when "AES" OpenSSL::Cipher.new("AES-#{key.size * 8}-CBC") else raise "unknown encryption standard #{response.inspect}" end encrypt ? cipher.encrypt : cipher.decrypt cipher.key = key cipher.iv = Base64.decode64(response.dig(:encryptionDetails, :initializationVector)) cipher end |