Add this line to your application's Gemfile:
gem 'dnsmadeeasy-rest-api'
And then execute:
$ bundle
Or install it yourself:
$ gem install dnsmadeeasy-rest-api
Start by creating a new instance of the DnsMadeEasy
class, and passing your api key and secret.
api = DnsMadeEasy.new('awesome-api-key', 'super-secret-and-awesome-api-secret')
All return values are the direct JSON responses from DNS Made Easy converted into a Hash.
See: http://www.dnsmadeeasy.com/wp-content/themes/appdev/pdf/API-Documentationv2.pdf
To retrieve all domains:
api.domains
To retreive the id of a domain by the domain name:
api.get_id_by_domain('hello.example.com')
To retrieve the full domain record by domain name:
api.domain('hello.example.com')
To create a domain:
api.create_domain('hello.example.com')
# Multiple domains can be created by:
api.create_domains(['hello.example.com', 'sup.example.com'])
To delete a domain:
api.delete_domain('hello.example.com')
To retrieve all records for a given domain name:
api.records_for('hello.example.com')
To find the record id for a given domain, name, and type:
This finds the id of the A record 'woah.hello.example.com'.
api.find_record_id('hello.example.com', 'woah', 'A')
To delete a record by domain name and record id (the record id can be retrieved from find_record_id
:
api.delete_record('hello.example.com', 123)
# To delete multiple records:
api.delete_records('hello.example.com', [123, 143])
# To delete all records in the domain:
api.delete_all_records('hello.example.com')
To create a record:
api.create_record('hello.example.com', 'woah', 'A', '127.0.0.1', { 'ttl' => '60' })
api.create_a_record('hello.example.com', 'woah', '127.0.0.1', {})
api.create_aaaa_record('hello.example.com', 'woah', '127.0.0.1', {})
api.create_ptr_record('hello.example.com', 'woah', '127.0.0.1', {})
api.create_txt_record('hello.example.com', 'woah', '127.0.0.1', {})
api.create_cname_record('hello.example.com', 'woah', '127.0.0.1', {})
api.create_ns_record('hello.example.com', 'woah', '127.0.0.1', {})
api.create_spf_record('hello.example.com', 'woah', '127.0.0.1', {})
# Arguments are: domain_name, name, priority, value, options = {}
api.create_mx_record('hello.example.com', 'woah', 5, '127.0.0.1', {})
# Arguments are: domain_name, name, priority, weight, port, value, options = {}
api.create_srv_record('hello.example.com', 'woah', 1, 5, 80, '127.0.0.1', {})
# Arguments are: domain_name, name, value, redirectType, description, keywords, title, options = {}
api.create_httpred_record('hello.example.com', 'woah', '127.0.0.1', 'STANDARD - 302', 'a description', 'keywords', 'a title', {})
To update a record:
api.update_record('hello.example.com', 123, 'woah', 'A', '127.0.1.1', { 'ttl' => '60' })
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request