orkut 0.0.0.12 → 0.0.0.13
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/orkut/authenticatable.rb +5 -1
 - data/lib/orkut/connection.rb +27 -29
 - data/lib/orkut/version.rb +1 -1
 - metadata +5 -5
 
    
        data/lib/orkut/connection.rb
    CHANGED
    
    | 
         @@ -27,7 +27,7 @@ module Orkut 
     | 
|
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                  def connection_v1(options={})
         
     | 
| 
       29 
29 
     | 
    
         
             
                    access_token = nil
         
     | 
| 
       30 
     | 
    
         
            -
                    if  
     | 
| 
      
 30 
     | 
    
         
            +
                    if authenticated_v1?
         
     | 
| 
       31 
31 
     | 
    
         
             
                      client_options = {
         
     | 
| 
       32 
32 
     | 
    
         
             
                        :site => site,
         
     | 
| 
       33 
33 
     | 
    
         
             
                        :request_token_path => request_token_path,
         
     | 
| 
         @@ -45,39 +45,37 @@ module Orkut 
     | 
|
| 
       45 
45 
     | 
    
         
             
                  end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
                  def connection(options={})
         
     | 
| 
       48 
     | 
    
         
            -
                    client =  
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
                       
     | 
| 
       59 
     | 
    
         
            -
                         
     | 
| 
       60 
     | 
    
         
            -
                         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                          config.expires_in = options[:token_values][:expires_in]
         
     | 
| 
       64 
     | 
    
         
            -
                          config.issued_at = options[:token_values][:issued_at]
         
     | 
| 
       65 
     | 
    
         
            -
                        end
         
     | 
| 
       66 
     | 
    
         
            -
                      else
         
     | 
| 
       67 
     | 
    
         
            -
                          if !refresh_token.blank? and !access_token.blank? and !expires_in.blank? and !issued_at.blank?
         
     | 
| 
       68 
     | 
    
         
            -
                            client.authorization.update_token!(credentials)
         
     | 
| 
       69 
     | 
    
         
            -
                          end
         
     | 
| 
      
 48 
     | 
    
         
            +
                    client = Google::APIClient.new
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                    client.authorization.client_id     = client_id
         
     | 
| 
      
 51 
     | 
    
         
            +
                    client.authorization.client_secret = client_secret
         
     | 
| 
      
 52 
     | 
    
         
            +
                    client.authorization.scope         = scope
         
     | 
| 
      
 53 
     | 
    
         
            +
                    client.authorization.redirect_uri  = redirect_uri
         
     | 
| 
      
 54 
     | 
    
         
            +
                    client.authorization.code          = code
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                    if !options[:token_values].blank?
         
     | 
| 
      
 57 
     | 
    
         
            +
                      client.authorization.update_token!(options[:token_values])
         
     | 
| 
      
 58 
     | 
    
         
            +
                      ::Orkut.configure do |config|
         
     | 
| 
      
 59 
     | 
    
         
            +
                        config.refresh_token = options[:token_values][:refresh_token]
         
     | 
| 
      
 60 
     | 
    
         
            +
                        config.access_token = options[:token_values][:access_token]
         
     | 
| 
      
 61 
     | 
    
         
            +
                        config.expires_in = options[:token_values][:expires_in]
         
     | 
| 
      
 62 
     | 
    
         
            +
                        config.issued_at = options[:token_values][:issued_at]
         
     | 
| 
       70 
63 
     | 
    
         
             
                      end
         
     | 
| 
      
 64 
     | 
    
         
            +
                    else
         
     | 
| 
      
 65 
     | 
    
         
            +
                        if !refresh_token.blank? and !access_token.blank? and !expires_in.blank? and !issued_at.blank?
         
     | 
| 
      
 66 
     | 
    
         
            +
                          client.authorization.update_token!(credentials)
         
     | 
| 
      
 67 
     | 
    
         
            +
                        end
         
     | 
| 
      
 68 
     | 
    
         
            +
                    end
         
     | 
| 
       71 
69 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
      
 70 
     | 
    
         
            +
                    client.authorization.fetch_access_token!
         
     | 
| 
       73 
71 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 72 
     | 
    
         
            +
                    update_token_values(client.authorization)
         
     | 
| 
       75 
73 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
                      end
         
     | 
| 
      
 74 
     | 
    
         
            +
                    orkut = client.discovered_api('orkut', 'v2')
         
     | 
| 
      
 75 
     | 
    
         
            +
                    unless client.authorization.access_token
         
     | 
| 
      
 76 
     | 
    
         
            +
                      raise(Orkut::Error, 'Invalid access token')
         
     | 
| 
       80 
77 
     | 
    
         
             
                    end
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
       81 
79 
     | 
    
         
             
                    client
         
     | 
| 
       82 
80 
     | 
    
         
             
                  end
         
     | 
| 
       83 
81 
     | 
    
         | 
    
        data/lib/orkut/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: orkut
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.0.13
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -13,7 +13,7 @@ date: 2011-11-01 00:00:00.000000000Z 
     | 
|
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: omniauth
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &22422000 !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -21,10 +21,10 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: 0.3.0
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *22422000
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: multi_json
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &22421440 !ruby/object:Gem::Requirement
         
     | 
| 
       28 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -32,7 +32,7 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       33 
33 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       34 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *22421440
         
     | 
| 
       36 
36 
     | 
    
         
             
            description: A Ruby wrapper for the Orkut REST/RPC API.
         
     | 
| 
       37 
37 
     | 
    
         
             
            email:
         
     | 
| 
       38 
38 
     | 
    
         
             
            - contato@umanni.com
         
     |