lib/groupdocs/api/helpers/rest_helper.rb in groupdocs-1.2.11 vs lib/groupdocs/api/helpers/rest_helper.rb in groupdocs-1.3.0
- old
+ new
@@ -5,13 +5,13 @@
module Api
module Helpers
module REST
DEFAULT_HEADERS = {
- accept: 'application/json',
- content_length: 0,
- groupdocs_referrer: "ruby/#{VERSION}"
+ :accept => 'application/json',
+ :content_length => 0,
+ :groupdocs_referrer => "ruby/#{VERSION}"
}
private
#
@@ -24,11 +24,11 @@
options[:headers].merge!(DEFAULT_HEADERS)
else
options[:headers] = DEFAULT_HEADERS.dup
end
- options[:method] = options[:method].downcase.to_sym
+ options[:method] = options[:method].to_s.downcase.to_sym
if options[:request_body] && !options[:request_body].is_a?(Object::File)
unless options[:plain]
options[:request_body] = options[:request_body].to_json
options[:headers][:content_type]= 'application/json'
@@ -66,10 +66,10 @@
# for DOWNLOAD requests, just return response
if options[:method] == :download
response
# for all other requests, parse JSON
else
- json = JSON.parse(response, symbolize_names: true)
+ json = JSON.parse(response, :symbolize_names => true)
json[:status] == 'Ok' ? json[:result] : raise_bad_request_error(json)
end
end
#