A Ruby command line utility and wrapper for the DNSimple API. DNSimple is a hosted DNS service that can be found at "http://dnsimple.com/":http://dnsimple.com/ h2. Installation
[sudo] gem install dnsimple-ruby
h2. Credentials
Create a file in your home directory called .dnsimple
In this file add the following:
username: YOUR_USERNAME
password: YOUR_PASSWORD
Alternatively you can pass the credentials via command-line arguments, as in:
dnsimple -u username -p password list
h2. Commands
There are two ways to interact with the DNSimple Ruby wrapper. The first is
to use the command line utility that is included.
The commands available are as follows:
For help:
* dnsimple help
The following commands are available for domains:
* dnsimple list
* dnsimple describe domain.com
* dnsimple create domain.com
* dnsimple register domain.com registrant_id
* dnsimple transfer domain.com registrant_id [authinfo]
* dnsimple delete domain.com
* dnsimple apply domain.com template_short_name
Please note that domain registration and transfer can only be done through the API for domains that do not require extended attributes. A future version of the API will add support for extended attributes.
The following commands are available for records:
* dnsimple record:create [--prio=priority] domain.com name type content [ttl]
* dnsimple record:list domain.com
* dnsimple record:delete domain.com record_id
The following commands are available for custom templates:
* dnsimple template:list
* dnsimple template:create name short_name [description]
* dnsimple template:delete short_name
* dnsimple template:list_records short_name
* dnsimple template:add_record short_name name type content [ttl] [prio]
* dnsimple template:delete_record short_name template_record_id
The following commands are available for managing contacts:
* dnsimple contact:list
* dnsimple contact:describe id
* dnsimple contact:create [name:value name:value ...]
* dnsimple contact:update id [name:value name:value ...]
* dnsimple contact:delete id
To list all extended attributes for a given TLD:
* dnsimple extended-attributes:list tld
The following commands are available for listing services and adding and removing them from domains
* service:list
* service:describe short_name
* service:applied domain.com
* service:available domain.com
* service:add domain.com short_name
* service:remove domain.com short_name
The following commands are available for purchasing certificates:
* dnsimple certificate:purchase domain.com name
* dnsimple certificate:submit domain.com id approver_email
h3. Contact Attributes
The contact attributes that can be used in the name:value pairs are:
* first_name
* last_name
* organization_name (optional)
* job_title (required if organization name is specified)
* address1
* address2 (optional)
* city
* state_province (also aliased as state)
* postal_code
* country
* email
* phone
* phone_ext (optional)
* fax (optional)
h2. Wrapper Classes
In addition to the command line utility you may also use the included Ruby
classes directly in your Ruby applications.
Sample:
require 'rubygems'
require 'dnsimple'
DNSimple::Client.username = 'YOUR_USERNAME'
DNSimple::Client.password = 'YOUR_PASSWORD'
user = User.me
puts "#{user.domain_count} domains"
puts "Domains..."
Domain.all.each do |domain|
puts " #{domain.name}"
end
domain = Domain.find("example.com")
domain.apply("template") # applies a standard or custom template to the domain
domain = Domain.create("newdomain.com")
puts "Added #{domain.name}"
domain.delete # removes from DNSimple
The complete RDoc for the wrapper classes can be found here:
"http://rdoc.info/projects/aetrion/dnsimple-ruby":http://rdoc.info/projects/aetrion/dnsimple-ruby