Permalink
Browse files

Use multi_json instead of yajl-ruby.

  • Loading branch information...
1 parent 3a5e016 commit 516ed7e3cbc79fcbeceab638f16843807af10c33 @tristandunn tristandunn committed Dec 5, 2012
Showing with 8 additions and 8 deletions.
  1. +2 −2 Gemfile.lock
  2. +1 −1 bartender.gemspec
  3. +1 −1 lib/bartender.rb
  4. +3 −3 lib/bartender/request.rb
  5. +1 −1 spec/bartender/request_spec.rb
View
@@ -2,7 +2,7 @@ PATH
remote: .
specs:
bartender (0.5.0)
- yajl-ruby (= 1.1.0)
+ multi_json (= 1.4.0)
GEM
remote: http://rubygems.org/
@@ -13,6 +13,7 @@ GEM
metaclass (0.0.1)
mocha (0.13.0)
metaclass (~> 0.0.1)
+ multi_json (1.4.0)
rake (10.0.2)
rspec (2.12.0)
rspec-core (~> 2.12.0)
@@ -22,7 +23,6 @@ GEM
rspec-expectations (2.12.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.0)
- yajl-ruby (1.1.0)
yard (0.8.3)
PLATFORMS
View
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.test_files = Dir["spec/**/*"].to_a
s.require_path = "lib"
- s.add_dependency "yajl-ruby", "1.1.0"
+ s.add_dependency "multi_json", "1.4.0"
s.add_development_dependency "bourne", "1.3.0"
s.add_development_dependency "rake", "10.0.2"
View
@@ -1,4 +1,4 @@
-require "yajl"
+require "multi_json"
require "bartender/configuration"
require "bartender/request"
@@ -22,7 +22,7 @@ def self.get(path, options = {})
case response.code.to_i
when 200
- Yajl::Parser.parse(response.body)
+ MultiJson.load(response.body)
else
false
end
@@ -31,13 +31,13 @@ def self.get(path, options = {})
def self.post(path, attributes = {}, options = {})
options[:token] ||= Bartender.configuration.private_token
- response = request.post(uri(path, options), Yajl::Encoder.encode(attributes), "Content-Type" => "application/json")
+ response = request.post(uri(path, options), MultiJson.dump(attributes), "Content-Type" => "application/json")
case response.code.to_i
when 201
response["Location"]
when 400
- Yajl::Parser.parse(response.body)["errors"]
+ MultiJson.load(response.body)["errors"]
else
false
end
@@ -103,7 +103,7 @@
it "makes an API request" do
Bartender::Request.post("/", :name => "Example")
- request.should have_received(:post).with("/", Yajl::Encoder.encode({ :name => "Example" }), headers)
+ request.should have_received(:post).with("/", MultiJson.dump({ :name => "Example" }), headers)
end
it "returns the location header for a created response" do

0 comments on commit 516ed7e

Please sign in to comment.