Ruby class to fetch suggested keywords

I have recently ditched Perl and fell for Ruby. Here is a Ruby class which gets suggested keywords from yahoo API and presents it in a comma separated list. This might be useful for people who use Ruby to upload/edit multiple posts and need to tag them automagically. This might be awfully simple for the hardcore guys, but for a noob like me, had I come across this example earlier it would have saved me an hour or so. Here it goes... The Class :-
# A ruby class to fetch suggested keywords using Yahoo's term Extraction API
 require 'rubygems'
require 'xmlsimple'
require 'net/http'

class Tagger
  def content
  def content=(content)
    @content = content
    def appid
  def appid=(appid)
    @appid = appid
  def initialize

  def fetch
          url = URI.parse('')
      post_args = {
            'appid' => appid,
            'context' => content,
            'output' => "xml"
      resp1, xml_data = Net::HTTP.post_form(url, post_args)
      keywords = ""
      data = XmlSimple.xml_in(xml_data)
      data['Result'].each do |item|
      keywords = keywords + item + ", "
      return keywords
Download the class here Sample usage :
require 'tagger'
tagg =
tagg.appid =     'GO_GET_YOUR_OWN!'
tagg.content = "The content of the post....."
puts tagg.fetch
The appid is available from the Yahoo Developer Network Limitations : Maximum 5000 queries per day per IP.
Tags: keywords Ruby tags yahoo
Categories: Ruby Tutorials