Method: Fog::Network::Softlayer::Mock#get_network

Defined in:
lib/fog/softlayer/requests/network/get_network.rb

#get_network(id) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/fog/softlayer/requests/network/get_network.rb', line 14

def get_network(id)
  response = Excon::Response.new
  response.status = 200
  response.body = @networks.select { |vlan| vlan['id'] == id }.first
  if response.body.nil?
    response.status = 404
    response.body = "{\"error\":\"Unable to find object with id of '#{id}'.\",\"code\":\"SoftLayer_Exception_ObjectNotFound\"}"
  end
  response
end