Permalink
Browse files

fuck json, use yajl

  • Loading branch information...
1 parent e65e6f0 commit 236ac78e31cb275254d80588a70ef23d82975ddd @atmos committed Jan 20, 2012
Showing with 8 additions and 6 deletions.
  1. +3 −2 lib/sinatra/auth/github.rb
  2. +2 −1 sinatra_auth_github.gemspec
  3. +3 −3 spec/app.rb
View
5 lib/sinatra/auth/github.rb
@@ -1,3 +1,4 @@
+require 'yajl'
require 'sinatra/base'
require 'warden-github'
require 'rest_client'
@@ -72,7 +73,7 @@ def github_raw_request(path)
RestClient.get("https://api.github.com/#{path}", :params => { :access_token => github_user.token }, :accept => :json)
end
- # Send a V3 API GET request to path and JSON parse the response body
+ # Send a V3 API GET request to path and parse the response body
#
# path - the path on api.github.com to hit
#
@@ -82,7 +83,7 @@ def github_raw_request(path)
# github_request("/user")
# # => { 'login' => 'atmos', ... }
def github_request(path)
- JSON.parse(github_raw_request(path))
+ Yajl.load(github_raw_request(path))
end
# See if the user is a public member of the named organization
View
3 sinatra_auth_github.gemspec
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = "sinatra_auth_github"
- s.version = "0.3.0"
+ s.version = "0.3.1"
s.platform = Gem::Platform::RUBY
s.authors = ["Corey Donohoe"]
s.email = ["atmos@atmos.org"]
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
s.rubyforge_project = "sinatra_auth_github"
s.add_dependency "sinatra", "~>1.0"
+ s.add_dependency "yajl-ruby", "~>1.1"
s.add_dependency "rest-client", "~>1.6.1"
s.add_dependency "warden-github", "~>0.3.0"
View
6 spec/app.rb
@@ -5,9 +5,9 @@ class App < Sinatra::Base
enable :sessions
set :github_options, {
- :secret => ENV['GITHUB_CLIENT_SECRET'],
- :client_id => ENV['GITHUB_CLIENT_ID'],
- }
+ :secret => ENV['GITHUB_CLIENT_SECRET'],
+ :client_id => ENV['GITHUB_CLIENT_ID'],
+ }
register Sinatra::Auth::Github

0 comments on commit 236ac78

Please sign in to comment.