Sha256: 07d8a57cc97a08954211be870ba32590ba06d241a206f71be1b3980947b83b2d

Contents?: true

Size: 826 Bytes

Versions: 7

Compression:

Stored size: 826 Bytes

Contents

require 'vagrant-skytap/api/resource'

module VagrantPlugins
  module Skytap
    module API
      class PublishSet < Resource

        attr_reader :environment
        reads :id, :url, :desktops_url

        def initialize(attrs, environment, env)
          super
          @environment = environment
        end

        def password_protected?
          # password attribute contains asterisks or null
          get_api_attribute('password').present?
        end

        def vm_ids
          vm_refs = get_api_attribute("vms").collect{|ref| ref['vm_ref']}
          vm_refs.collect{|ref| ref.match(/\/vms\/(\d+)/)}.compact.map{|match| match[1]}
        end

        def vms
          environment.get_vms_by_id(vm_ids)
        end

        def delete
          api_client.delete(url)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vagrant-skytap-0.2.3 lib/vagrant-skytap/api/publish_set.rb
vagrant-skytap-0.2.2 lib/vagrant-skytap/api/publish_set.rb
vagrant-skytap-0.2.1 lib/vagrant-skytap/api/publish_set.rb
vagrant-skytap-0.2.0 lib/vagrant-skytap/api/publish_set.rb
vagrant-skytap-0.1.11 lib/vagrant-skytap/api/publish_set.rb
vagrant-skytap-0.1.10 lib/vagrant-skytap/api/publish_set.rb
vagrant-skytap-0.1.9 lib/vagrant-skytap/api/publish_set.rb