Class: ESearchy::SearchEngines::Bing
- Inherits:
-
GenericEngine
- Object
- GenericEngine
- ESearchy::SearchEngines::Bing
- Defined in:
- lib/esearchy/SearchEngines/bing.rb
Constant Summary collapse
- ENGINE =
"api.search.live.net"
- PORT =
80
- NUM =
50
- TYPE =
1
Instance Attribute Summary
Attributes inherited from GenericEngine
#documents, #emails, #people, #results
Instance Method Summary collapse
Methods inherited from GenericEngine
#company=, #initialize, #maxhits=, #start=
Constructor Details
This class inherits a constructor from ESearchy::GenericEngine
Instance Method Details
#appid=(value) ⇒ Object
16 17 18 |
# File 'lib/esearchy/SearchEngines/bing.rb', line 16 def appid=(value) @appid = value end |
#parse(json) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/esearchy/SearchEngines/bing.rb', line 20 def parse(json) doc = JSON.parse(json) hits = doc["SearchResponse"]["Web"]["Total"].to_i if hits == nil or hits == 0 @totalhits = 0 else @totalhits = totalhits(hits) end super doc["SearchResponse"]["Web"]["Results"] end |
#search ⇒ Object
9 10 11 12 13 14 |
# File 'lib/esearchy/SearchEngines/bing.rb', line 9 def search @querypath = "/json.aspx?AppId=" + @appid + "&query=" + @query + "&Sources=Web&Web.Count=50&Web.Offset=" or raise ESearchyMissingAppID, "Missing AppID <Class.appid=>" super end |