Domain and IP Pinger API - Ruby Gem

Pinger is a simple tool for checking if a URL is up. It returns a boolean value indicating whether the URL is up or not.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_pinger'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_pinger

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_pinger'

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

# Make a request
response = client.execute({
  host: "google.com",
  retries: 1
})

# Print the response
puts response

Error Handling

begin
  response = client.execute({ host: "google.com", retries: 1 })
  puts response["data"]
rescue APIVerve::Pinger::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Pinger::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "host": "google.com",
    "numericHost": "2607:f8b0:4001:c6e::8a",
    "alive": true,
    "roundTrips": 3,
    "packetLoss": 0,
    "minMS": 0.652,
    "avgMS": 0.6846666666666666,
    "maxMS": 0.712,
    "stdDev": 0.02478350706058811,
    "times": [
      0.712,
      0.652,
      0.69
    ]
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.