Permalink
Browse files

Let's create an rss feed or something...

  • Loading branch information...
fixlr committed Aug 6, 2008
1 parent 84120f0 commit 229e47728c56c842e4c1b859613a97da1a882f61
Showing with 21 additions and 1 deletion.
  1. +21 −1 example/just_do_it.rb
View
@@ -2,5 +2,25 @@
require '../lib/nikeplus'
+def generate_rss(builder, rss_title, rss_link, items)
+ builder.rss('version' => '0.91') {
+ builder.channel {
+ builder.title rss_title
+ builder.link rss_link
+
+ items.reverse.each do |item|
+ builder.item {
+ builder.title "#{item.startTime}"
+ builder.description "This run was #{item.miles} miles and lasted #{item.minutes}'#{item.seconds}\"."
+ }
+ end
+ }
+ }
+end
+
# Authenticate to access your private Nike+ user info
-me = NikePlus.new('my@email.com', 'secretpassword')
+me = NikePlus.new('my@email.com', 'secretpassword')
+my_runs = me.runs
+builder = Builder::XmlMarkup.new
+
+puts generate_rss(builder, "My Recent Runs", "http://petrock.org/runs.rss", me.runs)

0 comments on commit 229e477

Please sign in to comment.