0.0
No commit activity in last 3 years
No release in over 3 years
A wrapper for Digital Ocean's API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

Digital Ocean API

This gem is a simple and easy-to-use wrapper for Digital Ocean's API.

Installation

Add this line to your application's Gemfile:

gem 'digital-ocean'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install digital-ocean

Usage

To use the API methods, you'll need to retrieve your client ID and API key from Digital Ocean after logging in. You can then instantiate a new client and use the API methods.

# Create a new client
client = DigitalOcean.client(
  :client_id => "202cd122bd857fb65d80bf804ef47fde",
  :api_key   => "cd7d64f341654411eadb4b32e2c6a2ae"
)

Droplets

Retrieve a list of your droplets

This method returns an array of droplets each with the following attributes: backups_active, created_at, id, image_id, ip_address, locked, name, private_ip_address, region_id, size_id, status

client.droplets
# => #<Hashie::Mash droplets=[#<Hashie::Mash backups_active=false cre...

Retrieve a droplet by its ID

This method retrieves a single droplet by its ID.

client.droplet(145822)

Create a new droplet

This method creates a new droplet. It takes the following parameters:

  • :name Required, String, this is the name of the droplet - must be formatted by hostname rules.
  • :size_id Required, Numeric, this is the id of the size you would like the droplet created at.
  • :image_id Required, Numeric, this is the id of the image you would like the droplet created with.
  • :region_id Required, Numeric, this is the id of the region you would like your server in.
  • :ssh_key_ids Optional, Numeric CSV, comma separated list of ssh_key_ids that you would like to be added to the server.
  • :private_networking Optional, Boolean, enables a private network interface if the region supports private networking.
client.new_droplet(
  :name        => 'test.example.com',
  :size_id     => 63,
  :region_id   => 4,
  :ssh_key_ids => "ssh-key rsa e5ab78..,ssh-key rsa...",
  :private_networking => true
)

Regions

Retrieve a list of available regions

This method returns a list of regions that are available to create a new droplet in with info about each location.

client.regions

Sizes

Retrieve a list of available sizes

This method retrieves a list of available sizes for a new droplet along with information about each size.

client.sizes

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