Class: VagrantPlugins::Skytap::API::Network

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

Instance Attribute Summary collapse

Attributes inherited from Resource

#attrs, #env

Instance Method Summary collapse

Methods inherited from Resource

#reload, resource_name, #url

Methods included from SpecifiedAttributes

#get_api_attribute, included

Constructor Details

#initialize(attrs, environment, env) ⇒ Network

Returns a new instance of Network.



13
14
15
16
# File 'lib/vagrant-skytap/api/network.rb', line 13

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

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



9
10
11
# File 'lib/vagrant-skytap/api/network.rb', line 9

def environment
  @environment
end

Instance Method Details

#attachment_for(vpn) ⇒ Object



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

def attachment_for(vpn)
  vpn = vpn.id unless vpn.is_a?(String)
  vpn_attachments.detect {|att| att.vpn['id'] == vpn}
end

#refresh(attrs) ⇒ Object



18
19
20
21
# File 'lib/vagrant-skytap/api/network.rb', line 18

def refresh(attrs)
  @vpn_attachments = nil
  super
end

#subnetObject



29
30
31
# File 'lib/vagrant-skytap/api/network.rb', line 29

def subnet
  Util::Subnet.new(get_api_attribute('subnet'))
end

#vpn_attachmentsObject



23
24
25
26
27
# File 'lib/vagrant-skytap/api/network.rb', line 23

def vpn_attachments
  @vpn_attachments ||= (get_api_attribute('vpn_attachments') || []).collect do |att_attrs|
    VpnAttachment.new(att_attrs, self, env)
  end
end