# File lib/omniauth.rb, line 26 def self.default_logger logger = Logger.new(STDOUT) logger.progname = "omniauth" logger end
# File lib/omniauth.rb, line 51 def self.defaults @@defaults end
# File lib/omniauth.rb, line 55 def initialize @@defaults.each_pair{|k,v| self.send("#{k}=",v)} end
This is a convenience method to be used by strategy authors so that they can add special cases to the camelization utility method that allows OmniAuth::Builder to work.
@param name [String] The underscored name, e.g. `oauth` @param camelized [String] The properly camelized name, e.g. ‘OAuth’
# File lib/omniauth.rb, line 94 def add_camelization(name, camelized) self.camelizations[name.to_s] = camelized.to_s end
# File lib/omniauth.rb, line 67 def add_mock(provider, mock={}) # Stringify keys recursively one level. mock.keys.each do |key| mock[key.to_s] = mock.delete(key) end mock.each_pair do |key, val| if val.is_a? Hash val.keys.each do |subkey| val[subkey.to_s] = val.delete(subkey) end end end # Merge with the default mock and ensure provider is correct. mock = self.mock_auth[:default].dup.merge(mock) mock["provider"] = provider.to_s # Add it to the mocks. self.mock_auth[provider.to_sym] = mock end
# File lib/omniauth.rb, line 59 def on_failure(&block) if block_given? @on_failure = block else @on_failure end end