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(type, dns_bulk_request, opts = {}) ⇒ BulkDnsResponse

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

Parameters:

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

    the optional parameters

Options Hash (opts):

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

Returns:



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

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

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

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

Parameters:

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

    the optional parameters

Options Hash (opts):

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

Returns:

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

    BulkDnsResponse data, response status code and response headers



41
42
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
# File 'lib/whoisfreaks/api/dns_api.rb', line 41

def dns_bulk_with_http_info(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 '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[:'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] || 'BulkDnsResponse'

  # 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(domain_name, type, opts = {}) ⇒ HistoricalDnsResponse

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

Parameters:

  • 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:



112
113
114
115
# File 'lib/whoisfreaks/api/dns_api.rb', line 112

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

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

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

Parameters:

  • 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



125
126
127
128
129
130
131
132
133
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
# File 'lib/whoisfreaks/api/dns_api.rb', line 125

def dns_historical_with_http_info(domain_name, type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: 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[:'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(type, opts = {}) ⇒ DnsResponse

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

Parameters:

  • 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:



193
194
195
196
# File 'lib/whoisfreaks/api/dns_api.rb', line 193

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

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

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

Parameters:

  • 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



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
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
# File 'lib/whoisfreaks/api/dns_api.rb', line 206

def dns_live_with_http_info(type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: 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[:'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(value, type, opts = {}) ⇒ ReverseDnsResponse

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

Parameters:

  • 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:



271
272
273
274
# File 'lib/whoisfreaks/api/dns_api.rb', line 271

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

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

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

Parameters:

  • 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



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
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
# File 'lib/whoisfreaks/api/dns_api.rb', line 285

def dns_reverse_with_http_info(value, type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: 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[:'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