Class: GovKit::SearchEngines::Technorati
- Inherits:
-
Object
- Object
- GovKit::SearchEngines::Technorati
- Defined in:
- lib/gov_kit/search_engines/technorati.rb
Class Method Summary collapse
Class Method Details
.make_request(host, path) ⇒ Object
30 31 32 |
# File 'lib/gov_kit/search_engines/technorati.rb', line 30 def self.make_request(host, path) response = Net::HTTP.get(host, path) end |
.search(options = []) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gov_kit/search_engines/technorati.rb', line 4 def self.search(=[]) query = .to_query('q') host = GovKit::configuration.technorati_base_url path = "/search?key=#{GovKit::configuration.technorati_apikey}&limit=50&language=en&query=#{URI::encode(query)}" doc = Nokogiri::HTML(make_request(host, path)) mentions = [] # doc.search("tapi/document/item").each do |i| # mention = GovKit::Mention.new # # mention.url = i.text("permalink") # mention.title = i.text("title") # mention.excerpt = i.text("excerpt") # mention.date = i.text("created") # mention.source = i.text("weblog/name") # mention.search_source = 'Technorati' # mention.url = i.text("weblog/url") # mention.weight = i.text("weblog/inboundlinks") # # mentions << mention # end mentions [] end |