douban-ruby 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/Gemfile.lock +12 -11
- data/History.rdoc +4 -0
- data/README.rdoc +2 -2
- data/Rakefile +1 -1
- data/douban-ruby.gemspec +1 -0
- data/lib/douban.rb +58 -58
- data/lib/douban/authorize.rb +1400 -1369
- data/lib/douban/collection.rb +69 -69
- data/lib/douban/event.rb +80 -80
- data/lib/douban/miniblog.rb +63 -63
- data/lib/douban/note.rb +60 -60
- data/lib/douban/people.rb +48 -48
- data/lib/douban/review.rb +66 -66
- data/lib/douban/subject.rb +119 -119
- data/lib/douban/version.rb +1 -1
- data/spec/douban/authorize_spec.rb +36 -5
- metadata +19 -4
data/lib/douban/version.rb
CHANGED
@@ -12,6 +12,42 @@ module Douban
|
|
12
12
|
@authorize = Authorize.new(@api_key, @secret_key)
|
13
13
|
end
|
14
14
|
|
15
|
+
context "#request_token" do
|
16
|
+
it "should works" do
|
17
|
+
@authorize.get_authorize_url
|
18
|
+
@authorize.request_token.should be_a(OAuth::RequestToken)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return OAuth::Token with :as_token param" do
|
22
|
+
@authorize.get_authorize_url
|
23
|
+
@authorize.request_token(:as_token).should be_a(OAuth::Token)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return Hash with :as_hash param" do
|
27
|
+
@authorize.get_authorize_url
|
28
|
+
res = @authorize.request_token(:as_hash)
|
29
|
+
res.should be_a(Hash)
|
30
|
+
res[:token].should be_a(String)
|
31
|
+
res[:secret].should be_a(String)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "#request_token=" do
|
36
|
+
before :each do
|
37
|
+
@request_token = "a" * 32
|
38
|
+
@request_secret = "b" * 16
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should support OAuth::Token" do
|
42
|
+
@authorize.request_token = OAuth::Token.new(@request_token, @request_secret)
|
43
|
+
@authorize.request_token.should be_a(OAuth::RequestToken)
|
44
|
+
end
|
45
|
+
it "should support Hash" do
|
46
|
+
@authorize.request_token = {:token => @request_token, :secret => @request_secret}
|
47
|
+
@authorize.request_token.should be_a(OAuth::RequestToken)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
15
51
|
context "helper" do
|
16
52
|
context "url_encode" do
|
17
53
|
it "should support integer" do
|
@@ -39,11 +75,6 @@ module Douban
|
|
39
75
|
@access_secret = "d"*16
|
40
76
|
end
|
41
77
|
|
42
|
-
it "should support set request token" do
|
43
|
-
@authorize.request_token = OAuth::Token.new(@request_token, @request_secret)
|
44
|
-
@authorize.request_token.kind_of?(OAuth::RequestToken).should == true
|
45
|
-
end
|
46
|
-
|
47
78
|
it "auth should works" do
|
48
79
|
request_token_mock = mock("request_token")
|
49
80
|
request_token_mock.stub!(:kind_of?).with(OAuth::RequestToken).and_return(true)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: douban-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- LI Daobing
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-07-13 00:00:00 +08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -92,6 +92,20 @@ dependencies:
|
|
92
92
|
version: "0"
|
93
93
|
type: :development
|
94
94
|
version_requirements: *id005
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: rdoc
|
97
|
+
prerelease: false
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
type: :development
|
108
|
+
version_requirements: *id006
|
95
109
|
description: "Douban API reference: http://www.douban.com/service/apidoc/reference/"
|
96
110
|
email:
|
97
111
|
- lidaobing@gmail.com
|
@@ -105,6 +119,7 @@ extra_rdoc_files:
|
|
105
119
|
- History.rdoc
|
106
120
|
files:
|
107
121
|
- .gitignore
|
122
|
+
- .rspec
|
108
123
|
- Gemfile
|
109
124
|
- Gemfile.lock
|
110
125
|
- History.rdoc
|