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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#delete, #refresh, #reload, short_name, #update, #url

Methods included from SpecifiedAttributes

#get_api_attribute, included

Constructor Details

#initialize(attrs, environment, env) ⇒ PublishSet

Returns a new instance of PublishSet.



37
38
39
40
# File 'lib/vagrant-skytap/api/publish_set.rb', line 37

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

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



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

def environment
  @environment
end

Class Method Details

.rest_nameObject



33
34
35
# File 'lib/vagrant-skytap/api/publish_set.rb', line 33

def self.rest_name
  "publish_set"
end

Instance Method Details

#password_protected?Boolean

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/vagrant-skytap/api/publish_set.rb', line 42

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

#vm_idsObject



47
48
49
50
# File 'lib/vagrant-skytap/api/publish_set.rb', line 47

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



52
53
54
# File 'lib/vagrant-skytap/api/publish_set.rb', line 52

def vms
  environment.get_vms_by_id(vm_ids)
end