Class: Colombo::Droplets
- Defined in:
- lib/colombo/droplets.rb
Instance Method Summary collapse
- #create(options = {}) ⇒ Object
-
#initialize(client) ⇒ Droplets
constructor
A new instance of Droplets.
Methods inherited from Container
#find, #method_missing, #run_find_by_attr
Constructor Details
#initialize(client) ⇒ Droplets
Returns a new instance of Droplets.
8 9 10 11 12 13 14 15 |
# File 'lib/colombo/droplets.rb', line 8 def initialize(client) @client = client @client.request(:get, '/droplets/', {}) do |response| response['droplets'].each do |droplet| self << Droplet.new(@client, droplet) end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Colombo::Container
Instance Method Details
#create(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/colombo/droplets.rb', line 17 def create(={}) [:name,:size_id, :image_id,:region_id].each do |key| raise "Required `#{key}` attribute" if not .include?( key ) end if [:ssh_keys] [:ssh_keys] = [:ssh_keys].join(',') end @client.request(:get, '/droplets/new', ) do |response| puts response end end |