Class Simpy::RSS
In: lib/simpy.rb
Parent: Object

A Simpy RSS client interface

Description

This class provides an interface to Simpy’s RSS client system. It provides Ruby methods for acquiring links from a Simpy RSS feed. The methods included in this class facilitate read-only access to the public links of a Simpy user. It should be used in situations where the username and password of a Simpy user are not available, and read-only access is sufficient.

Usage

  Simpy::RSS.new("segphault")["test"].each do |l|
    puts l["href"]
  end

Methods

[]   links   new  

Public Class methods

Create a new RSS client instance

Args

user:The user whose links are going to be accessed.

[Source]

     # File lib/simpy.rb, line 734
734:     def initialize user
735:       @realm = "/rss/user/#{user}/links/"
736:       @headers = {"User-Agent" => $USER_AGENT}
737:     end

Public Instance methods

[](q="")

Alias for links

Get links from a user’s Simpy account

Description

This method accesses the RSS feed for a user’s Simpy account, and uses it to acquire links. A query can optionally be provided to control which links are returned. The output is an array of Link instances parsed from the RSS XML content.

Keep in mind that this method will only show links associated with the public access type value.

Args

q:The string query to use for filtering the results. This string can use Simpy’s search syntax.

Usage

  Simpy::RSS.new("segphault").links("title:test tag:test2")

[Source]

     # File lib/simpy.rb, line 761
761:     def links q=""
762:       resp, data = Net::HTTP.new("www.simpy.com").get(@realm + q, @headers)
763:       REXML::XPath.match(REXML::Document.new(data), "//item").map do |e|
764:         Link.parse_rss e
765:       end
766:     end

[Validate]