douban-ruby 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ .config
2
+ *.swp
3
+ /pkg
4
+ .project
5
+ *~
6
+ doc
7
+ *#
8
+ /pkg
9
+ coverage
10
+ html
11
+ .bundle
12
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source :gemcutter
2
+
3
+ gem 'oauth'
4
+ group :development, :test do
5
+ gem 'rspec', '~> 1.3.0'
6
+ gem 'rcov'
7
+ gem 'rake'
8
+ end
@@ -0,0 +1,16 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ oauth (0.4.3)
5
+ rake (0.8.7)
6
+ rcov (0.9.9)
7
+ rspec (1.3.0)
8
+
9
+ PLATFORMS
10
+ ruby
11
+
12
+ DEPENDENCIES
13
+ oauth
14
+ rake
15
+ rcov
16
+ rspec (~> 1.3.0)
@@ -1,3 +1,7 @@
1
+ === 0.0.7 / 2010-09-23
2
+ * Douban::Authorize
3
+ * get_miniblog_comments support start_index and max_results option.
4
+
1
5
  === 0.0.6 / 2010-07-10
2
6
  * Douban::Authorize
3
7
  * add verify_token and delete_token
data/README.txt CHANGED
@@ -14,7 +14,7 @@ Douban API reference: http://www.douban.com/service/apidoc/reference/
14
14
 
15
15
  == INSTALL:
16
16
 
17
- sudo rake install_gem
17
+ gem install douban-ruby
18
18
 
19
19
  == Usage:
20
20
 
data/Rakefile CHANGED
@@ -1,30 +1,15 @@
1
1
  require 'rubygems'
2
- require 'hoe'
3
- $:.unshift(File.dirname(__FILE__) + "/lib")
4
- require 'douban'
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
- task :release => :verify
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
+
@@ -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
@@ -50,8 +50,4 @@
50
50
  # http://code.google.com/p/doubanclient-ruby/
51
51
 
52
52
  require 'douban/authorize'
53
-
54
- module Douban
55
- VERSION = "0.0.6"
56
- end
57
-
53
+ require 'douban/version'
@@ -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(obj) => MiniblogComments or nil
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
- resp = get("/miniblog/#{u miniblog_id}/comments")
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
@@ -0,0 +1,3 @@
1
+ module Douban
2
+ VERSION = '0.0.7'
3
+ end
@@ -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
@@ -1,3 +1,4 @@
1
1
  $: << File.join(File.dirname(__FILE__), '/../lib')
2
2
 
3
+ require 'bundler/setup'
3
4
  require 'spec'
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
- - 6
9
- version: 0.0.6
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-07-10 00:00:00 +08:00
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
- - 2
44
+ - 1
45
+ - 0
63
46
  - 0
64
- - 4
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
- version: 2.6.1
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
- description: |-
83
- douban ruby client. including OAuth support.
84
-
85
- Douban API reference: http://www.douban.com/service/apidoc/reference/
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
- - History.txt
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://github.com/lidaobing/douban-ruby
154
+ homepage: http://rubygems.org/gems/douban-ruby
141
155
  licenses: []
142
156
 
143
157
  post_install_message:
144
- rdoc_options:
145
- - --main
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
- - 0
162
- version: "0"
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.6
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
@@ -1,2 +0,0 @@
1
- �E�g'Ƃ��7�I� M����҉*=��5Gg1�؋�����Ӡu�9H�a'َ�
2
- �}H&6�O>��-jH�Ǯ���dѼ�3&��*Qn([�O��1��(�r:O��8�e�rt��.�� ��&z}RZ�id� ੢Vq�_H#m��rΨ6}��N����U2&9�� >��HbY���o�La�TD� Vu��n�G�l�6v�j�⪶�6�`�ߟ�˛Q(���y�������R�5�73����%;����F����
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��