digitalocean/droplet_kit

unable to create a database with client.database.create_db

webdz9r opened this issue · 2 comments

I'm trying to create a new database with the following code:
client connection is good
primary_db is defined with the target ID of the cluster I want to create the db with

database = DropletKit::Database.new(name: "test-db-deleteme")
client.database.create_db(database, id: primary_db)

it returns an error
/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/droplet_kit-3.19.0/lib/droplet_kit/client.rb:73:in method_missing': undefined method database' for #<DropletKit::Client:0x00000001591362a8...

irb(main):011:0> database => <DropletKit::Database {:@name=>"testing-delete-me"}>

droplet_kit-3.19.0
ruby 3.0.0

Tracing through the code it looks like the resource.database isn't valid so it's raised the method_missing function

turns out your documentation on the readme.md is wrong
client.database.create_db(database, id: 'id') is wrong, client.database < singular
but you need
client.databases.create_db(database, id: 'id')

Thanks for flagging that typo. We'll get it fixed up.