Class: WalmartApIs::UploadsApi
- Defined in:
- lib/walmart_ap_is/apis/uploads_api.rb
Overview
UploadsApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#create_upload_destination_for_resource(resource, content_md5, content_type, marketplace_ids) ⇒ ApiResponse
Returns a pre-signed URL and upload destination ID for uploading a document for the given resource (e.g. feeds, reports).
Methods inherited from BaseApi
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from WalmartApIs::BaseApi
Instance Method Details
#create_upload_destination_for_resource(resource, content_md5, content_type, marketplace_ids) ⇒ ApiResponse
Returns a pre-signed URL and upload destination ID for uploading a document for the given resource (e.g. feeds, reports). Do not log the pre-signed URL — it contains temporary credentials. upload destination (e.g. feeds) be uploaded, encoded as base64 content to be uploaded type description here
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/walmart_ap_is/apis/uploads_api.rb', line 21 def create_upload_destination_for_resource(resource, content_md5, content_type, marketplace_ids) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/uploads/v4/uploadDestinations/{resource}', Server::DEFAULT1) .template_param(new_parameter(resource, key: 'resource') .is_required(true) .should_encode(true)) .header_param(new_parameter(content_md5, key: 'contentMD5') .is_required(true)) .query_param(new_parameter(content_type, key: 'contentType') .is_required(true)) .query_param(new_parameter(marketplace_ids, key: 'marketplaceIds') .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('walletAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(CreateUploadDestinationResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', ErrorListErrorException) .local_error('403', 'Forbidden', ErrorListErrorException) .local_error('429', 'Rate limit exceeded', ErrorListErrorException) .local_error('500', 'Internal Server Error', ErrorListErrorException)) .execute end |