From 8c0ee52e04d92091c7fa26cc740311754f710874 Mon Sep 17 00:00:00 2001 From: Michael Hale Date: Tue, 8 Feb 2011 21:31:24 -0500 Subject: [PATCH] include /REST in all requests --- lib/fog/dns/dynect.rb | 10 ++++++---- lib/fog/dns/requests/dynect/session.rb | 2 +- tests/dns/requests/dynect/dns_tests.rb | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/fog/dns/dynect.rb b/lib/fog/dns/dynect.rb index a64f6e621..84efd7168 100644 --- a/lib/fog/dns/dynect.rb +++ b/lib/fog/dns/dynect.rb @@ -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 diff --git a/lib/fog/dns/requests/dynect/session.rb b/lib/fog/dns/requests/dynect/session.rb index 0ca51f530..a8773d5e0 100644 --- a/lib/fog/dns/requests/dynect/session.rb +++ b/lib/fog/dns/requests/dynect/session.rb @@ -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 diff --git a/tests/dns/requests/dynect/dns_tests.rb b/tests/dns/requests/dynect/dns_tests.rb index afc6c362b..5e59d6b51 100644 --- a/tests/dns/requests/dynect/dns_tests.rb +++ b/tests/dns/requests/dynect/dns_tests.rb @@ -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" }