require 'droplet_kit' # get access token from https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-api-v2 # export DIGITAL_OCEAN_TOKEN=XXXXXXXXXXXX client = DropletKit::Client.new(access_token: ENV['DIGITAL_OCEAN_TOKEN']) client.droplets.all().map do |i| i.networks.each do |network| if network&.first&.ip_address puts "#{network&.first&.ip_address}" end end end