class PhoneComClient::NumberRegionsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

list_available_phone_number_regions(opts = {}) click to toggle source

This service lists the quantities of available phone numbers by region. @param [Hash] opts the optional parameters @option opts [Array<String>] :filters_country_code Country Code filter @option opts [Array<String>] :filters_npa Area Code filter (North America only) @option opts [Array<String>] :filters_nxx 2nd set of 3 digits filter (North America only) @option opts [Array<String>] :filters_is_toll_free Toll-free status filter @option opts [Array<String>] :filters_city City filter @option opts [Array<String>] :filters_province_postal_code State or Province filter @option opts [Array<String>] :filters_country_postal_code Country filter @option opts [String] :sort_country_code International calling code sorting @option opts [String] :sort_npa Area Code sorting (North America only) @option opts [String] :sort_nxx 2nd set of 3 digits sorting (North America) @option opts [String] :sort_is_toll_free Toll Free status sorting @option opts [String] :sort_city City sorting @option opts [String] :sort_province_postal_code State or Province sorting @option opts [String] :sort_country_postal_code Country sorting @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @option opts [Array<String>] :group_by Fields to group by (supports the same set of fields as the filters and sorting) @return [ListPhoneNumbersRegions]

# File lib/phone_com_client/api/number_regions_api.rb, line 44
def list_available_phone_number_regions(opts = {})
  data, _status_code, _headers = list_available_phone_number_regions_with_http_info(opts)
  data
end
list_available_phone_number_regions_with_http_info(opts = {}) click to toggle source

This service lists the quantities of available phone numbers by region. @param [Hash] opts the optional parameters @option opts [Array<String>] :filters_country_code Country Code filter @option opts [Array<String>] :filters_npa Area Code filter (North America only) @option opts [Array<String>] :filters_nxx 2nd set of 3 digits filter (North America only) @option opts [Array<String>] :filters_is_toll_free Toll-free status filter @option opts [Array<String>] :filters_city City filter @option opts [Array<String>] :filters_province_postal_code State or Province filter @option opts [Array<String>] :filters_country_postal_code Country filter @option opts [String] :sort_country_code International calling code sorting @option opts [String] :sort_npa Area Code sorting (North America only) @option opts [String] :sort_nxx 2nd set of 3 digits sorting (North America) @option opts [String] :sort_is_toll_free Toll Free status sorting @option opts [String] :sort_city City sorting @option opts [String] :sort_province_postal_code State or Province sorting @option opts [String] :sort_country_postal_code Country sorting @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @option opts [Array<String>] :group_by Fields to group by (supports the same set of fields as the filters and sorting) @return [Array<(ListPhoneNumbersRegions, Fixnum, Hash)>] ListPhoneNumbersRegions data, response status code and response headers

# File lib/phone_com_client/api/number_regions_api.rb, line 71
def list_available_phone_number_regions_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NumberRegionsApi.list_available_phone_number_regions ...'
  end
  if @api_client.config.client_side_validation && !opts[:'sort_npa'].nil? && opts[:'sort_npa'] !~ Regexp.new(/asc|desc/)
    fail ArgumentError, "invalid value for 'opts[:\"sort_npa\"]' when calling NumberRegionsApi.list_available_phone_number_regions, must conform to the pattern /asc|desc/."
  end

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

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

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

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

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

  # resource path
  local_var_path = '/phone-numbers/available/regions'

  # query parameters
  query_params = {}
  query_params[:'filters[country_code]'] = @api_client.build_collection_param(opts[:'filters_country_code'], :multi) if !opts[:'filters_country_code'].nil?
  query_params[:'filters[npa]'] = @api_client.build_collection_param(opts[:'filters_npa'], :multi) if !opts[:'filters_npa'].nil?
  query_params[:'filters[nxx]'] = @api_client.build_collection_param(opts[:'filters_nxx'], :multi) if !opts[:'filters_nxx'].nil?
  query_params[:'filters[is_toll_free]'] = @api_client.build_collection_param(opts[:'filters_is_toll_free'], :multi) if !opts[:'filters_is_toll_free'].nil?
  query_params[:'filters[city]'] = @api_client.build_collection_param(opts[:'filters_city'], :multi) if !opts[:'filters_city'].nil?
  query_params[:'filters[province_postal_code]'] = @api_client.build_collection_param(opts[:'filters_province_postal_code'], :multi) if !opts[:'filters_province_postal_code'].nil?
  query_params[:'filters[country_postal_code]'] = @api_client.build_collection_param(opts[:'filters_country_postal_code'], :multi) if !opts[:'filters_country_postal_code'].nil?
  query_params[:'sort[country_code]'] = opts[:'sort_country_code'] if !opts[:'sort_country_code'].nil?
  query_params[:'sort[npa]'] = opts[:'sort_npa'] if !opts[:'sort_npa'].nil?
  query_params[:'sort[nxx]'] = opts[:'sort_nxx'] if !opts[:'sort_nxx'].nil?
  query_params[:'sort[is_toll_free]'] = opts[:'sort_is_toll_free'] if !opts[:'sort_is_toll_free'].nil?
  query_params[:'sort[city]'] = opts[:'sort_city'] if !opts[:'sort_city'].nil?
  query_params[:'sort[province_postal_code]'] = opts[:'sort_province_postal_code'] if !opts[:'sort_province_postal_code'].nil?
  query_params[:'sort[country_postal_code]'] = opts[:'sort_country_postal_code'] if !opts[:'sort_country_postal_code'].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?
  query_params[:'group_by'] = @api_client.build_collection_param(opts[:'group_by'], :multi) if !opts[:'group_by'].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 => 'ListPhoneNumbersRegions')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NumberRegionsApi#list_available_phone_number_regions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end