2012-02-21 04:29:36 -05:00
|
|
|
require 'uri'
|
|
|
|
|
2012-02-10 10:10:49 -05:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Joyent
|
|
|
|
class Mock
|
|
|
|
|
|
|
|
def get_package(name)
|
|
|
|
if pkg = self.data[:packages][name]
|
|
|
|
response = Excon::Response.new
|
|
|
|
response.body = pkg
|
|
|
|
response.status = 200
|
|
|
|
response
|
|
|
|
else
|
|
|
|
raise Excon::Errors::NotFound
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Real
|
|
|
|
def get_package(name)
|
2012-02-21 04:29:36 -05:00
|
|
|
name = URI.escape(name)
|
2012-02-10 10:10:49 -05:00
|
|
|
request(
|
|
|
|
:method => "GET",
|
2012-02-21 04:29:36 -05:00
|
|
|
:path => "/my/packages/#{name}",
|
|
|
|
:expects => 200
|
2012-02-10 10:10:49 -05:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|