Class: TermExtraction::Yahoo
Instance Attribute Summary
#api_key, #context
Class Method Summary
collapse
Instance Method Summary
collapse
#canonical_name, #initialize
Constructor Details
This class inherits a constructor from TermExtraction
Class Method Details
.canonical_name ⇒ Object
26
27
28
|
# File 'lib/term_extraction/yahoo.rb', line 26
def canonical_name
'yahoo'
end
|
Instance Method Details
#terms ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/term_extraction/yahoo.rb', line 7
def terms
begin
Crack::XML.parse(remote_xml)['ResultSet']['Result']
rescue
[]
end
end
|
#uri ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/term_extraction/yahoo.rb', line 15
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
|