Class: Peddler::APIs::Uploads20201101
- Inherits:
-
Peddler::API
- Object
- Peddler::API
- Peddler::APIs::Uploads20201101
- Defined in:
- lib/peddler/apis/uploads_2020_11_01.rb,
lib/peddler/apis/uploads_2020_11_01/error.rb,
lib/peddler/apis/uploads_2020_11_01/error_list.rb,
lib/peddler/apis/uploads_2020_11_01/upload_destination.rb,
lib/peddler/apis/uploads_2020_11_01/create_upload_destination_response.rb
Overview
Selling Partner API for Uploads
The Uploads API lets you upload files that you can programmatically access using other Selling Partner APIs, such as the A+ Content API and the Messaging API.
Defined Under Namespace
Classes: ErrorList
Constant Summary collapse
- Error =
Error response returned when the request is unsuccessful.
Structure.new do # @return [String] An error code that identifies the type of error that occurred. attribute(:code, String) # @return [String] A message that describes the error condition in a human-readable form. attribute(:message, String) # @return [String] Additional details that can help the caller understand or fix the issue. attribute?(:details, String) end
- UploadDestination =
Information about an upload destination.
Structure.new do # @return [Hash] The headers to include in the upload request. attribute?(:headers, Hash) # @return [String] The unique identifier for the upload destination. attribute?(:upload_destination_id, String, from: "uploadDestinationId") # @return [String] The URL for the upload destination. attribute?(:url, String) end
- CreateUploadDestinationResponse =
The response schema for the createUploadDestination operation.
Structure.new do # @return [Array<Error>] attribute?(:errors, [Error]) # @return [UploadDestination] attribute?(:payload, UploadDestination) end
Instance Attribute Summary
Attributes inherited from Peddler::API
#access_token, #endpoint, #retries
Instance Method Summary collapse
-
#create_upload_destination_for_resource(marketplace_ids, content_md5, resource, content_type: nil, rate_limit: 10.0) ⇒ Peddler::Response
Creates an upload destination, returning the information required to upload a file to the destination and to programmatically access the file.
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
#create_upload_destination_for_resource(marketplace_ids, content_md5, resource, content_type: nil, rate_limit: 10.0) ⇒ Peddler::Response
Creates an upload destination, returning the information required to upload a file to the destination and to programmatically access the file.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/peddler/apis/uploads_2020_11_01.rb', line 32 def create_upload_destination_for_resource(marketplace_ids, content_md5, resource, content_type: nil, rate_limit: 10.0) cannot_sandbox! path = "/uploads/2020-11-01/uploadDestinations/#{percent_encode(resource)}" params = { "marketplaceIds" => stringify_array(marketplace_ids), "contentMD5" => content_md5, "contentType" => content_type, }.compact parser = -> { CreateUploadDestinationResponse } meter(rate_limit).post(path, params:, parser:) end |