Class: PhoneComClient::NumberRegionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/phone_com_client/api/number_regions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ NumberRegionsApi

Returns a new instance of NumberRegionsApi.



19
20
21
# File 'lib/phone_com_client/api/number_regions_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/phone_com_client/api/number_regions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#list_available_phone_number_regions(opts = {}) ⇒ ListPhoneNumbersRegions

This service lists the quantities of available phone numbers by region.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :filters_country_code (Array<String>)

    Country Code filter

  • :filters_npa (Array<String>)

    Area Code filter (North America only)

  • :filters_nxx (Array<String>)

    2nd set of 3 digits filter (North America only)

  • :filters_is_toll_free (Array<String>)

    Toll-free status filter

  • :filters_city (Array<String>)

    City filter

  • :filters_province_postal_code (Array<String>)

    State or Province filter

  • :filters_country_postal_code (Array<String>)

    Country filter

  • :sort_country_code (String)

    International calling code sorting

  • :sort_npa (String)

    Area Code sorting (North America only)

  • :sort_nxx (String)

    2nd set of 3 digits sorting (North America)

  • :sort_is_toll_free (String)

    Toll Free status sorting

  • :sort_city (String)

    City sorting

  • :sort_province_postal_code (String)

    State or Province sorting

  • :sort_country_postal_code (String)

    Country sorting

  • :limit (Integer)

    Max results

  • :offset (Integer)

    Results to skip

  • :fields (String)

    Field set

  • :group_by (Array<String>)

    Fields to group by (supports the same set of fields as the filters and sorting)

Returns:



44
45
46
47
# 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 = {}) ⇒ Array<(ListPhoneNumbersRegions, Fixnum, Hash)>

This service lists the quantities of available phone numbers by region.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :filters_country_code (Array<String>)

    Country Code filter

  • :filters_npa (Array<String>)

    Area Code filter (North America only)

  • :filters_nxx (Array<String>)

    2nd set of 3 digits filter (North America only)

  • :filters_is_toll_free (Array<String>)

    Toll-free status filter

  • :filters_city (Array<String>)

    City filter

  • :filters_province_postal_code (Array<String>)

    State or Province filter

  • :filters_country_postal_code (Array<String>)

    Country filter

  • :sort_country_code (String)

    International calling code sorting

  • :sort_npa (String)

    Area Code sorting (North America only)

  • :sort_nxx (String)

    2nd set of 3 digits sorting (North America)

  • :sort_is_toll_free (String)

    Toll Free status sorting

  • :sort_city (String)

    City sorting

  • :sort_province_postal_code (String)

    State or Province sorting

  • :sort_country_postal_code (String)

    Country sorting

  • :limit (Integer)

    Max results

  • :offset (Integer)

    Results to skip

  • :fields (String)

    Field set

  • :group_by (Array<String>)

    Fields to group by (supports the same set of fields as the filters and sorting)

Returns:

  • (Array<(ListPhoneNumbersRegions, Fixnum, Hash)>)

    ListPhoneNumbersRegions data, response status code and response headers



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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 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