class PhoneComClient::SmsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

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

Send a SMS to one or a group of recipients. Send a SMS to one or a group of recipients. For details on the input fields, see Intro to SMS. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Create SMS API with the following definition: POST api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms @param account_id Account ID @param data SMS data @param [Hash] opts the optional parameters @return [SmsFull]

# File lib/phone_com_client/api/sms_api.rb, line 28
def create_account_sms(account_id, data, opts = {})
  data, _status_code, _headers = create_account_sms_with_http_info(account_id, data, opts)
  data
end
create_account_sms_with_http_info(account_id, data, opts = {}) click to toggle source

Send a SMS to one or a group of recipients. Send a SMS to one or a group of recipients. For details on the input fields, see Intro to SMS. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Create SMS API with the following definition: POST api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms @param account_id Account ID @param data SMS data @param [Hash] opts the optional parameters @return [Array<(SmsFull, Fixnum, Hash)>] SmsFull data, response status code and response headers

# File lib/phone_com_client/api/sms_api.rb, line 39
def create_account_sms_with_http_info(account_id, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SmsApi.create_account_sms ...'
  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 SmsApi.create_account_sms"
  end
  # verify the required parameter 'data' is set
  if @api_client.config.client_side_validation && data.nil?
    fail ArgumentError, "Missing the required parameter 'data' when calling SmsApi.create_account_sms"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/sms'.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(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 => 'SmsFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SmsApi#create_account_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_account_sms(account_id, sms_id, opts = {}) click to toggle source

This service shows the details of an individual SMS. This service shows the details of an individual SMS. See Intro to SMS 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 Get SMS API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms/:sms_id @param account_id Account ID @param sms_id SMS ID @param [Hash] opts the optional parameters @return [SmsFull]

# File lib/phone_com_client/api/sms_api.rb, line 88
def get_account_sms(account_id, sms_id, opts = {})
  data, _status_code, _headers = get_account_sms_with_http_info(account_id, sms_id, opts)
  data
end
get_account_sms_with_http_info(account_id, sms_id, opts = {}) click to toggle source

This service shows the details of an individual SMS. This service shows the details of an individual SMS. See Intro to SMS 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 Get SMS API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms/:sms_id @param account_id Account ID @param sms_id SMS ID @param [Hash] opts the optional parameters @return [Array<(SmsFull, Fixnum, Hash)>] SmsFull data, response status code and response headers

# File lib/phone_com_client/api/sms_api.rb, line 99
def get_account_sms_with_http_info(account_id, sms_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SmsApi.get_account_sms ...'
  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 SmsApi.get_account_sms"
  end
  # verify the required parameter 'sms_id' is set
  if @api_client.config.client_side_validation && sms_id.nil?
    fail ArgumentError, "Missing the required parameter 'sms_id' when calling SmsApi.get_account_sms"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/sms/{sms_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'sms_id' + '}', sms_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 => 'SmsFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SmsApi#get_account_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_account_sms(account_id, opts = {}) click to toggle source

Get a list of SMS messages for an account. Get a list of SMS messages for an account. See Intro to SMS 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 SMS API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms @param account_id Account ID @param [Hash] opts the optional parameters @option opts [Array<String>] :filters_id ID filter @option opts [String] :filters_from Caller ID filter @option opts [String] :filters_to Callee ID filter, the E.164 phone number to send the SMS TO. Note you must encode the + as %2B @option opts [String] :filters_direction Direction filter @option opts [Array<String>] :filters_extension Extension filter @option opts [String] :filters_created_at Date string representing the UTC time that sms was created @option opts [String] :sort_id ID sorting @option opts [String] :sort_created_at Sort by created time of message @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @return [ListSms]

# File lib/phone_com_client/api/sms_api.rb, line 158
def list_account_sms(account_id, opts = {})
  data, _status_code, _headers = list_account_sms_with_http_info(account_id, opts)
  data
end
list_account_sms_with_http_info(account_id, opts = {}) click to toggle source

Get a list of SMS messages for an account. Get a list of SMS messages for an account. See Intro to SMS 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 SMS API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms @param account_id Account ID @param [Hash] opts the optional parameters @option opts [Array<String>] :filters_id ID filter @option opts [String] :filters_from Caller ID filter @option opts [String] :filters_to Callee ID filter, the E.164 phone number to send the SMS TO. Note you must encode the + as %2B @option opts [String] :filters_direction Direction filter @option opts [Array<String>] :filters_extension Extension filter @option opts [String] :filters_created_at Date string representing the UTC time that sms was created @option opts [String] :sort_id ID sorting @option opts [String] :sort_created_at Sort by created time of message @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @return [Array<(ListSms, Fixnum, Hash)>] ListSms data, response status code and response headers

# File lib/phone_com_client/api/sms_api.rb, line 179
def list_account_sms_with_http_info(account_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SmsApi.list_account_sms ...'
  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 SmsApi.list_account_sms"
  end
  if @api_client.config.client_side_validation && !opts[:'filters_from'].nil? && opts[:'filters_from'] !~ Regexp.new(/^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/)
    fail ArgumentError, "invalid value for 'opts[:\"filters_from\"]' when calling SmsApi.list_account_sms, must conform to the pattern /^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/."
  end

  if @api_client.config.client_side_validation && !opts[:'filters_to'].nil? && opts[:'filters_to'] !~ Regexp.new(/^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/)
    fail ArgumentError, "invalid value for 'opts[:\"filters_to\"]' when calling SmsApi.list_account_sms, must conform to the pattern /^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/."
  end

  if @api_client.config.client_side_validation && !opts[:'filters_direction'].nil? && opts[:'filters_direction'] !~ Regexp.new(/^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/)
    fail ArgumentError, "invalid value for 'opts[:\"filters_direction\"]' when calling SmsApi.list_account_sms, must conform to the pattern /^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/."
  end

  if @api_client.config.client_side_validation && !opts[:'filters_created_at'].nil? && opts[:'filters_created_at'] !~ Regexp.new(/^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/)
    fail ArgumentError, "invalid value for 'opts[:\"filters_created_at\"]' when calling SmsApi.list_account_sms, must conform to the pattern /^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/."
  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 SmsApi.list_account_sms, must conform to the pattern /asc|desc/."
  end

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

  # resource path
  local_var_path = '/accounts/{account_id}/sms'.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[from]'] = opts[:'filters_from'] if !opts[:'filters_from'].nil?
  query_params[:'filters[to]'] = opts[:'filters_to'] if !opts[:'filters_to'].nil?
  query_params[:'filters[direction]'] = opts[:'filters_direction'] if !opts[:'filters_direction'].nil?
  query_params[:'filters[extension]'] = @api_client.build_collection_param(opts[:'filters_extension'], :multi) if !opts[:'filters_extension'].nil?
  query_params[:'filters[created_at]'] = opts[:'filters_created_at'] if !opts[:'filters_created_at'].nil?
  query_params[:'sort[id]'] = opts[:'sort_id'] if !opts[:'sort_id'].nil?
  query_params[:'sort[created_at]'] = opts[:'sort_created_at'] if !opts[:'sort_created_at'].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 => 'ListSms')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SmsApi#list_account_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
patch_account_sms(account_id, sms_id, opts = {}) click to toggle source

Update the is_new parameter in a sms record. Update the is_new parameter in a sms record. See Account SMS 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 Patch SMS API with the following definition: PATCH api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms/:sms_id @param account_id Account ID @param sms_id SMS ID @param [Hash] opts the optional parameters @option opts [PatchSmsParams] :data Sms data @return [SmsFull]

# File lib/phone_com_client/api/sms_api.rb, line 260
def patch_account_sms(account_id, sms_id, opts = {})
  data, _status_code, _headers = patch_account_sms_with_http_info(account_id, sms_id, opts)
  data
end
patch_account_sms_with_http_info(account_id, sms_id, opts = {}) click to toggle source

Update the is_new parameter in a sms record. Update the is_new parameter in a sms record. See Account SMS 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 Patch SMS API with the following definition: PATCH api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms/:sms_id @param account_id Account ID @param sms_id SMS ID @param [Hash] opts the optional parameters @option opts [PatchSmsParams] :data Sms data @return [Array<(SmsFull, Fixnum, Hash)>] SmsFull data, response status code and response headers

# File lib/phone_com_client/api/sms_api.rb, line 272
def patch_account_sms_with_http_info(account_id, sms_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SmsApi.patch_account_sms ...'
  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 SmsApi.patch_account_sms"
  end
  # verify the required parameter 'sms_id' is set
  if @api_client.config.client_side_validation && sms_id.nil?
    fail ArgumentError, "Missing the required parameter 'sms_id' when calling SmsApi.patch_account_sms"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/sms/{sms_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'sms_id' + '}', sms_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(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SmsFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SmsApi#patch_account_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end