Class: PhoneComClient::AvailableNumbersApi
- Inherits:
-
Object
- Object
- PhoneComClient::AvailableNumbersApi
- Defined in:
- lib/phone_com_client/api/available_numbers_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ AvailableNumbersApi
constructor
A new instance of AvailableNumbersApi.
- #list_available_phone_numbers(opts = {}) ⇒ ListAvailableNumbers
-
#list_available_phone_numbers_with_http_info(opts = {}) ⇒ Array<(ListAvailableNumbers, Fixnum, Hash)>
ListAvailableNumbers data, response status code and response headers.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ AvailableNumbersApi
Returns a new instance of AvailableNumbersApi.
19 20 21 |
# File 'lib/phone_com_client/api/available_numbers_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/phone_com_client/api/available_numbers_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#list_available_phone_numbers(opts = {}) ⇒ ListAvailableNumbers
42 43 44 45 |
# 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 |
#list_available_phone_numbers_with_http_info(opts = {}) ⇒ Array<(ListAvailableNumbers, Fixnum, Hash)>
Returns ListAvailableNumbers data, response status code and response headers.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# 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 |