'access_token'.freeze
'Authorization'.freeze
Utils::Url::DEFAULT_QUERY_SEP, Utils::Url::KEY_VALUE_SEP
Instance Method Summary collapseA new instance of OAuth2.
#build_query, #escape, #escape_uri, #normalize, #parse_query, #parse_query_for_param, #unescape
Constructor Details #initialize(app, *args) ⇒ OAuth2Returns a new instance of OAuth2.
29 30 31 32 33
# File 'lib/github_api/request/oauth2.rb', line 29 def initialize(app, *args) super app @app = app @token = args.shift endInstance Method Details #call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27
# File 'lib/github_api/request/oauth2.rb', line 17 def call(env) params = { ACCESS_TOKEN => @token }.update query_params(env[:url]) if token = params[ACCESS_TOKEN] and !token.empty? env[:url].query = build_query params env[:request_headers].merge!(AUTH_HEADER => "token #{token}") end @app.call env end#query_params(url) ⇒ Object
35 36 37 38 39 40 41
# File 'lib/github_api/request/oauth2.rb', line 35 def query_params(url) if url.query.nil? or url.query.empty? {} else parse_query url.query end end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4