orkut 0.0.0.12 → 0.0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,11 @@ module Orkut
26
26
  #
27
27
  # @return [Boolean]
28
28
  def authenticated?
29
- credentials.values.all? and credentials_v1.values.all?
29
+ credentials.values.all?
30
+ end
31
+
32
+ def authenticated_v1?
33
+ credentials_v1.values.all?
30
34
  end
31
35
 
32
36
  end
@@ -27,7 +27,7 @@ module Orkut
27
27
 
28
28
  def connection_v1(options={})
29
29
  access_token = nil
30
- if authenticated?
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 = nil
49
- if authenticated?
50
- client = Google::APIClient.new
51
-
52
- client.authorization.client_id = client_id
53
- client.authorization.client_secret = client_secret
54
- client.authorization.scope = scope
55
- client.authorization.redirect_uri = redirect_uri
56
- client.authorization.code = code
57
-
58
- if !options[:token_values].blank?
59
- client.authorization.update_token!(options[:token_values])
60
- ::Orkut.configure do |config|
61
- config.refresh_token = options[:token_values][:refresh_token]
62
- config.access_token = options[:token_values][:access_token]
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
- client.authorization.fetch_access_token!
70
+ client.authorization.fetch_access_token!
73
71
 
74
- update_token_values(client.authorization)
72
+ update_token_values(client.authorization)
75
73
 
76
- orkut = client.discovered_api('orkut', 'v2')
77
- unless client.authorization.access_token
78
- raise(Orkut::Error, 'Invalid access token')
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
 
@@ -14,7 +14,7 @@ module Orkut
14
14
  end
15
15
 
16
16
  def self.pre
17
- 12 #nil
17
+ 13 #nil
18
18
  end
19
19
 
20
20
  def self.to_s
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.12
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: &25962960 !ruby/object:Gem::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: *25962960
24
+ version_requirements: *22422000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: multi_json
27
- requirement: &25962360 !ruby/object:Gem::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: *25962360
35
+ version_requirements: *22421440
36
36
  description: A Ruby wrapper for the Orkut REST/RPC API.
37
37
  email:
38
38
  - contato@umanni.com