Sha256: f790b11d97b647147f3a16ffaf910f510876105a6ee977ff90e27d23e2a1cef9

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

require 'rest-core'

# http://developer.github.com/v3/
module RestCore
  Github = Builder.client do
    use Timeout       , 10

    use DefaultSite   , 'https://api.github.com/'
    use DefaultHeaders, {'Accept' => 'application/json'}
    use Oauth2Query   , nil

    use CommonLogger  , nil
    use Cache         , nil, 600 do
      use ErrorHandler, lambda{ |env|
        RuntimeError.new(env[RESPONSE_BODY]['message'])}
      use ErrorDetectorHttp
      use JsonResponse, true
    end
  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)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rest-more-2.0.2 lib/rest-core/client/github.rb
rest-more-2.0.0 lib/rest-core/client/github.rb