omniauth-renren 1.0.0.rc2 → 1.0.0.rc2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/omniauth-renren/version.rb +1 -1
- data/lib/omniauth/strategies/renren.rb +14 -10
- metadata +4 -3
| @@ -8,21 +8,19 @@ module OmniAuth | |
| 8 8 | 
             
                  option :client_options, {
         | 
| 9 9 | 
             
                    :authorize_url => 'http://graph.renren.com/oauth/authorize',
         | 
| 10 10 | 
             
                    :token_url => 'http://graph.renren.com/oauth/token',
         | 
| 11 | 
            +
                    :site => 'http://graph.renren.com'
         | 
| 11 12 | 
             
                  }
         | 
| 12 | 
            -
                  def request_phase
         | 
| 13 | 
            -
                    super
         | 
| 14 | 
            -
                  end
         | 
| 15 13 |  | 
| 16 14 | 
             
                  uid { raw_info['uid'] }
         | 
| 17 15 |  | 
| 18 16 | 
             
                  info do
         | 
| 19 17 | 
             
                    {
         | 
| 20 18 | 
             
                      "uid" => raw_info["uid"], 
         | 
| 21 | 
            -
                      "gender"=> (raw_info[ | 
| 22 | 
            -
                      "image"=>raw_info[ | 
| 19 | 
            +
                      "gender"=> (raw_info["sex"] == 1 ? 'Male' : 'Female'), 
         | 
| 20 | 
            +
                      "image"=>raw_info["headurl"],
         | 
| 23 21 | 
             
                      'name' => raw_info['name'],
         | 
| 24 22 | 
             
                      'urls' => {
         | 
| 25 | 
            -
                        ' | 
| 23 | 
            +
                        'Renren' => "http://www.renren.com/profile.do?id="+raw_info["uid"].to_s
         | 
| 26 24 | 
             
                      }
         | 
| 27 25 | 
             
                    }
         | 
| 28 26 | 
             
                  end
         | 
| @@ -41,7 +39,8 @@ module OmniAuth | |
| 41 39 | 
             
                  end
         | 
| 42 40 |  | 
| 43 41 | 
             
                  def session_key
         | 
| 44 | 
            -
                     | 
| 42 | 
            +
                    response = @access_token.get('/renren_api/session_key', {:params => {:oauth_token => @access_token.token}})
         | 
| 43 | 
            +
                    @session_key ||= MultiJson.decode(response.response.env[:body])
         | 
| 45 44 | 
             
                  end
         | 
| 46 45 |  | 
| 47 46 | 
             
                  def request_phase
         | 
| @@ -51,9 +50,12 @@ module OmniAuth | |
| 51 50 |  | 
| 52 51 | 
             
                  def build_access_token
         | 
| 53 52 | 
             
                    if renren_session.nil? || renren_session.empty?
         | 
| 54 | 
            -
                       | 
| 53 | 
            +
                      verifier = request.params['code']
         | 
| 54 | 
            +
                      self.access_token = client.auth_code.get_token(verifier, {:redirect_uri => callback_url}.merge(options))
         | 
| 55 | 
            +
                      puts self.access_token.inspect
         | 
| 56 | 
            +
                      self.access_token
         | 
| 55 57 | 
             
                    else
         | 
| 56 | 
            -
                       | 
| 58 | 
            +
                      self.access_token = ::OAuth2::AccessToken.new(client, renren_session['access_token'])
         | 
| 57 59 | 
             
                    end
         | 
| 58 60 | 
             
                  end
         | 
| 59 61 |  | 
| @@ -67,7 +69,9 @@ module OmniAuth | |
| 67 69 | 
             
                  end
         | 
| 68 70 |  | 
| 69 71 | 
             
                  def raw_info
         | 
| 70 | 
            -
                     | 
| 72 | 
            +
                    response = Net::HTTP.post_form(URI.parse('http://api.renren.com/restserver.do'), signed_params).body
         | 
| 73 | 
            +
                    puts response.inspect
         | 
| 74 | 
            +
                    @raw_info ||= MultiJson.decode(response)[0]
         | 
| 71 75 | 
             
                    puts @raw_info.inspect
         | 
| 72 76 | 
             
                    @raw_info
         | 
| 73 77 | 
             
                  rescue ::Errno::ETIMEDOUT
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,15 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: omniauth-renren
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 1955881117
         | 
| 5 5 | 
             
              prerelease: true
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 1
         | 
| 8 8 | 
             
              - 0
         | 
| 9 9 | 
             
              - 0
         | 
| 10 10 | 
             
              - rc2
         | 
| 11 | 
            -
               | 
| 11 | 
            +
              - 1
         | 
| 12 | 
            +
              version: 1.0.0.rc2.1
         | 
| 12 13 | 
             
            platform: ruby
         | 
| 13 14 | 
             
            authors: 
         | 
| 14 15 | 
             
            - Scott Ballantyne
         | 
| @@ -16,7 +17,7 @@ autorequire: | |
| 16 17 | 
             
            bindir: bin
         | 
| 17 18 | 
             
            cert_chain: []
         | 
| 18 19 |  | 
| 19 | 
            -
            date: 2011-11- | 
| 20 | 
            +
            date: 2011-11-07 00:00:00 +08:00
         | 
| 20 21 | 
             
            default_executable: 
         | 
| 21 22 | 
             
            dependencies: 
         | 
| 22 23 | 
             
            - !ruby/object:Gem::Dependency 
         |