oauth_china 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +32 -43
- data/lib/oauth_china/version.rb +1 -1
- data/lib/oauth_china.rb +1 -4
- metadata +3 -3
data/README
CHANGED
@@ -1,49 +1,38 @@
|
|
1
1
|
一.简介:
|
2
|
-
|
2
|
+
|
3
|
+
OAuth gem for rails,支持豆瓣,新浪微薄,qq微薄
|
3
4
|
|
4
5
|
二.安装:
|
5
|
-
|
6
|
+
|
7
|
+
$ gem install oauth_china
|
6
8
|
|
7
9
|
三.使用:
|
8
10
|
|
9
|
-
1. 在Gemfile里添加:
|
10
|
-
|
11
|
-
gem 'oauth_china'
|
12
|
-
|
13
|
-
2. 添加配置文件
|
14
|
-
|
15
|
-
config/oauth/douban.yml
|
16
|
-
config/oauth/sina.yml
|
17
|
-
config/oauth/qq.yml
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
#resp1 = sina.get("http://open.t.qq.com/api/user/info?format=json")
|
38
|
-
resp = sina.get("/account/verify_credentials.xml")
|
39
|
-
render :text => resp.body
|
40
|
-
else
|
41
|
-
sina = OauthChina::Sina.new
|
42
|
-
url = sina.authorize_url
|
43
|
-
Rails.cache.write(sina.oauth_token, sina.dump)
|
44
|
-
redirect_to url
|
45
|
-
end
|
46
|
-
|
47
|
-
腾讯微博API文档:http://open.t.qq.com/resource.php?i=1,1
|
48
|
-
新浪微博API文档:http://open.t.sina.com.cn/wiki/index.php/API%E6%96%87%E6%A1%A3
|
49
|
-
豆瓣微博API文档:http://www.douban.com/service/apidoc/reference/
|
11
|
+
1. 在Gemfile里添加:
|
12
|
+
|
13
|
+
gem 'oauth_china'
|
14
|
+
|
15
|
+
2. 添加配置文件
|
16
|
+
|
17
|
+
config/oauth/douban.yml
|
18
|
+
config/oauth/sina.yml
|
19
|
+
config/oauth/qq.yml
|
20
|
+
|
21
|
+
配置文件格式:
|
22
|
+
development:
|
23
|
+
key: "you api key"
|
24
|
+
secret: "your secret"
|
25
|
+
url: "http://yoursite.com"
|
26
|
+
callback: "http://localhost:3000/your_callback_url"
|
27
|
+
production:
|
28
|
+
key: "you api key"
|
29
|
+
secret: "your secret"
|
30
|
+
url: "http://yoursite.com"
|
31
|
+
callback: "http://localhost:3000/your_callback_url"
|
32
|
+
|
33
|
+
3.演示[TODO]
|
34
|
+
|
35
|
+
四.API文档
|
36
|
+
腾讯微博API文档:http://open.t.qq.com/resource.php?i=1,1
|
37
|
+
新浪微博API文档:http://open.t.sina.com.cn/wiki/index.php/API%E6%96%87%E6%A1%A3
|
38
|
+
豆瓣微博API文档:http://www.douban.com/service/apidoc/reference/
|
data/lib/oauth_china/version.rb
CHANGED
data/lib/oauth_china.rb
CHANGED
@@ -29,11 +29,8 @@ module OauthChina
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.load(data)
|
32
|
-
access_token = data[:access_token]
|
33
|
-
access_token_secret = data[:access_token_secret]
|
34
|
-
|
35
32
|
oauth = self.new(data[:request_token], data[:request_token_secret])
|
36
|
-
oauth.access_token = ::OAuth::AccessToken.new(consumer, access_token, access_token_secret) if access_token
|
33
|
+
oauth.access_token = ::OAuth::AccessToken.new(oauth.consumer, data[:access_token], data[:access_token_secret]) if data[:access_token] && data[:access_token_secret]
|
37
34
|
oauth
|
38
35
|
end
|
39
36
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth_china
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Hooopo
|