Sha256: e25c56f11264598765a0ebde7190a81eaa183a3935600ca614a3ad0cb19eb4df

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

$:.unshift(File.dirname(__FILE__)) unless
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

require "jkl/rss_client"
require "jkl/rest_client"
require "jkl/calais_client"
require "jkl/text_client"

module Jkl
  class << self
    
    def links(feed)
      links = Jkl::Rss::links(Jkl::Rss::items(Jkl::get_xml_from(feed)))
      links.each do |link|
        yield link if block_given?
      end
    end
    
    def topix_links(keyphrase)
      url = YAML::load_file('config/config.yml')['topix'] || 
          "http://www.topix.net/rss/search/article?q="
      links("#{url}#{keyphrase}")
    rescue Errno::ENOENT
    end
    
    def tags(key, link)
      text = Jkl::Text::sanitize(Jkl::get_from(link))
      Jkl::Extraction::tags(key, text)
    end

    def trends
      url = YAML::load_file('config/config.yml')['twitter'] || 
          "http://search.twitter.com/trends.json"
      JSON.parse(Jkl::get_from(url))["trends"].map{|t| t["name"]}
    rescue Errno::ENOENT
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jakal-0.1.94 lib/jkl.rb