Sha256: bb53a0044cbb66251f0927eef646163bfe8744fd7074d98df837e087a05cd531

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require "cgi"
require "jkl/rest_client.rb"
require "jkl/rss_client.rb"
require "jkl/calais_client.rb"
require "jkl/url_doc_handler.rb"

module Jkl
  
  def self.headlines(feed, keyphrase)
    get_from_as_xml "#{feed}#{keyphrase}"
  end

  def self.pages(headlines)
    items = get_items_from headlines
    descriptions = ""
    items.each do |item| 
      descriptions << attribute_from(item, :description).gsub("<![CDATA[","").gsub("]]>","")
    end
    descriptions
  end
  
  def self.descriptions(headlines)
    items = get_items_from headlines
    descriptions = []
    items.each do |item| 
      descriptions << attribute_from(item, :description).gsub("<![CDATA[","").gsub("]]>","")
    end
    descriptions
  end
  
  def self.links(headlines)
    items = get_items_from headlines
    links = []
    items.each do |item| 
      links << attribute_from(item, :link)
    end
    links
  end

  def self.tags(key, pages)
    Calais.process_document(
        :content => pages,
        :content_type => :text, 
        :license_id => key
    )
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jakal-0.0.9 lib/jkl.rb
jakal-0.0.8 lib/jkl.rb
jakal-0.0.7 lib/jkl.rb