lib/rforce.rb in activesalesforce-0.1.2 vs lib/rforce.rb in activesalesforce-0.1.3
- old
+ new
@@ -153,17 +153,21 @@
@session_id = ''
@batch_size = DEFAULT_BATCH_SIZE
end
+ def show_debug
+ $DEBUG or ENV['SHOWSOAP']
+ end
+
def init_server(url)
@url = URI.parse(url)
@server = Net::HTTP.new(@url.host, @url.port)
@server.use_ssl = @url.scheme == 'https'
# run ruby with -d to see SOAP wiredumps.
- @server.set_debug_output $stderr if $DEBUG
+ @server.set_debug_output $stderr if show_debug
end
#Log in to the server and remember the session ID
#returned to us by SalesForce.
def login(user, password)
@@ -206,11 +210,11 @@
'Content-Type' => 'text/xml',
'SOAPAction' => '""',
'User-Agent' => 'ActiveSalesforce RForce'
}
- unless $DEBUG
+ unless show_debug
headers['Accept-Encoding'] = 'gzip'
headers['Content-Encoding'] = 'gzip'
end
#Send the request to the server and read the response.
@@ -256,10 +260,10 @@
end
end
# encode gzip
def encode(request)
- return request if $DEBUG
+ return request if show_debug
begin
ostream = StringIO.new
gzw = Zlib::GzipWriter.new(ostream)
gzw.write(request)