douban-ruby 0.0.6 → 0.0.7
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/.gitignore +12 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +16 -0
- data/History.txt +4 -0
- data/README.txt +1 -1
- data/Rakefile +17 -21
- data/douban-ruby.gemspec +26 -0
- data/lib/douban.rb +1 -5
- data/lib/douban/authorize.rb +14 -4
- data/lib/douban/version.rb +3 -0
- data/spec/douban/authorize_spec.rb +10 -0
- data/spec/spec_helper.rb +1 -0
- metadata +73 -54
- data.tar.gz.sig +0 -2
- metadata.gz.sig +0 -1
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/History.txt
CHANGED
data/README.txt
CHANGED
data/Rakefile
CHANGED
@@ -1,30 +1,15 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
3
|
-
|
4
|
-
require '
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'spec/rake/spectask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
require File.expand_path("../lib/douban/version", __FILE__)
|
5
6
|
|
6
7
|
ENV["SPEC_OPTS"] ||= "-f nested --color -b"
|
7
8
|
ENV["RDOC_OPTS"] ||= "-c UTF-8"
|
8
9
|
|
9
|
-
Hoe.spec 'douban-ruby' do
|
10
|
-
developer "LI Daobing", "lidaobing@gmail.com"
|
11
|
-
developer "Hoooopo", "hoooopo@gmail.com"
|
12
|
-
extra_deps << ['oauth']
|
13
|
-
end
|
14
|
-
|
15
|
-
Hoe.plugin :minitest
|
16
|
-
Hoe.plugin :git
|
17
|
-
Hoe.plugin :gemcutter
|
18
|
-
|
19
|
-
desc "Simple require on packaged files to make sure they are all there"
|
20
|
-
task :verify => :package do
|
21
|
-
# An error message will be displayed if files are missing
|
22
|
-
if system %(ruby -e "require 'pkg/douban-#{Douban::VERSION}/lib/douban'")
|
23
|
-
puts "\nThe library files are present"
|
24
|
-
end
|
25
|
-
end
|
26
10
|
|
27
|
-
|
11
|
+
Spec::Rake::SpecTask.new :spec
|
12
|
+
task :default => :spec
|
28
13
|
|
29
14
|
namespace :spec do
|
30
15
|
desc "Run specs with RCov"
|
@@ -38,3 +23,14 @@ end
|
|
38
23
|
Rake::RDocTask.new do |rd|
|
39
24
|
rd.options << "--charset" << "UTF-8"
|
40
25
|
end
|
26
|
+
|
27
|
+
desc 'build gem file'
|
28
|
+
task :build do
|
29
|
+
system "gem build douban-ruby.gemspec"
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'upload gem file'
|
33
|
+
task :release => :build do
|
34
|
+
system "gem push douban-ruby-#{Douban::VERSION}"
|
35
|
+
end
|
36
|
+
|
data/douban-ruby.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path("../lib/douban/version", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "douban-ruby"
|
6
|
+
s.version = Douban::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ['LI Daobing', 'Hoooopo']
|
9
|
+
s.email = ['lidaobing@gmail.com', 'hoooopo@gmail.com']
|
10
|
+
s.homepage = "http://rubygems.org/gems/douban-ruby"
|
11
|
+
s.summary = "douban ruby client. including OAuth support."
|
12
|
+
s.description = "Douban API reference: http://www.douban.com/service/apidoc/reference/"
|
13
|
+
|
14
|
+
s.required_rubygems_version = ">= 1.3.6"
|
15
|
+
s.rubyforge_project = "douban-ruby"
|
16
|
+
|
17
|
+
s.add_dependency "oauth"
|
18
|
+
s.add_development_dependency "bundler", ">= 1.0.0"
|
19
|
+
s.add_development_dependency 'rspec', '~> 1.3.0'
|
20
|
+
s.add_development_dependency 'rake'
|
21
|
+
s.add_development_dependency 'rcov'
|
22
|
+
|
23
|
+
s.files = `git ls-files`.split("\n")
|
24
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
25
|
+
s.require_path = 'lib'
|
26
|
+
end
|
data/lib/douban.rb
CHANGED
data/lib/douban/authorize.rb
CHANGED
@@ -584,17 +584,27 @@ module Douban
|
|
584
584
|
end
|
585
585
|
|
586
586
|
# :call-seq:
|
587
|
-
# get_miniblog_comments(aMiniblog) => MiniblogComments or nil
|
588
|
-
# get_miniblog_comments(
|
587
|
+
# get_miniblog_comments(aMiniblog, options) => MiniblogComments or nil
|
588
|
+
# get_miniblog_comments(miniblog_id, options) => MiniblogComments or nil
|
589
589
|
#
|
590
590
|
# 获取我说回复 (http://goo.gl/nTZK)
|
591
|
-
def get_miniblog_comments(miniblog)
|
591
|
+
def get_miniblog_comments(miniblog, options={})
|
592
592
|
miniblog_id = case miniblog
|
593
593
|
when Miniblog then miniblog.miniblog_id
|
594
594
|
else miniblog
|
595
595
|
end
|
596
596
|
|
597
|
-
|
597
|
+
url = "/miniblog/#{u miniblog_id}/comments?"
|
598
|
+
if options[:start_index]
|
599
|
+
url << "start-index=#{u options[:start_index]}&"
|
600
|
+
end
|
601
|
+
if options[:max_results]
|
602
|
+
url << "max-results=#{u options[:max_results]}&"
|
603
|
+
end
|
604
|
+
|
605
|
+
url = url[0..-2]
|
606
|
+
|
607
|
+
resp = get(url)
|
598
608
|
if resp.code == "200"
|
599
609
|
MiniblogComments.new(resp.body)
|
600
610
|
else
|
@@ -145,6 +145,16 @@ module Douban
|
|
145
145
|
comments.comments.size.should >= 2
|
146
146
|
comments.comments[0].id.should_not == comments.comments[-1].id
|
147
147
|
end
|
148
|
+
|
149
|
+
it "should support start_index" do
|
150
|
+
comments1 = @authorize.get_miniblog_comments(378744647)
|
151
|
+
comments2 = @authorize.get_miniblog_comments(378744647, :start_index => 2)
|
152
|
+
comments1.comments[1].id.should == comments2.comments[0].id
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should support max_results" do
|
156
|
+
@authorize.get_miniblog_comments(378744647, :max_results=>1).comments.size.should == 1
|
157
|
+
end
|
148
158
|
end
|
149
159
|
|
150
160
|
context "create_miniblog_comment" do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,88 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: douban-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- LI Daobing
|
13
14
|
- Hoooopo
|
14
15
|
autorequire:
|
15
16
|
bindir: bin
|
16
|
-
cert_chain:
|
17
|
-
- |
|
18
|
-
-----BEGIN CERTIFICATE-----
|
19
|
-
MIIDNDCCAhygAwIBAgIBADANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlsaWRh
|
20
|
-
b2JpbmcxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
21
|
-
bTAeFw0xMDA3MDUwMTQyMzBaFw0xMTA3MDUwMTQyMzBaMEAxEjAQBgNVBAMMCWxp
|
22
|
-
ZGFvYmluZzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
23
|
-
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz9rM9tD8waaF+i8p
|
24
|
-
uffNz+cdxV+WzKFNCcgVxWllDL66Iu0nu8jUAo7NiCLSFxTdGs7lxn4Ae3kZFDuo
|
25
|
-
GsKnyKIYs43ymLSCpsekLKz5FQYC20PMqQG0KrvEX9Spf8NzK8G0Mx/eVXAOpftc
|
26
|
-
gEeuEuWjoIJj2i5DhP4Qb6hzbD4BxMXAXXVKfp6kmoNO2r+D5iIWtbapcnTb+0TK
|
27
|
-
raViTWxLen8Kqtl5Uv9PKwS3ina7Aw1VsE2O/VCDf/EXtejlNg5gZBCEi/MUBZiO
|
28
|
-
Ixnsmmz5dZ6GD/3x2QMMzMT5cDjajmI5Bu82iNciheEivUAOSg/FleqZ+4NwgRaX
|
29
|
-
ZFN0SwIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
30
|
-
z99knQ+R+sPVx9ygLg2IpRoUooYwDQYJKoZIhvcNAQEFBQADggEBAMBWOwbspUhj
|
31
|
-
uw7tMBMl9CYD6oW4+Uj0KoQINSDpp7e5ZdH6tr475CRacMozf16EQyp3KWxtPjAc
|
32
|
-
EPdQq6MsZ8EG/kAV70vyxnoiBd9L4iMn4vO6V6g8vd7v+oOuovwAmRkxV3lWJ/7J
|
33
|
-
JyNaGogxE72enpZelbGSnlkOWwyoABhywDZR+81NNRGSv03D0Th+EC7UlEKrf5wc
|
34
|
-
tVbDRYkA5s8F3oI6vYFEd18oSZIQudhIhiqq28ygrWhxwrPefi6JwD/AV/9D/Kph
|
35
|
-
nbIYUGvMgEiXY19FaZUnadkN21vz/FHjg0C8kkHqplzxOgiP9A78ngIdrFwM04fX
|
36
|
-
odexk8E9/2c=
|
37
|
-
-----END CERTIFICATE-----
|
17
|
+
cert_chain: []
|
38
18
|
|
39
|
-
date: 2010-
|
19
|
+
date: 2010-09-23 00:00:00 +08:00
|
40
20
|
default_executable:
|
41
21
|
dependencies:
|
42
22
|
- !ruby/object:Gem::Dependency
|
43
|
-
name: oauth
|
44
|
-
prerelease: false
|
45
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
46
25
|
requirements:
|
47
26
|
- - ">="
|
48
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
49
29
|
segments:
|
50
30
|
- 0
|
51
31
|
version: "0"
|
52
32
|
type: :runtime
|
33
|
+
name: oauth
|
34
|
+
prerelease: false
|
53
35
|
version_requirements: *id001
|
54
36
|
- !ruby/object:Gem::Dependency
|
55
|
-
name: rubyforge
|
56
|
-
prerelease: false
|
57
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
58
39
|
requirements:
|
59
40
|
- - ">="
|
60
41
|
- !ruby/object:Gem::Version
|
42
|
+
hash: 23
|
61
43
|
segments:
|
62
|
-
-
|
44
|
+
- 1
|
45
|
+
- 0
|
63
46
|
- 0
|
64
|
-
|
65
|
-
version: 2.0.4
|
47
|
+
version: 1.0.0
|
66
48
|
type: :development
|
49
|
+
name: bundler
|
50
|
+
prerelease: false
|
67
51
|
version_requirements: *id002
|
68
52
|
- !ruby/object:Gem::Dependency
|
69
|
-
name: hoe
|
70
|
-
prerelease: false
|
71
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
72
55
|
requirements:
|
73
|
-
- -
|
56
|
+
- - ~>
|
74
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 27
|
75
59
|
segments:
|
76
|
-
- 2
|
77
|
-
- 6
|
78
60
|
- 1
|
79
|
-
|
61
|
+
- 3
|
62
|
+
- 0
|
63
|
+
version: 1.3.0
|
80
64
|
type: :development
|
65
|
+
name: rspec
|
66
|
+
prerelease: false
|
81
67
|
version_requirements: *id003
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
type: :development
|
79
|
+
name: rake
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
type: :development
|
93
|
+
name: rcov
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: *id005
|
96
|
+
description: "Douban API reference: http://www.douban.com/service/apidoc/reference/"
|
86
97
|
email:
|
87
98
|
- lidaobing@gmail.com
|
88
99
|
- hoooopo@gmail.com
|
@@ -90,15 +101,17 @@ executables: []
|
|
90
101
|
|
91
102
|
extensions: []
|
92
103
|
|
93
|
-
extra_rdoc_files:
|
94
|
-
|
95
|
-
- Manifest.txt
|
96
|
-
- README.txt
|
104
|
+
extra_rdoc_files: []
|
105
|
+
|
97
106
|
files:
|
107
|
+
- .gitignore
|
108
|
+
- Gemfile
|
109
|
+
- Gemfile.lock
|
98
110
|
- History.txt
|
99
111
|
- Manifest.txt
|
100
112
|
- README.txt
|
101
113
|
- Rakefile
|
114
|
+
- douban-ruby.gemspec
|
102
115
|
- examples/example.rb
|
103
116
|
- lib/douban.rb
|
104
117
|
- lib/douban/author.rb
|
@@ -118,6 +131,7 @@ files:
|
|
118
131
|
- lib/douban/review.rb
|
119
132
|
- lib/douban/subject.rb
|
120
133
|
- lib/douban/tag.rb
|
134
|
+
- lib/douban/version.rb
|
121
135
|
- spec/douban/author_spec.rb
|
122
136
|
- spec/douban/authorize_spec.rb
|
123
137
|
- spec/douban/collection_spec.rb
|
@@ -137,35 +151,40 @@ files:
|
|
137
151
|
- spec/douban_spec.rb
|
138
152
|
- spec/spec_helper.rb
|
139
153
|
has_rdoc: true
|
140
|
-
homepage: http://
|
154
|
+
homepage: http://rubygems.org/gems/douban-ruby
|
141
155
|
licenses: []
|
142
156
|
|
143
157
|
post_install_message:
|
144
|
-
rdoc_options:
|
145
|
-
|
146
|
-
- README.txt
|
158
|
+
rdoc_options: []
|
159
|
+
|
147
160
|
require_paths:
|
148
161
|
- lib
|
149
162
|
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
150
164
|
requirements:
|
151
165
|
- - ">="
|
152
166
|
- !ruby/object:Gem::Version
|
167
|
+
hash: 3
|
153
168
|
segments:
|
154
169
|
- 0
|
155
170
|
version: "0"
|
156
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
157
173
|
requirements:
|
158
174
|
- - ">="
|
159
175
|
- !ruby/object:Gem::Version
|
176
|
+
hash: 23
|
160
177
|
segments:
|
161
|
-
-
|
162
|
-
|
178
|
+
- 1
|
179
|
+
- 3
|
180
|
+
- 6
|
181
|
+
version: 1.3.6
|
163
182
|
requirements: []
|
164
183
|
|
165
184
|
rubyforge_project: douban-ruby
|
166
|
-
rubygems_version: 1.3.
|
185
|
+
rubygems_version: 1.3.7
|
167
186
|
signing_key:
|
168
187
|
specification_version: 3
|
169
|
-
summary: douban ruby client
|
188
|
+
summary: douban ruby client. including OAuth support.
|
170
189
|
test_files: []
|
171
190
|
|
data.tar.gz.sig
DELETED
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
����v~�l�C��GZ�!���S�d���q�5/���ՈK<[����Eޟ�����K_S�=��u7z��'7��ZՕO�"`&��ѷ���-�FV���qib��͋}#�_��+C2R�p�D1���^���/9��Y�E�'J�l&{�{[��/�q��u��G��h��a�6�L([�߭��(7"���c`E��l���0�����K^v�J%_�Bh�`�h3�"�g�#����?x����ʝ�L�1�Z��
|