orkut_os_client 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/orkut/client.rb +4 -0
- data/lib/orkut/config.rb +13 -0
- data/lib/orkut/connect/connect.rb +2 -1
- data/lib/orkut/connect/request.rb +22 -0
- data/lib/orkut/version.rb +1 -1
- data/lib/orkut_os_client.rb +6 -0
- data/spec/keys.copy +10 -0
- data/spec/orkut_spec.rb +14 -4
- metadata +7 -4
data/lib/orkut/client.rb
CHANGED
@@ -10,10 +10,14 @@ module Orkut
|
|
10
10
|
require "orkut/client/scraps"
|
11
11
|
require "orkut/client/albums"
|
12
12
|
|
13
|
+
require "orkut/connect/request"
|
14
|
+
|
13
15
|
include Orkut::Client::Profile
|
14
16
|
include Orkut::Client::Friends
|
15
17
|
include Orkut::Client::Scraps
|
16
18
|
include Orkut::Client::Albums
|
19
|
+
|
20
|
+
include Orkut::Connect::Request
|
17
21
|
|
18
22
|
attr_accessor *Config::VALID_OPTIONS_KEYS
|
19
23
|
|
data/lib/orkut/config.rb
CHANGED
@@ -6,12 +6,19 @@ module Orkut
|
|
6
6
|
# The endpoint that will be used to connect if none is set
|
7
7
|
DEFAULT_RPC_ENDPOINT = 'http://sandbox.orkut.com/social/rpc'
|
8
8
|
|
9
|
+
# The consumer key if none is set
|
10
|
+
DEFAULT_CONSUMER_KEY = nil
|
11
|
+
|
12
|
+
# The consumer secret if none is set
|
13
|
+
DEFAULT_CONSUMER_SECRET = nil
|
14
|
+
|
9
15
|
# An array of valid keys in the options hash when configuring a {Orkut::Client}
|
10
16
|
VALID_OPTIONS_KEYS = [
|
11
17
|
:consumer_key,
|
12
18
|
:consumer_secret,
|
13
19
|
:oauth_token,
|
14
20
|
:oauth_token_secret,
|
21
|
+
:callback_url
|
15
22
|
]
|
16
23
|
|
17
24
|
attr_accessor *VALID_OPTIONS_KEYS
|
@@ -22,6 +29,12 @@ module Orkut
|
|
22
29
|
VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}
|
23
30
|
options
|
24
31
|
end
|
32
|
+
|
33
|
+
# Convenience method to allow configuration options to be set in a block
|
34
|
+
def configure
|
35
|
+
yield self
|
36
|
+
self
|
37
|
+
end
|
25
38
|
|
26
39
|
end
|
27
40
|
end
|
@@ -5,7 +5,8 @@ module Orkut
|
|
5
5
|
class Connect
|
6
6
|
|
7
7
|
# generic consumer initializer
|
8
|
-
def initialize_consumer(client)
|
8
|
+
def initialize_consumer(client=nil)
|
9
|
+
|
9
10
|
OAuth::Consumer.new( client.consumer_key, client.consumer_secret,
|
10
11
|
:site => "https://www.google.com",
|
11
12
|
:request_token_path => "/accounts/OAuthGetRequestToken",
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Orkut
|
2
|
+
class Connect
|
3
|
+
module Request
|
4
|
+
|
5
|
+
# get authorization url
|
6
|
+
# connecting as first provider
|
7
|
+
def request_token
|
8
|
+
consumer = Orkut::Connect.new.initialize_consumer self
|
9
|
+
get_request_token consumer, self.callback_url
|
10
|
+
end
|
11
|
+
|
12
|
+
# request token by callback
|
13
|
+
def get_request_token(consumer, callback)
|
14
|
+
request_token = consumer.get_request_token({
|
15
|
+
:scope => 'http://orkut.gmodules.com/social/rest',
|
16
|
+
:oauth_callback => callback},
|
17
|
+
:scope => 'http://orkut.gmodules.com/social')
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/orkut/version.rb
CHANGED
data/lib/orkut_os_client.rb
CHANGED
data/spec/keys.copy
ADDED
data/spec/orkut_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "helper"
|
2
|
+
require "keys"
|
2
3
|
|
3
4
|
describe Orkut do
|
4
5
|
|
@@ -8,10 +9,10 @@ describe Orkut do
|
|
8
9
|
# stub_post("").
|
9
10
|
# to_return(:body => fixture("profile.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
10
11
|
|
11
|
-
@orkut = Orkut.new(:consumer_key =>
|
12
|
-
:consumer_secret =>
|
13
|
-
:oauth_token =>
|
14
|
-
:oauth_token_secret =>
|
12
|
+
@orkut = Orkut.new(:consumer_key => Access::Keys::CONSUMER_KEY,
|
13
|
+
:consumer_secret => Access::Keys::CONSUMER_SECRET,
|
14
|
+
:oauth_token => Access::Keys::OAUTH_TOKEN,
|
15
|
+
:oauth_token_secret => Access::Keys::OAUTH_TOKEN_SECRET)
|
15
16
|
|
16
17
|
end
|
17
18
|
|
@@ -40,6 +41,15 @@ describe Orkut do
|
|
40
41
|
data = @orkut.albums
|
41
42
|
data.should_not be_nil
|
42
43
|
end
|
44
|
+
|
45
|
+
it "should get data with one auth" do
|
46
|
+
data = @orkut.profile
|
47
|
+
data.should_not be_nil
|
48
|
+
data = @orkut.scraps
|
49
|
+
data.should_not be_nil
|
50
|
+
data = @orkut.albums
|
51
|
+
data.should_not be_nil
|
52
|
+
end
|
43
53
|
|
44
54
|
end
|
45
55
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orkut_os_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Anderson Leite
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-29 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: A Ruby wrapper for the Orkut RPC-JSON API.
|
@@ -36,12 +36,14 @@ files:
|
|
36
36
|
- lib/orkut/client.rb
|
37
37
|
- lib/orkut/config.rb
|
38
38
|
- lib/orkut/connect/connect.rb
|
39
|
+
- lib/orkut/connect/request.rb
|
39
40
|
- lib/orkut/oauth.rb
|
40
41
|
- lib/orkut/rpc.rb
|
41
42
|
- lib/orkut/version.rb
|
42
43
|
- lib/orkut_os_client.rb
|
43
44
|
- spec/fixtures/profile.json
|
44
45
|
- spec/helper.rb
|
46
|
+
- spec/keys.copy
|
45
47
|
- spec/orkut_spec.rb
|
46
48
|
homepage: https://github.com/andersonleite/orkut_os_client
|
47
49
|
licenses: []
|
@@ -89,4 +91,5 @@ summary: Orkut RPC-JSON API wrapper
|
|
89
91
|
test_files:
|
90
92
|
- spec/fixtures/profile.json
|
91
93
|
- spec/helper.rb
|
94
|
+
- spec/keys.copy
|
92
95
|
- spec/orkut_spec.rb
|