doubapi 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Doubapi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/doubapi.rb CHANGED
@@ -48,8 +48,14 @@ Album = Struct.new :author, :title, :release_date, :link,:cover_thumbnail,:publ
48
48
  #Doubapi::Event[]
49
49
  def self.search_events_of h ,&block
50
50
  totalResult, returnedResult = Douban.search_events_of h
51
- returnedResult.each {|event| block.call(event) if block_given?}
52
- return totalResult;
51
+
52
+ if block_given?
53
+ returnedResult.each {|event| block.call(event) if block_given?}
54
+ return totalResult;
55
+ else
56
+ return [totalResult, returnedResult]
57
+ end
58
+
53
59
  end
54
60
 
55
61
 
@@ -58,8 +64,12 @@ end
58
64
  #return Doubapi::Album[]
59
65
  def self.search_albums_of h ,&block
60
66
  totalResult, returnedResult = Douban.search_albums_of h
61
- returnedResult.each {|album| block.call(album) if block_given?}
62
- return totalResult;
67
+ if block_given?
68
+ returnedResult.each {|album| block.call(album) }
69
+ return totalResult;
70
+ else
71
+ return [totalResult, returnedResult]
72
+ end
63
73
  end
64
74
 
65
75
  protected
data/lib/test.rb CHANGED
@@ -91,7 +91,24 @@ def test4
91
91
 
92
92
  end
93
93
 
94
- test_get_all_events
94
+ def test5
95
+
96
+ totalResults ,events = Doubapi.search_events_of(:key => "all", :location => "shanghai", :start_index => 1,:max_result => 5)
97
+
98
+ events.each do |event|
99
+ puts "#{event.when} #{event.title}"
100
+ puts event.where
101
+ puts event.link
102
+ puts event.poster_mobile
103
+ puts event.bar_icon
104
+ end
105
+
106
+ puts "totalResults #{totalResults}"
107
+
108
+ end
109
+
110
+ #test_get_all_events
95
111
  #test1
96
112
  #test2
97
113
  #test4
114
+ test5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doubapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-07-17 00:00:00.000000000 Z
12
+ date: 2012-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec