require 'rest-core' # http://developer.github.com/v3/ RestCore::Github = RestCore::Builder.client do s = self.class # this is only for ruby 1.8! use s::Timeout , 10 use s::DefaultSite , 'https://api.github.com/' use s::DefaultHeaders, {'Accept' => 'application/json'} use s::Oauth2Query , nil use s::CommonLogger , nil use s::Cache , nil, 600 do use s::ErrorHandler, lambda{|env| raise env[s::RESPONSE_BODY]['message']} use s::ErrorDetectorHttp use s::JsonDecode , true end end module RestCore::Github::Client include RestCore def me query={}, opts={} get('user', query, opts) end end RestCore::Github.send(:include, RestCore::Github::Client) require 'rest-core/client/github/rails_util' if Object.const_defined?(:Rails)