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

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.search_albums_of(h, &block) ⇒ Object

input :singer,:since return total number of events satisfying the search criterion return Doubapi::Album[]



65
66
67
68
69
70
71
72
73
# File 'lib/doubapi.rb', line 65

def self.search_albums_of h ,&block
 totalResult, returnedResult =	Douban.search_albums_of 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[]



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/doubapi.rb', line 49

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