1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

include /REST in all requests

This commit is contained in:
Michael Hale 2011-02-08 21:31:24 -05:00 committed by geemus
parent 20cc08082d
commit 8c0ee52e04
3 changed files with 8 additions and 6 deletions

View file

@ -21,10 +21,11 @@ module Fog
@dynect_username = options[:dynect_username]
@dynect_password = options[:dynect_password]
@host = "api2.dynect.net"
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
@version = options[:version] || '2.3.1'
@host = "api2.dynect.net"
@port = options[:port] || 443
@path = options[:path] || '/REST'
@scheme = options[:scheme] || 'https'
@version = options[:version] || '2.3.1'
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent] || true)
end
@ -33,6 +34,7 @@ module Fog
params[:headers] ||= {}
params[:headers]['Content-Type'] = 'text/xml'
params[:headers]['API-Version'] = @version
params[:path] = "#{@path}/#{params[:path]}"
response = @connection.request(params.merge!({:host => @host}))
rescue Excon::Errors::HTTPStatusError => error
raise case error

View file

@ -17,7 +17,7 @@ module Fog
:parser => Fog::Parsers::Dynect::DNS::Session.new,
:expects => 200,
:method => "POST",
:path => "/REST/Session/",
:path => "Session",
:body => xml
)
end

View file

@ -1,6 +1,6 @@
Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
tests( 'success') do
test ('start api session') do
test "start api session" do
response = Dynect[:dns].session
returns(true) { response.body['API-Token'] =~ /.+=$/ && true }
returns(true) { response.body['API-Version'] == "2.3.1" }