class ElasticEmail::FilesApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

files_by_name_delete(name, opts = {}) click to toggle source

Delete File Permanently deletes the file from your Account. Required Access Level: ModifyFiles @param name [String] Name of your file including extension. @param [Hash] opts the optional parameters @return [nil]

# File lib/ElasticEmail/api/files_api.rb, line 27
def files_by_name_delete(name, opts = {})
  files_by_name_delete_with_http_info(name, opts)
  nil
end
files_by_name_delete_with_http_info(name, opts = {}) click to toggle source

Delete File Permanently deletes the file from your Account. Required Access Level: ModifyFiles @param name [String] Name of your file including extension. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/ElasticEmail/api/files_api.rb, line 37
def files_by_name_delete_with_http_info(name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_by_name_delete ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling FilesApi.files_by_name_delete"
  end
  # resource path
  local_var_path = '/files/{name}'.sub('{' + 'name' + '}', CGI.escape(name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"FilesApi.files_by_name_delete",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#files_by_name_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
files_by_name_get(name, opts = {}) click to toggle source

Download File Gets content of the specified File. Required Access Level: ViewFiles @param name [String] Name of your file including extension. @param [Hash] opts the optional parameters @return [File]

# File lib/ElasticEmail/api/files_api.rb, line 88
def files_by_name_get(name, opts = {})
  data, _status_code, _headers = files_by_name_get_with_http_info(name, opts)
  data
end
files_by_name_get_with_http_info(name, opts = {}) click to toggle source

Download File Gets content of the specified File. Required Access Level: ViewFiles @param name [String] Name of your file including extension. @param [Hash] opts the optional parameters @return [Array<(File, Integer, Hash)>] File data, response status code and response headers

# File lib/ElasticEmail/api/files_api.rb, line 98
def files_by_name_get_with_http_info(name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_by_name_get ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling FilesApi.files_by_name_get"
  end
  # resource path
  local_var_path = '/files/{name}'.sub('{' + 'name' + '}', CGI.escape(name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/*'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"FilesApi.files_by_name_get",
    :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: FilesApi#files_by_name_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
files_by_name_info_get(name, opts = {}) click to toggle source

Load File Details Returns the specified File's details. Required Access Level: ViewFiles @param name [String] Name of your file including extension. @param [Hash] opts the optional parameters @return [FileInfo]

# File lib/ElasticEmail/api/files_api.rb, line 151
def files_by_name_info_get(name, opts = {})
  data, _status_code, _headers = files_by_name_info_get_with_http_info(name, opts)
  data
end
files_by_name_info_get_with_http_info(name, opts = {}) click to toggle source

Load File Details Returns the specified File&#39;s details. Required Access Level: ViewFiles @param name [String] Name of your file including extension. @param [Hash] opts the optional parameters @return [Array<(FileInfo, Integer, Hash)>] FileInfo data, response status code and response headers

# File lib/ElasticEmail/api/files_api.rb, line 161
def files_by_name_info_get_with_http_info(name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_by_name_info_get ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling FilesApi.files_by_name_info_get"
  end
  # resource path
  local_var_path = '/files/{name}/info'.sub('{' + 'name' + '}', CGI.escape(name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'FileInfo'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"FilesApi.files_by_name_info_get",
    :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: FilesApi#files_by_name_info_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
files_get(opts = {}) click to toggle source

List Files Returns a list of all your available files. Required Access Level: ViewFiles @param [Hash] opts the optional parameters @option opts [Integer] :limit Maximum number of returned items. @option opts [Integer] :offset How many items should be returned ahead. @return [Array<FileInfo>]

# File lib/ElasticEmail/api/files_api.rb, line 215
def files_get(opts = {})
  data, _status_code, _headers = files_get_with_http_info(opts)
  data
end
files_get_with_http_info(opts = {}) click to toggle source

List Files Returns a list of all your available files. Required Access Level: ViewFiles @param [Hash] opts the optional parameters @option opts [Integer] :limit Maximum number of returned items. @option opts [Integer] :offset How many items should be returned ahead. @return [Array<(Array<FileInfo>, Integer, Hash)>] Array<FileInfo> data, response status code and response headers

# File lib/ElasticEmail/api/files_api.rb, line 226
def files_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_get ...'
  end
  # resource path
  local_var_path = '/files'

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Array<FileInfo>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"FilesApi.files_get",
    :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: FilesApi#files_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
files_post(file_payload, opts = {}) click to toggle source

Upload File Uploads selected file to the server. Required Access Level: ModifyFiles @param file_payload [FilePayload] @param [Hash] opts the optional parameters @option opts [Integer] :expires_after_days After how many days should the file be deleted. @return [FileInfo]

# File lib/ElasticEmail/api/files_api.rb, line 278
def files_post(file_payload, opts = {})
  data, _status_code, _headers = files_post_with_http_info(file_payload, opts)
  data
end
files_post_with_http_info(file_payload, opts = {}) click to toggle source

Upload File Uploads selected file to the server. Required Access Level: ModifyFiles @param file_payload [FilePayload] @param [Hash] opts the optional parameters @option opts [Integer] :expires_after_days After how many days should the file be deleted. @return [Array<(FileInfo, Integer, Hash)>] FileInfo data, response status code and response headers

# File lib/ElasticEmail/api/files_api.rb, line 289
def files_post_with_http_info(file_payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_post ...'
  end
  # verify the required parameter 'file_payload' is set
  if @api_client.config.client_side_validation && file_payload.nil?
    fail ArgumentError, "Missing the required parameter 'file_payload' when calling FilesApi.files_post"
  end
  # resource path
  local_var_path = '/files'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(file_payload)

  # return_type
  return_type = opts[:debug_return_type] || 'FileInfo'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"FilesApi.files_post",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#files_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end