lib/groupdocs/api/helpers/rest_helper.rb in groupdocs-1.5.7 vs lib/groupdocs/api/helpers/rest_helper.rb in groupdocs-1.5.8
- old
+ new
@@ -36,23 +36,35 @@
options[:headers][:content_length] = options[:request_body].length
end
end
#
+ # Changed in release 1.5.8
+ #
# Sends request to API server.
#
# @api private
#
def send_request
+
self.response = case options[:method]
when :get, :download
resource[options[:path]].get(options[:headers])
when :post
resource[options[:path]].post(options[:request_body], options[:headers])
when :put
resource[options[:path]].put(options[:request_body], options[:headers])
when :delete
- resource[options[:path]].delete(options[:headers])
+ if options[:request_body]
+ url = GroupDocs.api_server + options[:path]
+ RestClient::Request.execute(options.merge(
+ :method => :delete,
+ :url => url,
+ :payload => options[:request_body],
+ :headers => options[:headers]))
+ else
+ resource[options[:path]].delete(options[:headers])
+ end
else
raise UnsupportedMethodError, "Unsupported HTTP method: #{options[:method].inspect}"
end
end