Ruby
Ruby
Transition from Http.PTextSb to Http.HttpSb
Provides instructions for replacing deprecated PTextSb method calls with HttpSb.Chilkat Ruby Downloads
require 'chilkat'
success = false
http = Chilkat::CkHttp.new()
verb = "PUT"
url = "https://example.com/"
sbRequestBody = Chilkat::CkStringBuilder.new()
sbRequestBody.Append("This is the HTTP request body")
charset = "utf-8"
contentType = "text/plain"
# ------------------------------------------------------------------------
# The PTextSb method is deprecated:
# responseObj is a CkHttpResponse
responseObj = http.PTextSb(verb,url,sbRequestBody,charset,contentType,false,false)
if (http.get_LastMethodSuccess() == false)
print http.lastErrorText() + "\n";
exit
end
# ...
# ...
# ------------------------------------------------------------------------
# Do the equivalent using HttpSb.
# Your application creates a new, empty HttpResponse object which is passed
# in the last argument and filled upon success.
responseOut = Chilkat::CkHttpResponse.new()
success = http.HttpSb(verb,url,sbRequestBody,charset,contentType,responseOut)
if (success == false)
print http.lastErrorText() + "\n";
exit
end