orkut 0.0.0.14 → 0.0.0.15
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/connection.rb +30 -27
- data/lib/orkut/version.rb +1 -1
- metadata +5 -5
data/lib/orkut/connection.rb
CHANGED
@@ -5,6 +5,8 @@ require 'orkut/error'
|
|
5
5
|
module Orkut
|
6
6
|
module Connection
|
7
7
|
|
8
|
+
@client = nil
|
9
|
+
|
8
10
|
def authorization_uri(options={})
|
9
11
|
client = Google::APIClient.new
|
10
12
|
|
@@ -44,38 +46,39 @@ module Orkut
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def connection(options={})
|
47
|
-
client
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
else
|
64
|
-
if !refresh_token.blank? and !access_token.blank? and !expires_in.blank? and !issued_at.blank?
|
65
|
-
client.authorization.update_token!(credentials)
|
49
|
+
if @client.nil?
|
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]
|
66
65
|
end
|
67
|
-
|
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
|
70
|
+
end
|
68
71
|
|
69
|
-
|
72
|
+
@client.authorization.fetch_access_token!
|
70
73
|
|
71
|
-
|
74
|
+
update_token_values(@client.authorization)
|
72
75
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
+
orkut = @client.discovered_api('orkut', 'v2')
|
77
|
+
unless @client.authorization.access_token
|
78
|
+
raise(Orkut::Error, 'Invalid access token')
|
79
|
+
end
|
76
80
|
end
|
77
|
-
|
78
|
-
client
|
81
|
+
@client
|
79
82
|
end
|
80
83
|
|
81
84
|
def update_token_values(object)
|
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.15
|
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: &17226180 !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: *17226180
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: multi_json
|
27
|
-
requirement: &
|
27
|
+
requirement: &17225580 !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: *17225580
|
36
36
|
description: A Ruby wrapper for the Orkut REST/RPC API.
|
37
37
|
email:
|
38
38
|
- contato@umanni.com
|