Class: Create
- Inherits:
-
Object
- Object
- Create
- Defined in:
- lib/red_drop/create.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(client) ⇒ Create
constructor
A new instance of Create.
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
#execute ⇒ Object
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 |