Class: Warden::Bootic::Oauth::Proxy
- Inherits:
-
Object
- Object
- Warden::Bootic::Oauth::Proxy
- Defined in:
- lib/warden-bootic/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.
-
#scopes ⇒ Object
Returns the value of attribute scopes.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
- #access_token_for(code) ⇒ Object
- #authorize_url ⇒ Object
- #client ⇒ Object
-
#initialize(client_id, secret, scopes, callback_url) ⇒ Proxy
constructor
A new instance of Proxy.
- #ssl_options ⇒ Object
- #web_server ⇒ Object
Constructor Details
#initialize(client_id, secret, scopes, callback_url) ⇒ Proxy
Returns a new instance of Proxy.
6 7 8 |
# File 'lib/warden-bootic/proxy.rb', line 6 def initialize(client_id, secret, scopes, callback_url) @client_id, @secret, @scopes, @callback_url = client_id, secret, scopes, callback_url end |
Instance Attribute Details
#callback_url ⇒ Object
Returns the value of attribute callback_url.
5 6 7 |
# File 'lib/warden-bootic/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-bootic/proxy.rb', line 5 def client_id @client_id end |
#scopes ⇒ Object
Returns the value of attribute scopes.
5 6 7 |
# File 'lib/warden-bootic/proxy.rb', line 5 def scopes @scopes end |
#secret ⇒ Object
Returns the value of attribute secret.
5 6 7 |
# File 'lib/warden-bootic/proxy.rb', line 5 def secret @secret end |
Instance Method Details
#access_token_for(code) ⇒ Object
27 28 29 |
# File 'lib/warden-bootic/proxy.rb', line 27 def access_token_for(code) web_server.get_access_token(code, :redirect_uri => callback_url) end |
#authorize_url ⇒ Object
31 32 33 34 35 36 |
# File 'lib/warden-bootic/proxy.rb', line 31 def web_server.( :scope => scopes, :redirect_uri => callback_url ) end |
#client ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/warden-bootic/proxy.rb', line 19 def client @client ||= OAuth2::Client.new(@client_id, @secret, :ssl => , :site => Warden::Bootic::API_URL, :authorize_path => '/oauth/authorize', :access_token_path => '/oauth/token') end |
#ssl_options ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/warden-bootic/proxy.rb', line 10 def ca_file = "/usr/lib/ssl/certs/ca-certificates.crt" if File.exists?(ca_file) { :ca_file => ca_file } else { :ca_file => ''} end end |
#web_server ⇒ Object
38 39 40 |
# File 'lib/warden-bootic/proxy.rb', line 38 def web_server client.web_server end |