lib/warden-oauthed/proxy.rb in warden-oauthed-0.0.3 vs lib/warden-oauthed/proxy.rb in warden-oauthed-0.0.4
- old
+ new
@@ -2,31 +2,40 @@
module Oauthed
module Oauth
class Proxy
attr_accessor :client_id, :secret, :scopes, :oauth_domain, :callback_url
def initialize(client_id, secret, scopes, oauth_domain, callback_url)
- @client_id, @secret, @scopes, @oauth_domain, @callback_url = 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
def ssl_options
{ version: :TLSv1 }
end
def client
- @client ||= OAuth2::Client.new(@client_id, @secret,
+ @client ||= OAuth2::Client.new(
+ @client_id,
+ @secret,
ssl: ssl_options,
site: oauth_domain,
authorize_url: '/oauth/authorize')
end
def api_for(code)
- client.auth_code.get_token(code, :redirect_uri => callback_url)
+ client.auth_code.get_token(
+ code,
+ redirect_uri: callback_url
+ )
end
def authorize_url
client.auth_code.authorize_url(
- :scope => scopes,
- :redirect_uri => callback_url
+ scope: scopes,
+ redirect_uri: callback_url
)
end
end
end
end