class ShipEngine::DownloadsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/ship_engine/api/downloads_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

download_file(subdir, filename, dir, opts = {}) click to toggle source

Download File Get File @param subdir [String] @param filename [String] @param dir [String] @param [Hash] opts the optional parameters @option opts [String] :download @return [File]

# File lib/ship_engine/api/downloads_api.rb, line 30
def download_file(subdir, filename, dir, opts = {})
  data, _status_code, _headers = download_file_with_http_info(subdir, filename, dir, opts)
  data
end
download_file_with_http_info(subdir, filename, dir, opts = {}) click to toggle source

Download File Get File @param subdir [String] @param filename [String] @param dir [String] @param [Hash] opts the optional parameters @option opts [String] :download @return [Array<(File, Integer, Hash)>] File data, response status code and response headers

# File lib/ship_engine/api/downloads_api.rb, line 43
def download_file_with_http_info(subdir, filename, dir, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DownloadsApi.download_file ...'
  end
  # verify the required parameter 'subdir' is set
  if @api_client.config.client_side_validation && subdir.nil?
    fail ArgumentError, "Missing the required parameter 'subdir' when calling DownloadsApi.download_file"
  end
  # verify the required parameter 'filename' is set
  if @api_client.config.client_side_validation && filename.nil?
    fail ArgumentError, "Missing the required parameter 'filename' when calling DownloadsApi.download_file"
  end
  # verify the required parameter 'dir' is set
  if @api_client.config.client_side_validation && dir.nil?
    fail ArgumentError, "Missing the required parameter 'dir' when calling DownloadsApi.download_file"
  end
  # resource path
  local_var_path = '/v1/downloads/{dir}/{subdir}/{filename}'.sub('{' + 'subdir' + '}', CGI.escape(subdir.to_s)).sub('{' + 'filename' + '}', CGI.escape(filename.to_s)).sub('{' + 'dir' + '}', CGI.escape(dir.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'download'] = opts[:'download'] if !opts[:'download'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'image/png', 'application/zpl', 'application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'File' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DownloadsApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end