Skip to content

Commit

Permalink
Merge pull request #64 from winebarrel/use_multi_json
Browse files Browse the repository at this point in the history
Use MultiJSON
  • Loading branch information
yannmh committed Mar 16, 2015
2 parents 4c6b515 + ae6155d commit 8f4e460
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dogapi.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
'--main' << 'README.rdoc' <<
'--line-numbers' << '--inline-source'

spec.add_dependency 'json', '>= 1.5.1'
spec.add_dependency 'multi_json'

spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake', '~> 10'
Expand Down
8 changes: 4 additions & 4 deletions lib/dogapi/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require 'uri'

require 'rubygems'
require 'json'
require 'multi_json'

module Dogapi

Expand Down Expand Up @@ -52,7 +52,7 @@ def request(method, url, params)
req.set_form_data params
resp = conn.request(req)
begin
resp_obj = JSON.parse(resp.body)
resp_obj = MultiJson.load(resp.body)
rescue
raise 'Invalid JSON Response: ' + resp.body
end
Expand Down Expand Up @@ -128,15 +128,15 @@ def request(method, url, params, body, send_json)

if send_json
req.content_type = 'application/json'
req.body = JSON.generate(body)
req.body = MultiJson.dump(body)
end

resp = conn.request(req)
resp_str = resp.body

if resp.code != 204 and resp.body != '' and resp.body != 'null' and resp.body != nil
begin
resp_obj = JSON.parse(resp.body)
resp_obj = MultiJson.load(resp.body)
rescue
raise 'Invalid JSON Response: ' + resp.body
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dogapi/event.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'net/http'

require 'rubygems'
require 'json'
require 'multi_json'

module Dogapi

Expand Down
2 changes: 1 addition & 1 deletion lib/dogapi/metric.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'net/http'

require 'rubygems'
require 'json'
require 'multi_json'

module Dogapi

Expand Down

0 comments on commit 8f4e460

Please sign in to comment.