Module: RubyInstagram::OAuth
- Included in:
- API
- Defined in:
- lib/ruby_instagram/oauth.rb
Constant Summary collapse
- OAUTH_ENDPOINT =
'https://api.instagram.com/'
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
7 8 9 10 11 12 13 14 |
# File 'lib/ruby_instagram/oauth.rb', line 7 def ( = {}) send('endpoint=', OAUTH_ENDPOINT) [:response_type] ||= 'code' [:redirect_uri] ||= [:redirect_uri] [:scope] ||= scope params = .merge() connection.build_url('/oauth/authorize/', params).to_s end |
#get_access_token(code, options = {}) ⇒ Object
Return an access token from authorization
17 18 19 20 21 22 23 |
# File 'lib/ruby_instagram/oauth.rb', line 17 def get_access_token(code, = {}) send('endpoint=', OAUTH_ENDPOINT) [:grant_type] ||= 'authorization_code' [:redirect_uri] ||= redirect_uri params = access_token_params.merge() post('/oauth/access_token/', params.merge(code: code)) end |