Class: Create

Inherits:
Object
  • Object
show all
Defined in:
lib/red_drop/create.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Create

Returns a new instance of Create.



2
3
4
# File 'lib/red_drop/create.rb', line 2

def initialize(client)
  @client = client
end

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/red_drop/create.rb', line 6

def execute
  puts "loading... \n\n"
  #user_data = File.read("cloud-config.yaml")

  response = @client.post do |req|
    req.body = {name: 'RedDrop', region: 'nyc1', size: 's-1vcpu-512mb-10gb', image: 'ubuntu-22-04-x64'}
  end
  
  body = JSON.parse(response.body)

  puts "Your droplet: #{body["droplet"]["id"]}, is being provisioned.\n"
end