class OmniAuth::Strategies::Surveymonkey
Constants
- DEFAULT_GRANT
- DEFAULT_RESPONSE_TYPE
Public Instance Methods
build_access_token()
click to toggle source
# File lib/omniauth/strategies/surveymonkey.rb, line 26 def build_access_token verifier = request.params['code'] token = client.auth_code.get_token(verifier, token_params) end
callback_path()
click to toggle source
# File lib/omniauth/strategies/surveymonkey.rb, line 79 def callback_path @callback_path ||= begin path = options[:callback_path] if options[:callback_path].is_a?(String) path ||= current_path if options[:callback_path].respond_to?(:call) && options[:callback_path].call(env) path ||= custom_path(:request_path) path ||= "#{path_prefix}/#{name}/callback" path end end
callback_phase()
click to toggle source
# File lib/omniauth/strategies/surveymonkey.rb, line 31 def callback_phase options[:client_options][:token_url] = "/oauth/token?api_key=#{options[:api_key]}" self.access_token = build_access_token self.env['omniauth.auth'] = auth_hash call_app! rescue ::OAuth2::Error, CallbackError => e fail!(:invalid_credentials, e) rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e fail!(:timeout, e) rescue ::SocketError => e fail!(:failed_to_connect, e) end
callback_url()
click to toggle source
# File lib/omniauth/strategies/surveymonkey.rb, line 53 def callback_url full_host + script_name + callback_path# + query_string end
full_host()
click to toggle source
# File lib/omniauth/strategies/surveymonkey.rb, line 57 def full_host case OmniAuth.config.full_host when String OmniAuth.config.full_host when Proc OmniAuth.config.full_host.call(env) else # in Rack 1.3.x, request.url explodes if scheme is nil if request.scheme && request.url.match(URI::ABS_URI) uri = URI.parse(request.url.gsub(/\?.*$/, '')) uri.path = '' # sometimes the url is actually showing http inside rails because the # other layers (like nginx) have handled the ssl termination. uri.scheme = 'https' if ssl? # rubocop:disable BlockNesting uri.to_s else '' end end end
query_string()
click to toggle source
# File lib/omniauth/strategies/surveymonkey.rb, line 88 def query_string request.query_string.empty? ? '' : "?#{request.query_string}" end
script_name()
click to toggle source
# File lib/omniauth/strategies/surveymonkey.rb, line 76 def script_name @env['SCRIPT_NAME'] || '' end
token_params()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/surveymonkey.rb, line 44 def token_params super.tap do |params| params[:grant_type] ||= DEFAULT_GRANT params[:client_id] = options[:client_id] params[:client_secret] = options[:client_secret] params[:redirect_uri] = callback_url end end