1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/vcloud/terremark/ecloud/requests/get_public_ip.rb
Dan Peterson c29a72ccd1 Rework vCloud mocking to use mock objects instead of a Hash.
Make some mock behavior reflect reality at Terremark.

Add mocks for Terremark configure_vapp and delete_vapp.
2010-11-05 08:56:50 +08:00

36 lines
1,018 B
Ruby

module Fog
class Vcloud
module Terremark
class Ecloud
class Real
basic_request :get_public_ip
end
class Mock
#
#Based off of:
#http://support.theenterprisecloud.com/kb/default.asp?id=567&Lang=1&SID=
#
def get_public_ip(public_ip_uri)
public_ip_uri = ensure_unparsed(public_ip_uri)
if public_ip = mock_data.public_ip_from_href(public_ip_uri)
xml = Builder::XmlMarkup.new
mock_it 200,
xml.PublicIp(:xmlns => "urn:tmrk:eCloudExtensions-2.0", :"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance") {
xml.Id public_ip.object_id
xml.Href public_ip.href
xml.Name public_ip.name
}, { 'Content-Type' => 'application/vnd.tmrk.ecloud.publicIp+xml' }
else
mock_error 200, "401 Unauthorized"
end
end
end
end
end
end
end