Tor Node Detector API - Ruby Gem

Tor Detect is an API that checks whether a given IP address belongs to a known Tor exit node. Useful for security, access control, and analytics.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_tordetect'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_tordetect

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_tordetect'

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

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

# Print the response
puts response

Error Handling

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

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "ipAddress": "185.189.183.143",
    "isTor": true,
    "ipDetails": {
      "range": [
        3116217344,
        3116218367
      ],
      "country": "NL",
      "region": "ZH",
      "timezone": "Europe/Amsterdam"
    },
    "parsed": true
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.