Sha256: 7aa066963e6be0b07da72102095da4345756c529085423ff1021bb34059482c2

Contents?: true

Size: 680 Bytes

Versions: 14

Compression:

Stored size: 680 Bytes

Contents

class ExvoAuth::Strategies::Base < OmniAuth::Strategies::OAuth2
  def initialize(app, name, app_id, app_secret, options = {})
    options[:site] ||= ExvoAuth::Config.host
    super(app, name, app_id, app_secret, options)
  end
  
  def user_data
    @data ||= MultiJson.decode(@access_token.get('/user.json'))
  end

  def user_info
    {
      'nickname' => user_data['nickname'],
      'email'    => user_data['email']
    }.reject{ |k, v| v.nil? }
  end

  def auth_hash
    OmniAuth::Utils.deep_merge(super, {
      'provider'  => 'exvo',
      'uid'       => user_data['id'],
      'user_info' => user_info,
      'extra'     => { 'user_hash' => user_data }
    })
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
exvo-auth-0.3.4 lib/exvo_auth/strategies/base.rb
exvo-auth-0.3.3 lib/exvo_auth/strategies/base.rb
exvo-auth-0.3.2 lib/exvo_auth/strategies/base.rb
exvo-auth-0.3.1 lib/exvo_auth/strategies/base.rb
exvo-auth-0.3.0 lib/exvo_auth/strategies/base.rb
exvo-auth-0.2.2 lib/exvo_auth/strategies/base.rb
exvo-auth-0.2.1 lib/exvo_auth/strategies/base.rb
exvo-auth-0.2.0 lib/exvo_auth/strategies/base.rb
exvo-auth-0.1.7 lib/exvo_auth/strategies/base.rb
exvo-auth-0.1.6 lib/exvo_auth/strategies/base.rb
exvo-auth-0.1.5 lib/exvo_auth/strategies/base.rb
exvo-auth-0.1.4 lib/exvo_auth/strategies/base.rb
exvo-auth-0.1.3 lib/exvo_auth/strategies/base.rb
exvo-auth-0.1.2 lib/exvo_auth/strategies/base.rb