Reverse DNS Lookup API - Ruby Gem

Reverse DNS Lookup is a tool for finding the hostname associated with an IP address. It returns the PTR record for the given IP.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_reversednslookup'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_reversednslookup

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_reversednslookup'

# Initialize the client
client = APIVerve::Reversednslookup::Client.new(api_key: "YOUR_API_KEY")

# Make a request
response = client.execute({ ip: "8.8.8.8" })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ ip: "8.8.8.8" })
  puts response["data"]
rescue APIVerve::Reversednslookup::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Reversednslookup::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

# Enable debug logging
client = APIVerve::Reversednslookup::Client.new(
  api_key: "YOUR_API_KEY",
  debug: true
)

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "ip": "8.8.8.8",
    "hostname": "dns.google",
    "ptr": [
      "dns.google"
    ],
    "found": true
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.