Sha256: db5f1e1796466f94d9c1d28b9cf48be8382e712af1a2acd11478ca068f6d60f2

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'omniauth_china/oauth_china'

module OmniAuth
  module Strategies
    class Renren
      include OmniAuth::Strategy
      autoload :Session, 'omniauth_china/strategies/renren/session'
      autoload :Service, 'omniauth_china/strategies/renren/service'
      autoload :Helper,  'omniauth_china/strategies/renren/helper'

      class << self
        def api_key
          @@api_key
        end

        def secret_key
          @@secret_key
        end
      end

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

        super(app, :renren, options)
      end

      def request_phase
        @response.finish
      end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omniauth_china-0.0.6 lib/omniauth_china/strategies/renren.rb
omniauth_china-0.0.5 lib/omniauth_china/strategies/renren.rb
omniauth_china-0.0.4.beta1 lib/omniauth_china/strategies/renren.rb