whois_rb
is a simple ruby wrapper for whois-api.
- You need to signup for Prompt API
- You need to subscribe whois-api, test drive is free!!!
- You need to set
PROMPTAPI_TOKEN
environment variable after subscription.
then;
$ gem install whois_rb
or; install from GitHub:
$ gem install whois_rb --version "0.1.0" --source "https://rubygems.pkg.github.com/promptapi"
Check domain examples:
require 'whois_rb'
result = WhoisRb::check('promptapi.com')
# => {:result=>"registered"}
result = WhoisRb::check('promptapi.com', timeout=20)
# => {:result=>"registered"}
result = WhoisRb::check('foo')
# => {:error=>"Not a valid domain name"}
result = WhoisRb::check('promptapi123456.com')
# => {:result=>"available"}
Query domain examples:
require 'whois_rb'
result = WhoisRb::query('foo')
# => {:error=>"Not a valid domain name"}
result = WhoisRb::query('promptapi.com')
# => {
:result=>{
:domain_name=>"PROMPTAPI.COM",
:registrar=>"NameCheap, Inc.",
:whois_server=>"whois.namecheap.com",
:referral_url=>nil,
:updated_date=>"2020-05-27 22:19:36",
:creation_date=>"2020-04-19 15:11:52",
:expiration_date=>"2021-04-19 15:11:52",
:name_servers=>["APOLLO.NS.CLOUDFLARE.COM", "MARJORY.NS.CLOUDFLARE.COM"],
:status=>"clientTransferProhibited https://icann.org/epp#clientTransferProhibited",
:emails=>"abuse@namecheap.com",
:dnssec=>"unsigned",
:name=>nil,
:org=>nil,
:address=>nil,
:city=>nil,
:state=>nil,
:zipcode=>nil,
:country=>nil
}
}
result = WhoisRb::query('promptapi1234.com')
# => {:error=>"No match for promptapi1234.com"}
After checking out the repo, run bin/setup
to install dependencies. Then,
run rake test
to run the tests. You can also run bin/console
for an
interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
.
To release a new version, update the version number in version.rb
, and then
run bundle exec rake release
, which will create a git tag for the version,
push git commits and tags, and push the .gem
file to
rubygems.org
$ rake -T
rake build # Build whois_rb-0.0.0.gem into the pkg directory
rake bump[revision] # Bump version
rake clean # Remove any temporary products
rake clobber # Remove any generated files
rake install # Build and install whois_rb-0.0.0.gem into system gems
rake install:local # Build and install whois_rb-0.0.0.gem into system gems without network access
rake push_to_github # Push whois_rb-0.0.0.gem to GitHub registry
rake release[remote] # Create tag v0.0.0 and build and push whois_rb-0.0.0.gem to rubygems.org
rake test # Run tests
This project is licensed under MIT
- Prompt API - Creator, maintainer
Bug reports and pull requests are welcome on GitHub:
fork
(https://github.com/promptapi/whois_rb/fork)- Create your
branch
(git checkout -b my-feature
) commit
yours (git commit -am 'Add awesome features...'
)push
yourbranch
(git push origin my-feature
)- Than create a new Pull Request!
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.