URL Lookup API - Ruby Gem
URL Lookup is a simple tool for looking up the location of a URL. It returns the location of the URL provided.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_urllookup'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_urllookup
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_urllookup'
# Initialize the client
client = APIVerve::Urllookup::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ url: "https://www.merriam-webster.com/dictionary/documentation" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ url: "https://www.merriam-webster.com/dictionary/documentation" })
puts response["data"]
rescue APIVerve::Urllookup::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Urllookup::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Urllookup::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"range": "",
"country": "US",
"region": "",
"city": "Cheney",
"timezone": "America/Chicago",
"state": "Kansas",
"zipcode": "67025",
"coordinates": [
37.751,
-97.822
],
"url": "https://www.merriam-webster.com/dictionary/documentation",
"domain": "www.merriam-webster.com",
"ip": "104.20.45.199",
"countryName": "United States",
"continent": "NA",
"continentName": "North America",
"accuracyRadius": 1000,
"isEU": false
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/urllookup?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.