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:
parent
20cc08082d
commit
8c0ee52e04
3 changed files with 8 additions and 6 deletions
|
@ -23,6 +23,7 @@ module Fog
|
|||
|
||||
@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)
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" }
|
||||
|
|
Loading…
Reference in a new issue