My Ruby API for Simpy is ready for use. I have committed version 0.01 to the SimpyTools sourceforge repository in simpyapi/simpyapi-ruby.
At the present time, simpyapi-ruby features support for adding, removing, modifying, and acquiring links as well as removing, renaming, and listing tags. Support for notes and watchlists will be implemented in a future version. Unsupported operations can still be performed with the generic Simpy::ClientBase.command method. Support is also provided for interfacing with Simpy RSS feeds.
The simpyapi-ruby library allows developers to leverage Ruby's syntactic sugar and interact with Simpy without having to parse, process, or manipulate XML data. Login and connection handling is all automatic, all you have to do is provide simpyapi-ruby with your username and password.
Adding a link to your Simpy account:
client = Simpy::Client.new("segphault", "xxxxxxxxx")
client << Simpy::Link.new("The Simpy Web Site", "http://www.simpy.com", ["tagA", "tagB"], "This is a note", "The Simpy Web Site")
Display the title of every link that matches a query:
for link in client["tags:science"]
puts link["title"]
end
Get an array of all links added between May 12th, and today:
client[Time.mktime(2006, 05, 12)..Time.now]
Changing values of a link:
link = client["somequery"][0]
client << (link << {"note" => "This is a different note", "urlNickname" => "A different nickname"})
Get links from another Simpy user via RSS:
Simpy::RSS.new("segphault")["test"].each do |l|
puts l["href"]
end
Finding out how many links are associated with a specific tag:
client.tags["science"]
Using the REST API without using one of the provided methods:
client.command "GetLinks", "q" => "test", "beforeDate" => "2006-05-30"
The simpyapi-ruby library is very easy to install. Simply run the setup.rb script included with the library. You can browse the simpyapi-ruby documentation online here, and you can browse the source code online here. Please contact me with your questions, comments, or code contributions. You can reach me by e-mail here: segphault@sbcglobal.net
You can download this version here:
http://sourceforge.net/project/showfiles.php?group_id=138299&package_id=195023
The simpyapi-ruby documentation for this version can be found here:
http://simpytools.cvs.sourceforge.net/\*checkout*/simpytools/simpyapi/simpyapi-ruby/doc/index.html?revision=1.1