Class: VagrantPlugins::Skytap::API::PublishSet

Inherits:
Resource show all
Defined in:
lib/vagrant-skytap/api/publish_set.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#attrs, #env

Instance Method Summary collapse

Methods inherited from Resource

#refresh, #reload, resource_name, #url

Methods included from SpecifiedAttributes

#get_api_attribute, included

Constructor Details

#initialize(attrs, environment, env) ⇒ PublishSet



11
12
13
14
# File 'lib/vagrant-skytap/api/publish_set.rb', line 11

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

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



8
9
10
# File 'lib/vagrant-skytap/api/publish_set.rb', line 8

def environment
  @environment
end

Instance Method Details

#deleteObject



30
31
32
# File 'lib/vagrant-skytap/api/publish_set.rb', line 30

def delete
  api_client.delete(url)
end

#password_protected?Boolean



16
17
18
19
# File 'lib/vagrant-skytap/api/publish_set.rb', line 16

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

#vm_idsObject



21
22
23
24
# File 'lib/vagrant-skytap/api/publish_set.rb', line 21

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

#vmsObject



26
27
28
# File 'lib/vagrant-skytap/api/publish_set.rb', line 26

def vms
  environment.get_vms_by_id(vm_ids)
end