module AmzSpApi
#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
#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
Constants
- VERSION
Public Class Methods
Customize default settings for the SDK using block.
AmzSpApi.configure do |config| end
If no block given, return the default Configuration
object.
# File lib/amz_sp_api.rb, line 12 def configure if block_given? yield(SpConfiguration.default) else SpConfiguration.default end end
# File lib/amz_sp_api.rb, line 25 def decrypt_and_inflate_document(ciphertext, document_response_payload) body = if cipher = document_cipher(document_response_payload, encrypt: false) cipher.update(ciphertext) + cipher.final else ciphertext end inflate_document(body, document_response_payload) end
# File lib/amz_sp_api.rb, line 43 def document_cipher(response, encrypt:) if 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 AmzSpApi::ApiError.new("unknown encryption standard #{response.inspect}") end encrypt ? cipher.encrypt : cipher.decrypt cipher.key = key cipher.iv = Base64.decode64(response.dig(:encryptionDetails, :initializationVector)) cipher end end
# File lib/amz_sp_api.rb, line 20 def encrypt_feed(feed_content, document_response_payload) cipher = document_cipher(document_response_payload, encrypt: true) cipher.update(feed_content) + cipher.final end
# File lib/amz_sp_api.rb, line 36 def inflate_document(body, document_response_payload) compression = document_response_payload[:compressionAlgorithm] raise AmzSpApi::ApiError.new("unknown compressionAlgorithm #{compression}") if compression && compression != "GZIP" compression ? Zlib::Inflate.inflate(body) : body end