basecamp/dyn-rb

Name: dyn-rb

Owner: Basecamp

Description: Dyn SDK for Ruby

Created: 2015-01-09 17:43:33.0

Updated: 2015-07-13 08:22:40.0

Pushed: 2014-12-18 14:29:16.0

Homepage: null

Size: 362

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Dyn SDK for Ruby

NOTE: This SDK is brand new - we welcome your feedback! Please reach out via pull request or GitHub issue.

Install via:

gem install dyn-rb

Making DNS Updates as easy as:

require 'dyn-rb'

# 1: create the client
dyn = Dyn::Traffic::Client.new(customer, username, password)

# 2: set the zone
dyn.zone = "example.com"

# 3a: create an A record
dyn.a.fqdn("foo.example.com").ttl(3600).address("192.168.1.1").save(:replace)

# 3b: create a CNAME record
dyn.cname.fqdn("foo2.example.com").cname("ec2-10-10-10-10.amazonaws.com").save(:replace)

# 3c: create an HTTP redirect
dyn.http_redirect.fqdn("cool.example.com").code(301).keep_uri("Y").url("https://maint.example.com").save(:replace)

# 4: publish the changes
dyn.zone.publish

Working with GSLB looks like:

require 'dyn-rb'

# 1: create the client
dyn = Dyn::Traffic::Client.new(customer, username, password)

# 2: set the zone
dyn.zone = "example.com"

# 3: get the GSLB service
gslb = dyn.gslb

# 4: set up GSLB parameters
gslb.fqdn("sunshine.example.com").ttl(30).region_code("global")
gslb.min_healthy(1).serve_count(2)
gslb.monitor(:protocol => "HTTP", :interval => 1, :port => 8000, :path => "/healthcheck", :host => "sunshine.example.com")
gslb.add_host(:address => "1.1.1.1", :label => "friendly_name", :weight => 10, :serve_mode => "obey")
gslb.add_host(:address => "1.1.1.2", :label => "friendly_name2", :weight => 10, :serve_mode => "obey")

# 5: save changes
gslb.save

# 6: publish zone
dyn.zone.publish

Working with Messaging is as easy as:

require 'dyn-rb'

# 1: create the client
dyn = Dyn::Messaging::Client.new(apikey)

# 2: work with accounts
puts "retrieving accounts list..."
puts dyn.accounts.list.inspect

# 3: work with senders
dyn.senders.create("person@example.com", 0)

# 4: work with recipients
puts dyn.recipients.status("example@example.com").inspect

# 5: send mail
dyn.send_mail.create("example@example.com", "recipient@recipient.com", "hi!", "from the ruby api!", "<html>hi html</html>", "replyto@example.com", "ccaddress@recipient.com", "xheader1")

# 6: check reports
puts dyn.delivery.list("2013-11-11", "2013-12-12", "example@example.com", "X-example4").inspect

Examples

See more comprehensive examples in the “examples” folder!

API Endpoints Supported

Ruby HTTP Clients Supported

NB: this experimental feature is not fully implemented, and may be removed in future releases

Testing

To test that this API clients generates the correct REST URls for the API, we use rspec and webmock.

To run the tests run:

    $ rspec

Known Issues

License

Apache License v2.0


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.