Class: Myimdb::Search::Google
- Inherits:
-
Base
- Object
- Base
- Myimdb::Search::Google
show all
- Includes:
- HTTParty
- Defined in:
- lib/myimdb/search/google.rb
Class Method Summary
collapse
Methods inherited from Base
#_search, search, spell_movie
Class Method Details
.search_images(text, options = {}) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/myimdb/search/google.rb', line 17
def search_images( text, options={} )
sizes = {
'large' => 'l',
'medium' => 'm',
'small' => 'i'
}
search_options = { :v=> '1.0', :q=> text }
search_options.merge!(:imgsz=> sizes[options[:size].to_s]) if !options[:size].blank?
text = text + " site:#{options[:restrict_to]}" if !options[:restrict_to].blank?
response = get( '/ajax/services/search/images', :query=> search_options )
parse_search_result( response )
end
|
.search_text(text, options = {}) ⇒ Object
11
12
13
14
15
|
# File 'lib/myimdb/search/google.rb', line 11
def search_text( text, options={} )
text = text + " site:#{options[:restrict_to]}" if !options[:restrict_to].blank?
response = get( '/ajax/services/search/web', :query=> {:v=> '1.0', :q=> text} )
parse_search_result( response )
end
|