Module: Doubapi
- Defined in:
- lib/doubapi.rb,
lib/doubapi/version.rb
Overview
at_xpath is to return single element and you know only there is only one element. xpath is to return an array of elements
Defined Under Namespace
Classes: Album, Douban, Event, Track
Constant Summary collapse
- VERSION =
"0.1.4"
Class Method Summary collapse
-
.search_albums_of(h, &block) ⇒ Object
input :singer,:since return total number of events satisfying the search criterion return Doubapi::Album[].
-
.search_events_of(h, &block) ⇒ Object
input:=> “all/singer_name”, :location => “shanghai”, :start_index => 16,:max_result => 15 return total number of events satisfying the search criterion Doubapi::Event[].
Class Method Details
.search_albums_of(h, &block) ⇒ Object
input :singer,:since return total number of events satisfying the search criterion return Doubapi::Album[]
69 70 71 72 73 74 75 76 77 |
# File 'lib/doubapi.rb', line 69 def self.search_albums_of h ,&block totalResult, returnedResult = Douban.search_albums_of_v2 h if block_given? returnedResult.each {|album| block.call(album) } return totalResult; else return [totalResult, returnedResult] end end |
.search_events_of(h, &block) ⇒ Object
input:=> “all/singer_name”, :location => “shanghai”, :start_index => 16,:max_result => 15 return total number of events satisfying the search criterion Doubapi::Event[]
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/doubapi.rb', line 53 def self.search_events_of h ,&block totalResult, returnedResult = Douban.search_events_of h if block_given? returnedResult.each {|event| block.call(event) if block_given?} return totalResult; else return [totalResult, returnedResult] end end |