Sha256: 1724af568c243dc9c47679c59549e53ed9488e93495dfc1c663274a927037768

Contents?: true

Size: 612 Bytes

Versions: 15

Compression:

Stored size: 612 Bytes

Contents

module DevboxLauncher
  class Description

    def initialize(yaml)
      @desc = YAML.load(yaml)
    end

    def ip
      return @ip if @ip
      network_interface = network_interfaces.first
      access_configs = network_interface["accessConfigs"]

      access_config = access_configs.find do |c|
        c["kind"] == "compute#accessConfig"
      end
      @ip = access_config["natIP"]
    end

    def status
      @status ||= @desc["status"]
    end

    def network_interfaces
      @network_interfaces ||= @desc["networkInterfaces"]
    end

    def running?
      status == "RUNNING"
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
devbox_launcher-1.1.1 lib/devbox_launcher/models/description.rb
devbox_launcher-1.1.0 lib/devbox_launcher/models/description.rb
devbox_launcher-1.0.0 lib/devbox_launcher/models/description.rb
devbox_launcher-0.7.1 lib/devbox_launcher/models/description.rb
devbox_launcher-0.7.0 lib/devbox_launcher/models/description.rb
devbox_launcher-0.6.1 lib/devbox_launcher/models/description.rb
devbox_launcher-0.6.0 lib/devbox_launcher/models/description.rb
devbox_launcher-0.5.2 lib/devbox_launcher/models/description.rb
devbox_launcher-0.5.1 lib/devbox_launcher/models/description.rb
devbox_launcher-0.5.0 lib/devbox_launcher/models/description.rb
devbox_launcher-0.4.0 lib/devbox_launcher/models/description.rb
devbox_launcher-0.3.5 lib/devbox_launcher/models/description.rb
devbox_launcher-0.3.4 lib/devbox_launcher/models/description.rb
devbox_launcher-0.3.3 lib/devbox_launcher/models/description.rb
devbox_launcher-0.3.2 lib/devbox_launcher/models/description.rb