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_ips.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

41 lines
1.1 KiB
Ruby

module Fog
class Vcloud
module Terremark
class Ecloud
class Real
basic_request :get_public_ips
end
class Mock
#
# Based off of:
# http://support.theenterprisecloud.com/kb/default.asp?id=577&Lang=1&SID=
#
def get_public_ips(public_ips_uri)
public_ips_uri = ensure_unparsed(public_ips_uri)
if public_ip_collection = mock_data.public_ip_collection_from_href(public_ips_uri)
xml = Builder::XmlMarkup.new
mock_it 200,
xml.PublicIPAddresses {
public_ip_collection.items.each do |ip|
xml.PublicIPAddress {
xml.Id ip.object_id
xml.Href ip.href
xml.Name ip.name
}
end
}, { 'Content-Type' => 'application/vnd.tmrk.ecloud.publicIpsList+xml'}
else
mock_error 200, "401 Unauthorized"
end
end
end
end
end
end
end