Class: Myimdb::Search::Bing

Inherits:
Base
  • Object
show all
Includes:
HTTParty
Defined in:
lib/myimdb/search/bing.rb

Constant Summary collapse

AppKey =
'36C1CEF363A00C6536C4420D356B5E507C4C2AF1'

Class Method Summary collapse

Methods inherited from Base

#_search, search, spell_movie

Class Method Details

.search_images(text, options = {}) ⇒ Object



18
19
20
21
22
# File 'lib/myimdb/search/bing.rb', line 18

def search_images( text, options={} )
  text = text + " site:#{options[:restrict_to]}" if !options[:restrict_to].blank?
  response = get( '/json.aspx', :query=> {:Appid=> AppKey, :query=> text, :sources=> 'image', :Version=> 2.0, :Market=> 'en-us' } )
  parse_search_result(response, 'Image')
end

.search_text(text, options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/myimdb/search/bing.rb', line 12

def search_text( text, options={} )
  text = text + " site:#{options[:restrict_to]}" if !options[:restrict_to].blank?
  response = get( '/json.aspx', :query=> {:Appid=> AppKey, :query=> text, :sources=> 'web', :Version=> 2.0, :Market=> 'en-us' } )
  parse_search_result(response, 'Web')
end

.spell(text, options = {}) ⇒ Object



24
25
26
27
28
# File 'lib/myimdb/search/bing.rb', line 24

def spell( text, options={} )
  text = text + " site:#{options[:restrict_to]}" if !options[:restrict_to].blank?
  response = get( '/json.aspx', :query=> {:Appid=> AppKey, :query=> text, :Sources=> 'spell', :Version=> 2.0, :Market=> 'en-us' } )
  parse_search_result(response, 'Spell')
end