Class: SemExtractor::Yahoo

Inherits:
SemExtractor show all
Defined in:
lib/apis/yahoo.rb

Instance Attribute Summary

Attributes inherited from SemExtractor

#api_key, #categories, #context, #geos, #terms

Instance Method Summary collapse

Methods inherited from SemExtractor

#set

Constructor Details

#initialize(options = {}) ⇒ Yahoo

Returns a new instance of Yahoo.



3
4
5
6
# File 'lib/apis/yahoo.rb', line 3

def initialize(options={})
 self.set(options)
 @terms = Nokogiri::XML(remote_xml).css('Result').map { |h| {"name" => h.content} }
end

Instance Method Details

#uriObject



8
9
10
11
12
13
14
15
16
# File 'lib/apis/yahoo.rb', line 8

def uri
  api_uri = URI.parse(gateway)
  api_uri.query = {
     'appid'   => @api_key,
     'output'  => 'xml',
     'context' => @context
  }.map { |k,v| "#{URI.escape(k || '')}=#{URI.escape(v || '')}" }.join('&')
  api_uri
end