Sha256: cb385fc6d83abef5c15816814439f176c46d2fb702bd1d08403fb5783189f01b

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

module FogExtensions
  module DigitalOcean
    module Server
      extend ActiveSupport::Concern

      def vm_description
        flavor.try(:name)
      end

      def flavor
        requires :flavor_id
        @flavor ||= service.flavors.get(flavor_id.to_i)
      end

      def image
        requires :image_id
        @image ||= service.images.get(image_id.to_i)
      end

      def region
        requires :region_id
        @region ||= service.regions.get(region_id.to_i)
      end

      def ip_addresses
        [public_ip_address, private_ip_address].flatten.select(&:present?)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_digitalocean-0.0.2 app/models/concerns/fog_extensions/digitalocean/server.rb
foreman_digitalocean-0.0.1 app/models/concerns/fog_extensions/digitalocean/server.rb