Module: Devise::OmniAuth::UrlHelpers

Defined in:
lib/devise/omniauth/url_helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.define_helpers(mapping) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/devise/omniauth/url_helpers.rb', line 4

def self.define_helpers(mapping)
  return unless mapping.omniauthable?

  class_eval "    def \#{mapping.name}_omniauth_authorize_path(provider, params = {})\n      if Devise.omniauth_configs[provider.to_sym]\n        script_name = request.env[\"SCRIPT_NAME\"]\n\n        path = \"\\\#{script_name}/\#{mapping.path}/auth/\\\#{provider}\\\".squeeze(\"/\")\n        path << '?' + params.to_param if params.present?\n        path\n      else\n        raise ArgumentError, \"Could not find omniauth provider \\\#{provider.inspect}\"\n      end\n    end\n  URL_HELPERS\nend\n", __FILE__, __LINE__ + 1

Instance Method Details

#omniauth_authorize_path(resource_or_scope, *args) ⇒ Object



22
23
24
25
# File 'lib/devise/omniauth/url_helpers.rb', line 22

def omniauth_authorize_path(resource_or_scope, *args)
  scope = Devise::Mapping.find_scope!(resource_or_scope)
  send("#{scope}_omniauth_authorize_path", *args)
end

#omniauth_callback_path(resource_or_scope, *args) ⇒ Object



27
28
29
30
# File 'lib/devise/omniauth/url_helpers.rb', line 27

def omniauth_callback_path(resource_or_scope, *args)
  scope = Devise::Mapping.find_scope!(resource_or_scope)
  send("#{scope}_omniauth_callback_path", *args)
end