douban_api 0.1.1 → 0.1.2
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/.yardopts +4 -0
- data/lib/douban_api/configuration.rb +4 -2
- data/lib/douban_api/oauth.rb +8 -0
- data/lib/douban_api/version.rb +1 -1
- metadata +4 -3
data/.yardopts
ADDED
@@ -11,6 +11,7 @@ module Douban
|
|
11
11
|
:client_id,
|
12
12
|
:client_secret,
|
13
13
|
:access_token,
|
14
|
+
:refresh_token,
|
14
15
|
:endpoint,
|
15
16
|
:format,
|
16
17
|
:user_agent,
|
@@ -38,9 +39,9 @@ module Douban
|
|
38
39
|
# By default, don't set an application redirect uri
|
39
40
|
DEFAULT_REDIRECT_URI = nil
|
40
41
|
|
41
|
-
# By default, don't set a user access token
|
42
|
+
# By default, don't set a user access token and refresh token
|
42
43
|
DEFAULT_ACCESS_TOKEN = nil
|
43
|
-
|
44
|
+
DEFAULT_REFRESH_TOKEN = nil
|
44
45
|
# The endpoint that will be used to connect if none is set
|
45
46
|
#
|
46
47
|
# @note There is no reason to use any other endpoint at this time
|
@@ -83,6 +84,7 @@ module Douban
|
|
83
84
|
self.client_id = DEFAULT_CLIENT_ID
|
84
85
|
self.client_secret = DEFAULT_CLIENT_SECRET
|
85
86
|
self.access_token = DEFAULT_ACCESS_TOKEN
|
87
|
+
self.refresh_token = DEFAULT_REFRESH_TOKEN
|
86
88
|
self.endpoint = DEFAULT_ENDPOINT
|
87
89
|
self.format = DEFAULT_FORMAT
|
88
90
|
self.user_agent = DEFAULT_USER_AGENT
|
data/lib/douban_api/oauth.rb
CHANGED
@@ -15,6 +15,14 @@ module Douban
|
|
15
15
|
post("https://www.douban.com/service/auth2/token", params.merge(:code => code), raw=false)
|
16
16
|
end
|
17
17
|
|
18
|
+
def refresh(options={})
|
19
|
+
options[:grant_type] ||= "refresh_token"
|
20
|
+
params = access_token_params.merge(options)
|
21
|
+
post("https://www.douban.com/service/auth2/token",
|
22
|
+
params.merge(:refresh_token => refresh_token),
|
23
|
+
raw=false)
|
24
|
+
end
|
25
|
+
|
18
26
|
private
|
19
27
|
|
20
28
|
def access_token_params
|
data/lib/douban_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: douban_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -208,6 +208,7 @@ extensions: []
|
|
208
208
|
extra_rdoc_files: []
|
209
209
|
files:
|
210
210
|
- .gitignore
|
211
|
+
- .yardopts
|
211
212
|
- Gemfile
|
212
213
|
- LICENSE.md
|
213
214
|
- README.md
|
@@ -252,7 +253,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
252
253
|
version: '0'
|
253
254
|
segments:
|
254
255
|
- 0
|
255
|
-
hash:
|
256
|
+
hash: 4460312008487973802
|
256
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
258
|
none: false
|
258
259
|
requirements:
|