Module: Jibeset::OAuth
- Included in:
- API
- Defined in:
- lib/jibeset/oauth.rb
Overview
Defines HTTP request methods
Instance Method Summary collapse
-
#authorize_url(options = {}) ⇒ Object
Return URL for OAuth authorization.
-
#get_access_token(code, options = {}) ⇒ Object
Return an access token from authorization.
Instance Method Details
#authorize_url(options = {}) ⇒ Object
Return URL for OAuth authorization
5 6 7 8 9 10 11 |
# File 'lib/jibeset/oauth.rb', line 5 def (={}) [:response_type] ||= "code" [:redirect_uri] = oauth_callback = [:authorize_path] || "/oauth/authorize/" params = access_token_params.merge() connection.build_url(, params).to_s end |
#get_access_token(code, options = {}) ⇒ Object
Return an access token from authorization
14 15 16 17 18 19 |
# File 'lib/jibeset/oauth.rb', line 14 def get_access_token(code, ={}) [:grant_type] ||= "authorization_code" [:redirect_uri] = oauth_callback params = access_token_params.merge() post("/oauth/token/", params.merge(:code => code), false, unformatted=true) end |