Coder Social home page Coder Social logo

dnsmadeeasy-rest-api's Introduction

Dns Made Easy Rest Api

Installation

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

Usage

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

Managing Domains

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')

Managing Records

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' })

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.