The folks at DreamHost were gracious enough to provide me with a complimentary Private Server account so I could expand Dreamy’s functionality. What a nice surprise that was!
So, to ensure they got their money’s worth, I added all the Private Server API calls to Dreamy! This means that Dreamy now covers the entire DreamHost API. Check out all the new commands added to “dh” (the accompanying command-line tool):
ps # list private servers
ps:add <web|mysql> <yes|no> # adds a private server of type <web|mysql>
ps:pending # list private servers scheduled to be created
ps:reboots <name> # list historical reboots for <name>
ps:reboot <name> now! # reboot <name> now! (proceed with caution)
ps:remove # removes all pending private servers
ps:settings <name> # list settings for private server <name>
ps:set <name> <setting> <value> # change <setting> on <name> to <value>
ps:size <name> # list historical memory sizes for <name>
ps:size <name> <value> # set new memory <value> for <name>
ps:usage <name> # list historical memory & CPU usage for <name>
You’ll need version 0.4.2 of the Dreamy gem to use the new functionality. To upgrade your gem, simply run the following:
DreamHost is running a kick-off competition in support of their newly released API. It seems like their developer community could use a little productivity boost, so I thought I’d create a Ruby library to interact with their API.
The resulting Ruby Gem, available on GitHub, is called “Dreamy” and includes a library and a command-line tool.
Why a command-line tool? Because sometimes you wanna see what’s going on with your DH account without having to pop open the control panel (also, as an example of how to use the library). Here is some sample output returning all DNS records for domains matching the string “rachel” (my wife’s name):
Isn’t that table-based formatting dreamy?!?! Next up, a listing of all domains on the account and their availability. If one of the domains is down, it will ping the domain’s host server to determine if the problem is system-wide or not:
There are many more things you can do with the command-line tool, but you can check out those by installing the gem and running:
dh help
How do you install the gem? It’s super-simple (if you already have Ruby and RubyGems installed):
gem sources -a http://gems.github.com (only needed if you've never run this before)
gem install sant0sk1-dreamy
Booyah!
How do you use the library? Well, you just require it into your Ruby program and hit the ground running!
require'rubygems'require'dreamy'
account = Dreamy::Base.new(username, api_key)# get an array of Domain objects
account.domains# get an array of User objects
account.users# get an array of DNS objects
account.dns# get an array of Subcribers to "my_list@example.com"
account.announce_list("my_list","example.com")# add a subscriber to "my_list@example.com"
account.announce_add("my_list","example.com","guy@gmail.com")# remove a subscriber to "my_list@example.com"
account.announce_remove("my_list","example.com","guy@gmail.com")
The Domain, User, DNS, and Subscriber objects that are returned in the arrays include all the data that DreamHost exposes about them from their API. For instance, I can print the attributes of the Domain object like so:
NOTE #1: The DreamHost API is still young and in heavy development. Dreamy is nowhere near a comprehensive library, but I wanted to get it into the public so other developers could use it for their competition projects. Please, if you find any bugs or want to add functionality… please, please, please fork the project and help out!