Class: OmniAuth::Strategies::Renren

Inherits:
Object
  • Object
show all
Includes:
OmniAuth::Strategy
Defined in:
lib/omniauth_china/strategies/renren.rb,
lib/omniauth_china/strategies/renren/helper.rb,
lib/omniauth_china/strategies/renren/service.rb,
lib/omniauth_china/strategies/renren/session.rb

Defined Under Namespace

Modules: Helper Classes: Service, Session

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, api_key, secret_key, options = {}) ⇒ Renren

Returns a new instance of Renren.



21
22
23
24
25
26
# File 'lib/omniauth_china/strategies/renren.rb', line 21

def initialize(app, api_key, secret_key, options = {})
  @@api_key = api_key
  @@secret_key = secret_key

  super(app, :renren, options)
end

Class Method Details

.api_keyObject



12
13
14
# File 'lib/omniauth_china/strategies/renren.rb', line 12

def api_key
  @@api_key
end

.secret_keyObject



16
17
18
# File 'lib/omniauth_china/strategies/renren.rb', line 16

def secret_key
  @@secret_key
end

Instance Method Details

#auth_hashObject



37
38
39
40
41
42
43
44
45
# File 'lib/omniauth_china/strategies/renren.rb', line 37

def auth_hash
  OmniAuth::Utils.deep_merge(super, {
    'uid' => @renren_session.uid,
    'user_info' => @renren_session.user,
    'extra' => {
      'renren_session' => @renren_session
    }
  })
end

#callback_phaseObject



32
33
34
35
# File 'lib/omniauth_china/strategies/renren.rb', line 32

def callback_phase
  @renren_session = Renren::Session.new(request.cookies)
  super
end

#request_phaseObject



28
29
30
# File 'lib/omniauth_china/strategies/renren.rb', line 28

def request_phase
  @response.finish
end