DNSimple Ruby Client Build Status

A Ruby command line utility and wrapper for the DNSimple API.

DNSimple provides DNS hosting and domain registration that is simple and friendly. We provide a full API and an easy-to-use web interface so you can get your domain registered and set up with a minimal amount of effort.

Installation

$ gem install dnsimple-ruby

DNSimple Client

This library provides a Ruby DNSimple client you can use to interact with the DNSimple API. Here's a short example.

require 'dnsimple'

DNSimple::Client.username   = 'YOUR_USERNAME'
DNSimple::Client.password   = 'YOUR_PASSWORD'

user = DNSimple::User.me
puts "#{user.domain_count} domains"

puts "Domains..."
DNSimple::Domain.all.each do |domain|
  puts "  #{domain.name}"
end

domain = DNSimple::Domain.find("example.com")
domain.apply("template") # applies a standard or custom template to the domain

domain = DNSimple::Domain.create("newdomain.com")
puts "Added #{domain.name}"
domain.delete # removes from DNSimple

For the full API documentation visit http://rubydoc.info/gems/dnsimple-ruby

Authentication

This client supports both the HTTP Basic and API Token authentication mechanism.

HTTP Basic

DNSimple::Client.username = 'YOUR_USERNAME'
DNSimple::Client.password = 'YOUR_PASSWORD'

user = DNSimple::User.me

HTTP Basic with two-factor authentication enabled

See the 2FA API documentation.

# Request the 2FA exchange token
DNSimple::Client.username = 'YOUR_USERNAME'
DNSimple::Client.password = 'YOUR_PASSWORD'
token = DNSimple::User.two_factor_exchange_token('otp-token')

# Authenticate with the exchange token
DNSimple::Client.exchange_token = token
user = DNSimple::User.me

API Token

DNSimple::Client.api_token = 'the-token'

user = DNSimple::User.me

Credentials

Create a file in your home directory called .dnsimple.

In this file add the following:

username: YOUR_USERNAME
password: YOUR_PASSWORD

Or if using an API token

username: YOUR_USERNAME
api_token: YOUR_API_TOKEN

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:

The following commands are available for domains:

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:

The following commands are available for custom templates:

The following commands are available for managing contacts:

The following commands are available for purchasing certificates:

The contact name/value pairs are: