module Sinatra::Auth::Oauthed::Helpers
Public Instance Methods
_relative_url_for(path)
click to toggle source
# File lib/sinatra/auth/oauthed.rb, line 71 def _relative_url_for(path) request.script_name + path end
authenticate!(*args)
click to toggle source
# File lib/sinatra/auth/oauthed.rb, line 28 def authenticate!(*args) warden.authenticate!(*args) end
authenticated?(*args)
click to toggle source
# File lib/sinatra/auth/oauthed.rb, line 32 def authenticated?(*args) warden.authenticated?(*args) end
logout!()
click to toggle source
# File lib/sinatra/auth/oauthed.rb, line 36 def logout! warden.logout end
oauthed_raw_request(path)
click to toggle source
Send a API GET request to the path defined in .env
path - the path on api.github.com to hit
Returns a rest client response object
Examples
oauthed_raw_request("/user") # => RestClient::Response
# File lib/sinatra/auth/oauthed.rb, line 54 def oauthed_raw_request(path) oauthed_user.oauthed_raw_request(path) end
oauthed_request(path)
click to toggle source
Send a API GET request to the path defined in .env and parse the response body
path - the path on api.github.com to hit
Returns a parsed JSON response
Examples
oauthed_request("/user") # => { 'login' => 'atmos', ... }
# File lib/sinatra/auth/oauthed.rb, line 67 def oauthed_request(path) oauthed_user.oauthed_request(path) end
oauthed_user()
click to toggle source
The authenticated user object
# File lib/sinatra/auth/oauthed.rb, line 41 def oauthed_user warden.user end
warden()
click to toggle source
# File lib/sinatra/auth/oauthed.rb, line 24 def warden env['warden'] end