class MuxRuby::DirectUploadsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

cancel_direct_upload(upload_id, opts = {}) click to toggle source

Cancel a direct upload Cancels a direct upload and marks it as cancelled. If a pending upload finishes after this request, no asset will be created. This request will only succeed if the upload is still in the `waiting` state. @param upload_id [String] ID of the Upload @param [Hash] opts the optional parameters @return [UploadResponse]

# File lib/mux_ruby/api/direct_uploads_api.rb, line 27
def cancel_direct_upload(upload_id, opts = {})
  data, _status_code, _headers = cancel_direct_upload_with_http_info(upload_id, opts)
  data
end
cancel_direct_upload_with_http_info(upload_id, opts = {}) click to toggle source

Cancel a direct upload Cancels a direct upload and marks it as cancelled. If a pending upload finishes after this request, no asset will be created. This request will only succeed if the upload is still in the &#x60;waiting&#x60; state. @param upload_id [String] ID of the Upload @param [Hash] opts the optional parameters @return [Array<(UploadResponse, Integer, Hash)>] UploadResponse data, response status code and response headers

# File lib/mux_ruby/api/direct_uploads_api.rb, line 37
def cancel_direct_upload_with_http_info(upload_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DirectUploadsApi.cancel_direct_upload ...'
  end
  # verify the required parameter 'upload_id' is set
  if @api_client.config.client_side_validation && upload_id.nil?
    fail ArgumentError, "Missing the required parameter 'upload_id' when calling DirectUploadsApi.cancel_direct_upload"
  end
  # resource path
  local_var_path = '/video/v1/uploads/{UPLOAD_ID}/cancel'.sub('{' + 'UPLOAD_ID' + '}', CGI.escape(upload_id.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] || 'UploadResponse'

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

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

Create a new direct upload URL @param create_upload_request [CreateUploadRequest] @param [Hash] opts the optional parameters @return [UploadResponse]

# File lib/mux_ruby/api/direct_uploads_api.rb, line 89
def create_direct_upload(create_upload_request, opts = {})
  data, _status_code, _headers = create_direct_upload_with_http_info(create_upload_request, opts)
  data
end
create_direct_upload_with_http_info(create_upload_request, opts = {}) click to toggle source

Create a new direct upload URL @param create_upload_request [CreateUploadRequest] @param [Hash] opts the optional parameters @return [Array<(UploadResponse, Integer, Hash)>] UploadResponse data, response status code and response headers

# File lib/mux_ruby/api/direct_uploads_api.rb, line 98
def create_direct_upload_with_http_info(create_upload_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DirectUploadsApi.create_direct_upload ...'
  end
  # verify the required parameter 'create_upload_request' is set
  if @api_client.config.client_side_validation && create_upload_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_upload_request' when calling DirectUploadsApi.create_direct_upload"
  end
  # resource path
  local_var_path = '/video/v1/uploads'

  # 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'])
  # 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(create_upload_request)

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

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

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

Retrieve a single direct upload's info @param upload_id [String] ID of the Upload @param [Hash] opts the optional parameters @return [UploadResponse]

# File lib/mux_ruby/api/direct_uploads_api.rb, line 152
def get_direct_upload(upload_id, opts = {})
  data, _status_code, _headers = get_direct_upload_with_http_info(upload_id, opts)
  data
end
get_direct_upload_with_http_info(upload_id, opts = {}) click to toggle source

Retrieve a single direct upload&#39;s info @param upload_id [String] ID of the Upload @param [Hash] opts the optional parameters @return [Array<(UploadResponse, Integer, Hash)>] UploadResponse data, response status code and response headers

# File lib/mux_ruby/api/direct_uploads_api.rb, line 161
def get_direct_upload_with_http_info(upload_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DirectUploadsApi.get_direct_upload ...'
  end
  # verify the required parameter 'upload_id' is set
  if @api_client.config.client_side_validation && upload_id.nil?
    fail ArgumentError, "Missing the required parameter 'upload_id' when calling DirectUploadsApi.get_direct_upload"
  end
  # resource path
  local_var_path = '/video/v1/uploads/{UPLOAD_ID}'.sub('{' + 'UPLOAD_ID' + '}', CGI.escape(upload_id.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] || 'UploadResponse'

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

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

List direct uploads @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of items to include in the response (default to 25) @option opts [Integer] :page Offset by this many pages, of the size of &#x60;limit&#x60; (default to 1) @return [ListUploadsResponse]

# File lib/mux_ruby/api/direct_uploads_api.rb, line 214
def list_direct_uploads(opts = {})
  data, _status_code, _headers = list_direct_uploads_with_http_info(opts)
  data
end
list_direct_uploads_with_http_info(opts = {}) click to toggle source

List direct uploads @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of items to include in the response @option opts [Integer] :page Offset by this many pages, of the size of &#x60;limit&#x60; @return [Array<(ListUploadsResponse, Integer, Hash)>] ListUploadsResponse data, response status code and response headers

# File lib/mux_ruby/api/direct_uploads_api.rb, line 224
def list_direct_uploads_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DirectUploadsApi.list_direct_uploads ...'
  end
  # resource path
  local_var_path = '/video/v1/uploads'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].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] || 'ListUploadsResponse'

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

  new_options = opts.merge(
    :operation => :"DirectUploadsApi.list_direct_uploads",
    :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: DirectUploadsApi#list_direct_uploads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end