Class: Warden::Oauthed::Oauth::Proxy
- Inherits:
-
Object
- Object
- Warden::Oauthed::Oauth::Proxy
- Defined in:
- lib/warden-oauthed/proxy.rb
Instance Attribute Summary collapse
-
#callback_url ⇒ Object
Returns the value of attribute callback_url.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#oauth_domain ⇒ Object
Returns the value of attribute oauth_domain.
-
#scopes ⇒ Object
Returns the value of attribute scopes.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
- #api_for(code) ⇒ Object
- #authorize_url ⇒ Object
- #client ⇒ Object
-
#initialize(client_id, secret, scopes, oauth_domain, callback_url) ⇒ Proxy
constructor
A new instance of Proxy.
- #ssl_options ⇒ Object
Constructor Details
#initialize(client_id, secret, scopes, oauth_domain, callback_url) ⇒ Proxy
Returns a new instance of Proxy.
6 7 8 9 10 11 12 |
# File 'lib/warden-oauthed/proxy.rb', line 6 def initialize(client_id, secret, scopes, oauth_domain, callback_url) @client_id = client_id @secret = secret @scopes = scopes @oauth_domain = oauth_domain @callback_url = callback_url end |
Instance Attribute Details
#callback_url ⇒ Object
Returns the value of attribute callback_url.
5 6 7 |
# File 'lib/warden-oauthed/proxy.rb', line 5 def callback_url @callback_url end |
#client_id ⇒ Object
Returns the value of attribute client_id.
5 6 7 |
# File 'lib/warden-oauthed/proxy.rb', line 5 def client_id @client_id end |
#oauth_domain ⇒ Object
Returns the value of attribute oauth_domain.
5 6 7 |
# File 'lib/warden-oauthed/proxy.rb', line 5 def oauth_domain @oauth_domain end |
#scopes ⇒ Object
Returns the value of attribute scopes.
5 6 7 |
# File 'lib/warden-oauthed/proxy.rb', line 5 def scopes @scopes end |
#secret ⇒ Object
Returns the value of attribute secret.
5 6 7 |
# File 'lib/warden-oauthed/proxy.rb', line 5 def secret @secret end |
Instance Method Details
#api_for(code) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/warden-oauthed/proxy.rb', line 27 def api_for(code) client.auth_code.get_token( code, redirect_uri: callback_url ) end |
#authorize_url ⇒ Object
34 35 36 37 38 39 |
# File 'lib/warden-oauthed/proxy.rb', line 34 def client.auth_code.( scope: scopes, redirect_uri: callback_url ) end |
#client ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/warden-oauthed/proxy.rb', line 18 def client @client ||= OAuth2::Client.new( @client_id, @secret, ssl: , site: oauth_domain, authorize_url: '/oauth/authorize') end |
#ssl_options ⇒ Object
14 15 16 |
# File 'lib/warden-oauthed/proxy.rb', line 14 def { version: :TLSv1 } end |