Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

whoisxmlapi

Package Overview
Dependencies
Maintainers
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whoisxmlapi

  • 0.3.1
  • Rubygems
  • Socket score

Version published
Maintainers
4
Created
Source

Whoisxmlapi

Gem for accessing whoisxmlapi.com based on httparty and mongoid

Installation

Add this line to your application's Gemfile:

gem 'whoisxmlapi'

And then execute:

$ bundle

Or install it yourself as:

$ gem install whoisxmlapi

Usage

Whois

# config/initializers/whoisxmlapi.rb
WhoisXMLAPI.configure do |config|
  config.username = ENV['WHOISXMLAPI_USERNAME']
  config.password = ENV['WHOISXMLAPI_PASSWORD']
  config.cache = true
  config.cache_length = 1.minute
end

# elsewhere
wc = WhoisXMLAPI::Client.new
y = wc.whois("google.com")

# y should now be a WhoisXMLAPI::Result (or an exeption was thrown)
y.registrant.email

Associate your model with a whois record:

has_one :whois, as: :whoisable, autosave: true, class_name: "WhoisXMLAPI::Result"

Now we can get at the data:

myinstance.whois.registrant.email

RWhois

z = wc.rwhois(cmaujean@brandle.net)
z.domains

Associate your model with a rwhois record:

has_one :rwhois, as: :rwhoisable, autosave: true, class_name: "WhoisXMLAPI::RWhoisResult"

Account Balance

Check your whoisxmlapi credits:

balance = wc.account_balance

# {
#  "balance"=>"464",
#  "reserve"=>"500",
#  "monthly_balance"=>"0",
#  "monthly_reserve"=>"0",
#  "reverse_whois_balance"=>"0",
#  "reverse_whois_reserve"=>"0",
#  "reverse_whois_monthly_balance"=>"0",
#  "reverse_whois_monthly_reserve"=>"0",
#  "ba_query_balance"=>nil,
#  "ba_query_reserve"=>nil,
#  "ra_query_balance"=>nil,
#  "ra_query_reserve"=>nil,
#  "ds_query_balance"=>nil,
#  "ds_query_reserve"=>nil
#  }

Callbacks

You can add callbacks to your whois and rwhois calls via the initializer:

config.callbacks[:whois] << Proc.new { SystemCumulativeStats.increment_whoisxmlapi_requests }
config.callbacks[:rwhois] << Proc.new { SystemCumulativeStats.increment_rwhoisxmlapi_requests }

The callbacks will be called after the request to whoisxmlapi.com has been made. NOTE: Callback arguments are not currently supported.

Exists

Boolean check to see if a domain is registered.

wc.exists("foo.com")
#=> true

wc.exists("sdflsdfhwetewrw.com")
#=> false

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 02 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc