class PhoneComClient::MediaApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_account_media_files(account_id, opts = {}) click to toggle source

Add a media object to your account that can be used as a greeting or hold music. Users may create a media by using the built-in Text-to-speech (TTS) facility or upload a file of their choice. (Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB) See Account Media for more info on the properties. @param account_id Account ID @param [Hash] opts the optional parameters @option opts [String] :json Media extra parameters @option opts [File] :file Media file @return [MediaFull]

# File lib/phone_com_client/api/media_api.rb, line 29
def create_account_media_files(account_id, opts = {})
  data, _status_code, _headers = create_account_media_files_with_http_info(account_id, opts)
  data
end
create_account_media_files_with_http_info(account_id, opts = {}) click to toggle source

Add a media object to your account that can be used as a greeting or hold music. Users may create a media by using the built-in Text-to-speech (TTS) facility or upload a file of their choice. (Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB) See Account Media for more info on the properties. @param account_id Account ID @param [Hash] opts the optional parameters @option opts [String] :json Media extra parameters @option opts [File] :file Media file @return [Array<(MediaFull, Fixnum, Hash)>] MediaFull data, response status code and response headers

# File lib/phone_com_client/api/media_api.rb, line 41
def create_account_media_files_with_http_info(account_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.create_account_media_files ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.create_account_media_files"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/files'.sub('{' + 'account_id' + '}', account_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['json'] = opts[:'json'] if !opts[:'json'].nil?
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['apiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#create_account_media_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_account_media_tts(account_id, opts = {}) click to toggle source

Add a media object to your account that can be used as a greeting or hold music. Users may create a media by using the built-in Text-to-speech (TTS) facility or upload a file of their choice. (Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB) See Account Media for more info on the properties. @param account_id Account ID @param [Hash] opts the optional parameters @option opts [CreateMediaParams] :data Media data @return [MediaFull]

# File lib/phone_com_client/api/media_api.rb, line 88
def create_account_media_tts(account_id, opts = {})
  data, _status_code, _headers = create_account_media_tts_with_http_info(account_id, opts)
  data
end
create_account_media_tts_with_http_info(account_id, opts = {}) click to toggle source

Add a media object to your account that can be used as a greeting or hold music. Users may create a media by using the built-in Text-to-speech (TTS) facility or upload a file of their choice. (Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB) See Account Media for more info on the properties. @param account_id Account ID @param [Hash] opts the optional parameters @option opts [CreateMediaParams] :data Media data @return [Array<(MediaFull, Fixnum, Hash)>] MediaFull data, response status code and response headers

# File lib/phone_com_client/api/media_api.rb, line 99
def create_account_media_tts_with_http_info(account_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.create_account_media_tts ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.create_account_media_tts"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/tts'.sub('{' + 'account_id' + '}', account_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'data'])
  auth_names = ['apiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#create_account_media_tts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_account_media(account_id, media_id, opts = {}) click to toggle source

Delete an individual media record See Account Media for more info on the properties. @param account_id Account ID @param media_id Media ID @param [Hash] opts the optional parameters @return [DeleteEntry]

# File lib/phone_com_client/api/media_api.rb, line 144
def delete_account_media(account_id, media_id, opts = {})
  data, _status_code, _headers = delete_account_media_with_http_info(account_id, media_id, opts)
  data
end
delete_account_media_with_http_info(account_id, media_id, opts = {}) click to toggle source

Delete an individual media record See Account Media for more info on the properties. @param account_id Account ID @param media_id Media ID @param [Hash] opts the optional parameters @return [Array<(DeleteEntry, Fixnum, Hash)>] DeleteEntry data, response status code and response headers

# File lib/phone_com_client/api/media_api.rb, line 155
def delete_account_media_with_http_info(account_id, media_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.delete_account_media ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.delete_account_media"
  end
  # verify the required parameter 'media_id' is set
  if @api_client.config.client_side_validation && media_id.nil?
    fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.delete_account_media"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/{media_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'media_id' + '}', media_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['apiKey']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DeleteEntry')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#delete_account_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_account_media(account_id, media_id, opts = {}) click to toggle source

Show details of an individual media recording (Greeting or Hold Music) Get individual media recording @param account_id Account ID @param media_id Media ID @param [Hash] opts the optional parameters @return [MediaFull]

# File lib/phone_com_client/api/media_api.rb, line 204
def get_account_media(account_id, media_id, opts = {})
  data, _status_code, _headers = get_account_media_with_http_info(account_id, media_id, opts)
  data
end
get_account_media_with_http_info(account_id, media_id, opts = {}) click to toggle source

Show details of an individual media recording (Greeting or Hold Music) Get individual media recording @param account_id Account ID @param media_id Media ID @param [Hash] opts the optional parameters @return [Array<(MediaFull, Fixnum, Hash)>] MediaFull data, response status code and response headers

# File lib/phone_com_client/api/media_api.rb, line 215
def get_account_media_with_http_info(account_id, media_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.get_account_media ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.get_account_media"
  end
  # verify the required parameter 'media_id' is set
  if @api_client.config.client_side_validation && media_id.nil?
    fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.get_account_media"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/{media_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'media_id' + '}', media_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['apiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#get_account_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_account_media(account_id, opts = {}) click to toggle source

Get a list of media recordings for an account. Get a list of media recordings for an account. See Account Media for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level List Media API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/media @param account_id Account ID @param [Hash] opts the optional parameters @option opts [Array<String>] :filters_id ID filter @option opts [Array<String>] :filters_name Name filter @option opts [String] :sort_id ID sorting @option opts [String] :sort_name Name sorting @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @return [ListMedia]

# File lib/phone_com_client/api/media_api.rb, line 270
def list_account_media(account_id, opts = {})
  data, _status_code, _headers = list_account_media_with_http_info(account_id, opts)
  data
end
list_account_media_with_http_info(account_id, opts = {}) click to toggle source

Get a list of media recordings for an account. Get a list of media recordings for an account. See Account Media for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level List Media API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/media @param account_id Account ID @param [Hash] opts the optional parameters @option opts [Array<String>] :filters_id ID filter @option opts [Array<String>] :filters_name Name filter @option opts [String] :sort_id ID sorting @option opts [String] :sort_name Name sorting @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @return [Array<(ListMedia, Fixnum, Hash)>] ListMedia data, response status code and response headers

# File lib/phone_com_client/api/media_api.rb, line 287
def list_account_media_with_http_info(account_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.list_account_media ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.list_account_media"
  end
  if @api_client.config.client_side_validation && !opts[:'sort_id'].nil? && opts[:'sort_id'] !~ Regexp.new(/asc|desc/)
    fail ArgumentError, "invalid value for 'opts[:\"sort_id\"]' when calling MediaApi.list_account_media, must conform to the pattern /asc|desc/."
  end

  if @api_client.config.client_side_validation && !opts[:'sort_name'].nil? && opts[:'sort_name'] !~ Regexp.new(/asc|desc/)
    fail ArgumentError, "invalid value for 'opts[:\"sort_name\"]' when calling MediaApi.list_account_media, must conform to the pattern /asc|desc/."
  end

  # resource path
  local_var_path = '/accounts/{account_id}/media'.sub('{' + 'account_id' + '}', account_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'filters[id]'] = @api_client.build_collection_param(opts[:'filters_id'], :multi) if !opts[:'filters_id'].nil?
  query_params[:'filters[name]'] = @api_client.build_collection_param(opts[:'filters_name'], :multi) if !opts[:'filters_name'].nil?
  query_params[:'sort[id]'] = opts[:'sort_id'] if !opts[:'sort_id'].nil?
  query_params[:'sort[name]'] = opts[:'sort_name'] if !opts[:'sort_name'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['apiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ListMedia')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#list_account_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
replace_account_media_files(account_id, media_id, opts = {}) click to toggle source

Update a media object to your account. Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB. See Account Media for more info on the properties. @param account_id Account ID @param media_id Media ID @param [Hash] opts the optional parameters @option opts [String] :json Media extra parameters @option opts [File] :file Media file @return [MediaFull]

# File lib/phone_com_client/api/media_api.rb, line 349
def replace_account_media_files(account_id, media_id, opts = {})
  data, _status_code, _headers = replace_account_media_files_with_http_info(account_id, media_id, opts)
  data
end
replace_account_media_files_with_http_info(account_id, media_id, opts = {}) click to toggle source

Update a media object to your account. Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB. See Account Media for more info on the properties. @param account_id Account ID @param media_id Media ID @param [Hash] opts the optional parameters @option opts [String] :json Media extra parameters @option opts [File] :file Media file @return [Array<(MediaFull, Fixnum, Hash)>] MediaFull data, response status code and response headers

# File lib/phone_com_client/api/media_api.rb, line 362
def replace_account_media_files_with_http_info(account_id, media_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.replace_account_media_files ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.replace_account_media_files"
  end
  # verify the required parameter 'media_id' is set
  if @api_client.config.client_side_validation && media_id.nil?
    fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.replace_account_media_files"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/files/{media_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'media_id' + '}', media_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['json'] = opts[:'json'] if !opts[:'json'].nil?
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['apiKey']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#replace_account_media_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
replace_account_media_tts(account_id, media_id, opts = {}) click to toggle source

Update a media object to your account. Update a media object to your account. Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB. See Account Media for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Replace Media API with the following definition: PUT api.phone.com/v4/accounts/:account_id/extensions/:extension_id/media/:media_id @param account_id Account ID @param media_id Media ID @param [Hash] opts the optional parameters @option opts [CreateMediaParams] :data Media data @return [MediaFull]

# File lib/phone_com_client/api/media_api.rb, line 414
def replace_account_media_tts(account_id, media_id, opts = {})
  data, _status_code, _headers = replace_account_media_tts_with_http_info(account_id, media_id, opts)
  data
end
replace_account_media_tts_with_http_info(account_id, media_id, opts = {}) click to toggle source

Update a media object to your account. Update a media object to your account. Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB. See Account Media for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Replace Media API with the following definition: PUT api.phone.com/v4/accounts/:account_id/extensions/:extension_id/media/:media_id @param account_id Account ID @param media_id Media ID @param [Hash] opts the optional parameters @option opts [CreateMediaParams] :data Media data @return [Array<(MediaFull, Fixnum, Hash)>] MediaFull data, response status code and response headers

# File lib/phone_com_client/api/media_api.rb, line 426
def replace_account_media_tts_with_http_info(account_id, media_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.replace_account_media_tts ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.replace_account_media_tts"
  end
  # verify the required parameter 'media_id' is set
  if @api_client.config.client_side_validation && media_id.nil?
    fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.replace_account_media_tts"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/tts/{media_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'media_id' + '}', media_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'data'])
  auth_names = ['apiKey']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#replace_account_media_tts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end