Class: WhoisFreaks::DNSApi

Inherits:
Object
  • Object
show all
Defined in:
lib/whoisfreaks/api/dns_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DNSApi

Returns a new instance of DNSApi.



19
20
21
# File 'lib/whoisfreaks/api/dns_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/whoisfreaks/api/dns_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#dns_bulk(api_key, type, dns_bulk_request, opts = {}) ⇒ DnsBulk200Response

Bulk DNS Lookup Up to 100 domains + 100 IPs in one request.

Parameters:

  • api_key (String)

    Your WHOISFreaks API key

  • type (String)
  • dns_bulk_request (DnsBulkRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :format (String) — default: default to 'json'

Returns:



30
31
32
33
# File 'lib/whoisfreaks/api/dns_api.rb', line 30

def dns_bulk(api_key, type, dns_bulk_request, opts = {})
  data, _status_code, _headers = dns_bulk_with_http_info(api_key, type, dns_bulk_request, opts)
  data
end

#dns_bulk_with_http_info(api_key, type, dns_bulk_request, opts = {}) ⇒ Array<(DnsBulk200Response, Integer, Hash)>

Bulk DNS Lookup Up to 100 domains + 100 IPs in one request.

Parameters:

  • api_key (String)

    Your WHOISFreaks API key

  • type (String)
  • dns_bulk_request (DnsBulkRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :format (String) — default: default to 'json'

Returns:

  • (Array<(DnsBulk200Response, Integer, Hash)>)

    DnsBulk200Response data, response status code and response headers



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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
# File 'lib/whoisfreaks/api/dns_api.rb', line 43

def dns_bulk_with_http_info(api_key, type, dns_bulk_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DNSApi.dns_bulk ...'
  end
  # verify the required parameter 'api_key' is set
  if @api_client.config.client_side_validation && api_key.nil?
    fail ArgumentError, "Missing the required parameter 'api_key' when calling DNSApi.dns_bulk"
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling DNSApi.dns_bulk"
  end
  # verify the required parameter 'dns_bulk_request' is set
  if @api_client.config.client_side_validation && dns_bulk_request.nil?
    fail ArgumentError, "Missing the required parameter 'dns_bulk_request' when calling DNSApi.dns_bulk"
  end
  allowable_values = ["json", "xml"]
  if @api_client.config.client_side_validation && opts[:'format'] && !allowable_values.include?(opts[:'format'])
    fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v2.0/dns/bulk/live'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'apiKey'] = api_key
  query_params[:'type'] = type
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(dns_bulk_request)

  # return_type
  return_type = opts[:debug_return_type] || 'DnsBulk200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"DNSApi.dns_bulk",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DNSApi#dns_bulk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#dns_historical(api_key, domain_name, type, opts = {}) ⇒ HistoricalDnsResponse

Historical DNS Lookup All historical DNS records. 2 credits per page (100 records/page).

Parameters:

  • api_key (String)

    Your WHOISFreaks API key

  • domain_name (String)
  • type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :format (String) — default: default to 'json'

Returns:



120
121
122
123
# File 'lib/whoisfreaks/api/dns_api.rb', line 120

def dns_historical(api_key, domain_name, type, opts = {})
  data, _status_code, _headers = dns_historical_with_http_info(api_key, domain_name, type, opts)
  data
end

#dns_historical_with_http_info(api_key, domain_name, type, opts = {}) ⇒ Array<(HistoricalDnsResponse, Integer, Hash)>

Historical DNS Lookup All historical DNS records. 2 credits per page (100 records/page).

Parameters:

  • api_key (String)

    Your WHOISFreaks API key

  • domain_name (String)
  • type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :format (String) — default: default to 'json'

Returns:

  • (Array<(HistoricalDnsResponse, Integer, Hash)>)

    HistoricalDnsResponse data, response status code and response headers



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/whoisfreaks/api/dns_api.rb', line 134

def dns_historical_with_http_info(api_key, domain_name, type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DNSApi.dns_historical ...'
  end
  # verify the required parameter 'api_key' is set
  if @api_client.config.client_side_validation && api_key.nil?
    fail ArgumentError, "Missing the required parameter 'api_key' when calling DNSApi.dns_historical"
  end
  # verify the required parameter 'domain_name' is set
  if @api_client.config.client_side_validation && domain_name.nil?
    fail ArgumentError, "Missing the required parameter 'domain_name' when calling DNSApi.dns_historical"
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling DNSApi.dns_historical"
  end
  allowable_values = ["json", "xml"]
  if @api_client.config.client_side_validation && opts[:'format'] && !allowable_values.include?(opts[:'format'])
    fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v2.0/dns/historical'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'apiKey'] = api_key
  query_params[:'domainName'] = domain_name
  query_params[:'type'] = type
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'HistoricalDnsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"DNSApi.dns_historical",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DNSApi#dns_historical\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#dns_live(api_key, type, opts = {}) ⇒ DnsResponse

Live DNS Lookup Real-time DNS record lookup. 1 credit per query.

Parameters:

  • api_key (String)

    Your WHOISFreaks API key

  • type (String)

    all or comma-separated: A,MX,NS,TXT,SOA,SPF,AAAA,CNAME

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

    the optional parameters

Options Hash (opts):

  • :domain_name (String)
  • :ip_address (String)

    Use for PTR lookups

  • :format (String) — default: default to 'json'

Returns:



208
209
210
211
# File 'lib/whoisfreaks/api/dns_api.rb', line 208

def dns_live(api_key, type, opts = {})
  data, _status_code, _headers = dns_live_with_http_info(api_key, type, opts)
  data
end

#dns_live_with_http_info(api_key, type, opts = {}) ⇒ Array<(DnsResponse, Integer, Hash)>

Live DNS Lookup Real-time DNS record lookup. 1 credit per query.

Parameters:

  • api_key (String)

    Your WHOISFreaks API key

  • type (String)

    all or comma-separated: A,MX,NS,TXT,SOA,SPF,AAAA,CNAME

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

    the optional parameters

Options Hash (opts):

  • :domain_name (String)
  • :ip_address (String)

    Use for PTR lookups

  • :format (String) — default: default to 'json'

Returns:

  • (Array<(DnsResponse, Integer, Hash)>)

    DnsResponse data, response status code and response headers



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/whoisfreaks/api/dns_api.rb', line 222

def dns_live_with_http_info(api_key, type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DNSApi.dns_live ...'
  end
  # verify the required parameter 'api_key' is set
  if @api_client.config.client_side_validation && api_key.nil?
    fail ArgumentError, "Missing the required parameter 'api_key' when calling DNSApi.dns_live"
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling DNSApi.dns_live"
  end
  allowable_values = ["json", "xml"]
  if @api_client.config.client_side_validation && opts[:'format'] && !allowable_values.include?(opts[:'format'])
    fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v2.0/dns/live'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'apiKey'] = api_key
  query_params[:'type'] = type
  query_params[:'domainName'] = opts[:'domain_name'] if !opts[:'domain_name'].nil?
  query_params[:'ipAddress'] = opts[:'ip_address'] if !opts[:'ip_address'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DnsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"DNSApi.dns_live",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DNSApi#dns_live\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#dns_reverse(api_key, value, type, opts = {}) ⇒ ReverseDnsResponse

Reverse DNS Lookup Search domains by IP or DNS value. 5 credits per page.

Parameters:

  • api_key (String)

    Your WHOISFreaks API key

  • value (String)

    IP, CIDR, or record value

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

    the optional parameters

Options Hash (opts):

  • :exact (Boolean) — default: default to true
  • :page (Integer) — default: default to 1
  • :format (String) — default: default to 'json'

Returns:



293
294
295
296
# File 'lib/whoisfreaks/api/dns_api.rb', line 293

def dns_reverse(api_key, value, type, opts = {})
  data, _status_code, _headers = dns_reverse_with_http_info(api_key, value, type, opts)
  data
end

#dns_reverse_with_http_info(api_key, value, type, opts = {}) ⇒ Array<(ReverseDnsResponse, Integer, Hash)>

Reverse DNS Lookup Search domains by IP or DNS value. 5 credits per page.

Parameters:

  • api_key (String)

    Your WHOISFreaks API key

  • value (String)

    IP, CIDR, or record value

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

    the optional parameters

Options Hash (opts):

  • :exact (Boolean) — default: default to true
  • :page (Integer) — default: default to 1
  • :format (String) — default: default to 'json'

Returns:

  • (Array<(ReverseDnsResponse, Integer, Hash)>)

    ReverseDnsResponse data, response status code and response headers



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/whoisfreaks/api/dns_api.rb', line 308

def dns_reverse_with_http_info(api_key, value, type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DNSApi.dns_reverse ...'
  end
  # verify the required parameter 'api_key' is set
  if @api_client.config.client_side_validation && api_key.nil?
    fail ArgumentError, "Missing the required parameter 'api_key' when calling DNSApi.dns_reverse"
  end
  # verify the required parameter 'value' is set
  if @api_client.config.client_side_validation && value.nil?
    fail ArgumentError, "Missing the required parameter 'value' when calling DNSApi.dns_reverse"
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling DNSApi.dns_reverse"
  end
  # verify enum value
  allowable_values = ["a", "mx", "cname", "ns", "aaaa", "txt", "soa"]
  if @api_client.config.client_side_validation && !allowable_values.include?(type)
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  allowable_values = ["json", "xml"]
  if @api_client.config.client_side_validation && opts[:'format'] && !allowable_values.include?(opts[:'format'])
    fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v2.1/dns/reverse'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'apiKey'] = api_key
  query_params[:'value'] = value
  query_params[:'type'] = type
  query_params[:'exact'] = opts[:'exact'] if !opts[:'exact'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ReverseDnsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"DNSApi.dns_reverse",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DNSApi#dns_reverse\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end