class OmniAuth::Strategies::Slooob

Constants

DEFAULT_SCOPE

Public Instance Methods

authorize_params() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/slooob.rb, line 19
def authorize_params
    super.tap do |params|
        options[:authorize_options].each do |k|
            params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
        end

        params[:scope] = get_scope params

        session['omniauth.state'] = params[:state] if params[:state]
    end
end
raw_info() click to toggle source
# File lib/omniauth/strategies/slooob.rb, line 57
def raw_info
    @raw_info ||= access_token.get('/identity/v1/resource.json').parsed
end

Private Instance Methods

callback_url() click to toggle source

github.com/intridea/omniauth-oauth2/issues/81

# File lib/omniauth/strategies/slooob.rb, line 66
def callback_url
    options[:redirect_uri] || (full_host + script_name + callback_path)
end
get_scope(params) click to toggle source
# File lib/omniauth/strategies/slooob.rb, line 77
def get_scope params
    raw_scope = params[:scope] || DEFAULT_SCOPE
    scope_list = raw_scope.split(' ').map { |item| item.split(',') }.flatten
    scope_list.map! { |s| s =~ %r{^https?://} }
    scope_list.join(' ')
end
image_url() click to toggle source
# File lib/omniauth/strategies/slooob.rb, line 84
def image_url
    return nil unless raw_info['avatar']

    image_size = options[:image_size] || 'raw'
    image_url = raw_info['avatar'].has_key?(image_size) ? raw_info['avatar'][image_size] : raw_info['avatar']

    return image_url
end
prune!(hash) click to toggle source
# File lib/omniauth/strategies/slooob.rb, line 70
def prune! hash
    hash.delete_if do |_, v|
        prune!(v) if v.is_a?(Hash)
        v.nil? || (v.respond_to?(:empty?) && v.empty?)
    end
end