lib/baabedo.rb in baabedo-0.0.3 vs lib/baabedo.rb in baabedo-0.0.4
- old
+ new
@@ -94,11 +94,11 @@
payload = nil
else
if headers[:content_type] && headers[:content_type] == "multipart/form-data"
payload = params
else
- payload = uri_encode(params)
+ payload = JSON.generate(params)
end
end
request_opts.update(:headers => request_headers(access_token).update(headers),
:method => method, :open_timeout => 30,
@@ -167,10 +167,10 @@
def self.handle_api_error(rcode, rbody)
begin
error_obj = JSON.parse(rbody)
error_obj = Util.symbolize_names(error_obj)
- error = error_obj[:error] or raise BaabedoError.new # escape from parsing
+ error = error_obj or raise BaabedoError.new # escape from parsing
rescue JSON::ParserError, BaabedoError
raise general_api_error(rcode, rbody)
end