class PhoneComClient::AvailableNumbersApi
Attributes
Public Class Methods
# File lib/phone_com_client/api/available_numbers_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
@param [Hash] opts the optional parameters @option opts [Array<String>] :filters_phone_number Phone number filter @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_xxxx NANP XXXX filter @option opts [Array<String>] :filters_city City filter @option opts [Array<String>] :filters_province State or Province (postal code) filter @option opts [Array<String>] :filters_country Country (postal code) filter @option opts [Array<String>] :filters_price Price filter @option opts [Array<String>] :filters_category Category filter @option opts [String] :sort_internal Internal (quasi-random) sorting @option opts [String] :sort_price Price sorting @option opts [String] :sort_phone_number Phone number sorting @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @return [ListAvailableNumbers]
# File lib/phone_com_client/api/available_numbers_api.rb, line 42 def list_available_phone_numbers(opts = {}) data, _status_code, _headers = list_available_phone_numbers_with_http_info(opts) data end
@param [Hash] opts the optional parameters @option opts [Array<String>] :filters_phone_number Phone number filter @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_xxxx NANP XXXX filter @option opts [Array<String>] :filters_city City filter @option opts [Array<String>] :filters_province State or Province (postal code) filter @option opts [Array<String>] :filters_country Country (postal code) filter @option opts [Array<String>] :filters_price Price filter @option opts [Array<String>] :filters_category Category filter @option opts [String] :sort_internal Internal (quasi-random) sorting @option opts [String] :sort_price Price sorting @option opts [String] :sort_phone_number Phone number sorting @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @return [Array<(ListAvailableNumbers
, Fixnum, Hash)>] ListAvailableNumbers
data, response status code and response headers
# File lib/phone_com_client/api/available_numbers_api.rb, line 67 def list_available_phone_numbers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AvailableNumbersApi.list_available_phone_numbers ...' end if @api_client.config.client_side_validation && !opts[:'sort_internal'].nil? && opts[:'sort_internal'] !~ Regexp.new(/asc|desc/) fail ArgumentError, "invalid value for 'opts[:\"sort_internal\"]' when calling AvailableNumbersApi.list_available_phone_numbers, must conform to the pattern /asc|desc/." end if @api_client.config.client_side_validation && !opts[:'sort_price'].nil? && opts[:'sort_price'] !~ Regexp.new(/asc|desc/) fail ArgumentError, "invalid value for 'opts[:\"sort_price\"]' when calling AvailableNumbersApi.list_available_phone_numbers, must conform to the pattern /asc|desc/." end if @api_client.config.client_side_validation && !opts[:'sort_phone_number'].nil? && opts[:'sort_phone_number'] !~ Regexp.new(/asc|desc/) fail ArgumentError, "invalid value for 'opts[:\"sort_phone_number\"]' when calling AvailableNumbersApi.list_available_phone_numbers, must conform to the pattern /asc|desc/." end # resource path local_var_path = '/phone-numbers/available' # query parameters query_params = {} query_params[:'filters[phone_number]'] = @api_client.build_collection_param(opts[:'filters_phone_number'], :multi) if !opts[:'filters_phone_number'].nil? 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[xxxx]'] = @api_client.build_collection_param(opts[:'filters_xxxx'], :multi) if !opts[:'filters_xxxx'].nil? query_params[:'filters[city]'] = @api_client.build_collection_param(opts[:'filters_city'], :multi) if !opts[:'filters_city'].nil? query_params[:'filters[province]'] = @api_client.build_collection_param(opts[:'filters_province'], :multi) if !opts[:'filters_province'].nil? query_params[:'filters[country]'] = @api_client.build_collection_param(opts[:'filters_country'], :multi) if !opts[:'filters_country'].nil? query_params[:'filters[price]'] = @api_client.build_collection_param(opts[:'filters_price'], :multi) if !opts[:'filters_price'].nil? query_params[:'filters[category]'] = @api_client.build_collection_param(opts[:'filters_category'], :multi) if !opts[:'filters_category'].nil? query_params[:'sort[internal]'] = opts[:'sort_internal'] if !opts[:'sort_internal'].nil? query_params[:'sort[price]'] = opts[:'sort_price'] if !opts[:'sort_price'].nil? query_params[:'sort[phone_number]'] = opts[:'sort_phone_number'] if !opts[:'sort_phone_number'].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 => 'ListAvailableNumbers') if @api_client.config.debugging @api_client.config.logger.debug "API called: AvailableNumbersApi#list_available_phone_numbers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end