lib/term_extraction/yahoo.rb in term_extraction-0.1.6 vs lib/term_extraction/yahoo.rb in term_extraction-0.1.7
- old
+ new
@@ -1,8 +1,8 @@
require 'crack'
-require 'addressable/uri'
require 'open-uri'
+require 'uri'
class TermExtraction
class Yahoo < TermExtraction
def terms
begin
@@ -11,16 +11,16 @@
[]
end
end
def uri
- api_uri = Addressable::URI.parse(gateway)
- api_uri.query_values = {
+ 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
class << self
def canonical_name
@@ -28,10 +28,10 @@
end
end
private
def ns
- {'s' => 'urn:yahoo:cate'}
+ { 's' => 'urn:yahoo:cate' }
end
def gateway
'http://search.yahooapis.com/ContentAnalysisService/V1/termExtraction'
end
\ No newline at end of file