doubapi 0.0.5 → 0.0.6
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/README +20 -0
- data/lib/doubapi/version.rb +1 -1
- data/lib/doubapi.rb +8 -2
- data/spec/doubapi_spec.rb +10 -0
- metadata +3 -3
data/README
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
Usage:
|
2
|
+
require 'doubapi'
|
3
|
+
|
4
|
+
key = "许巍"
|
5
|
+
Doubapi.search_events_of(key).each do |event|
|
6
|
+
puts event.title
|
7
|
+
puts event.when
|
8
|
+
puts event.where
|
9
|
+
puts event.link
|
10
|
+
end
|
11
|
+
|
12
|
+
author = "李志"
|
13
|
+
Doubapi.search_albums_of(author, "2010-05").each do |album|
|
14
|
+
puts album.author
|
15
|
+
puts album.release_date
|
16
|
+
puts album.title
|
17
|
+
puts album.link
|
18
|
+
end
|
19
|
+
|
20
|
+
|
data/lib/doubapi/version.rb
CHANGED
data/lib/doubapi.rb
CHANGED
@@ -92,8 +92,14 @@ def self.search_albums_of artist , after_date = "1900.01"
|
|
92
92
|
r = release_date.scan(/\d{1,4}/)
|
93
93
|
#if DD was not specified
|
94
94
|
r << "01" if r.size == 2
|
95
|
-
r << "01" << "01" if r.size == 1
|
96
|
-
|
95
|
+
r << "01" << "01" if r.size == 1
|
96
|
+
|
97
|
+
y , m , d = r
|
98
|
+
|
99
|
+
m = "01" unless (1..12).include?(m.to_i)
|
100
|
+
d = "01" unless (1..30).include?(d.to_i)
|
101
|
+
|
102
|
+
formated_release_day = "#{y}-#{m}-#{d}"
|
97
103
|
#check the release date
|
98
104
|
if compare_date release_date, after_date
|
99
105
|
albums << Douban_Album.new(author, title, formated_release_day, link)
|
data/spec/doubapi_spec.rb
CHANGED
@@ -47,5 +47,15 @@ describe Doubapi do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
|
50
|
+
it "should not return NULL release_date " do
|
51
|
+
author = "小河"
|
52
|
+
Doubapi.search_albums_of(author, "2010/01").each do |album|
|
53
|
+
puts album.author
|
54
|
+
puts album.release_date
|
55
|
+
puts album.title
|
56
|
+
puts album.link
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
50
60
|
|
51
61
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doubapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- pierr chen
|