Module: Instagram::OAuth
- Defined in:
- lib/instagram/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/instagram/oauth.rb', line 5 def ( = {}) [:response_type] ||= "code" [:scope] ||= scope if !scope.nil? && !scope.empty? [:redirect_uri] ||= redirect_uri params = .merge() connection.build_url("/oauth/authorize/", params).to_s end |
#get_access_token(code, options = {}) ⇒ Object
Return an access token from authorization
14 15 16 17 18 19 |
# File 'lib/instagram/oauth.rb', line 14 def get_access_token(code, = {}) [:grant_type] ||= "authorization_code" [:redirect_uri] ||= redirect_uri params = access_token_params.merge() post("/oauth/access_token/", params.merge(code: code), signature = false, raw = false, unformatted = true, no_response_wrapper = true) end |