Skip to content
This repository

Access the Dynect REST API from Ruby

branch: master


Interact with the Dynect REST API.

Resource Records

Since this is 90% of what you'll be doing, we make it easy.

require 'dynect_rest'

Will add an A record and a CNAME. You can use the chained method syntax for every resource record - we map unknown methods to the resource data you make in the call. See “example.rb” for an executable example using environment variables.


Create a new GSLB:

require 'dynect_rest'
gslb = dyn.gslb()
gslb.monitor(:protocol => "HTTP", :interval => 1, :port => 8000, :path => "/healthcheck", :host => "")
gslb.add_host(:address => "", :label => "friendly_name", :weight => 10, :serve_mode => "obey")
gslb.add_host(:address => "", :label => "friendly_name2", :weight => 10, :serve_mode => "obey")

This will create a GSLB with hosts and in the global region. The parameters are self-explanatory.

Add a host to an existing GSLB:

require 'dynect_rest'
gslb = dyn.gslb.get("")
gslb.add_host(:address => "", :label => "friendly_name3", :weight => 10, :serve_mode => "obey")

This will fetch the GSLB object for “”, add the host, and save the updated configuration back to dynect.

Everything else

We wrap up the lower-level functionality of the API, so you can focus on just making the calls. For example, to get a list of contacts:


To create a new contact:

dyn ="CUSTOMER", "USERNAME", "PASSWORD", "ZONE")'Contact', { "first_name" => "Bobo", "last_name" => "Clown", "organization" => 'The Circus', "email" => "" })

Use the API docs

For more - you should be able to find the latest at:

If you are a Dynect customer.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.


Copyright © 2010 Opscode, Inc. See LICENSE for details.

Something went wrong with that request. Please try again.