Class: GoogleSearch

Inherits:
Object
  • Object
show all
Defined in:
lib/googlesearch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(o = {}, search_request = SearchRequest.new) ⇒ GoogleSearch

Returns a new instance of GoogleSearch.



14
15
16
# File 'lib/googlesearch.rb', line 14

def initialize(o = {}, search_request = SearchRequest.new)
  @response = SearchResponse.new( search_request.get("http://www.google.com/search?&q=#{o[:q]}&client=google-csbe&output=xml_no_dtd&cx=#{o[:cx]}&cr=lang_#{o[:cr]}&lr=lang_#{o[:lr]}&start=#{o[:start]}&num=#{o[:num]}"), o[:num], o[:start])
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



12
13
14
# File 'lib/googlesearch.rb', line 12

def response
  @response
end