Droplet volumes nil
Opened this issue · 3 comments
Deleted user commented
While trying to get droplet volumes like this:
client = DropletKit::Client.new(access_token: '<TOKEN>')
volumes = client.droplets.find(id: '<DROPLET_ID>').volumes
I get nil, even if droplet has attached volumes. Checked with doctl - it shows volumes fine, so I think it's not API issue.
hilary commented
Is the problem still occurring?
Deleted user commented
Yes it is. I found another way of getting volumes and it works well:
client = DropletKit::Client.new(access_token: '<TOKEN>')
volumes = client.volumes.all().find_all { | v | v.droplet_ids.any? { |did| did == '<DROPLET_ID>' } }.to_a
andrewsomething commented
The issue here seems to be that the API returns the attribute volume_ids
:
https://developers.digitalocean.com/documentation/v2/#droplets
Which is not set in the model:
https://github.com/digitalocean/droplet_kit/blob/master/lib/droplet_kit/models/droplet.rb#L3