Sha256: 06c5d15fc43be837fccc0bb58797448d75e786b47efde5390f972c7e9cca1e59

Contents?: true

Size: 900 Bytes

Versions: 3

Compression:

Stored size: 900 Bytes

Contents

require 'json'

module Mulder
  class Instance

    attr_reader :fog_compute_instance

    def initialize(fog_compute_instance)
      @fog_compute_instance = fog_compute_instance
    end

    def id
      @fog_compute_instance.id
    end

    def dns_name
      @fog_compute_instance.dns_name
    end

    def public_ip_address
      @fog_compute_instance.public_ip_address
    end

    def private_ip_address
      @fog_compute_instance.private_ip_address
    end

    def vpc_id
      @fog_compute_instance.vpc_id
    end

    def created_at
      @fog_compute_instance.created_at
    end

    def as_hash
      @as_hash ||= {
        id: id,
        dns_name: dns_name,
        public_ip_address: public_ip_address,
        private_ip_address: private_ip_address,
        vpc_id: vpc_id,
        created_at: created_at
      }.delete_if { |_, value| value == '' || value == nil }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mulder-0.0.3 lib/mulder/instance.rb
mulder-0.0.2 lib/mulder/instance.rb
mulder-0.0.1 lib/mulder/instance.rb