Skip to content

Instantly share code, notes, and snippets.

@superfeedr
Created May 12, 2009 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save superfeedr/110247 to your computer and use it in GitHub Desktop.
Save superfeedr/110247 to your computer and use it in GitHub Desktop.
require "rubygems"
require "superfeedr"
## You can have all the XMPP logging by changing the Skates log level
Skates.logger.level = Log4r::DEBUG
##
# Don't ever forget that all this is ASYNCHRONOUS...
# If you don't run EM in your program, then it will started for... however, EM.run begin a blocking call, you shoudl probably run it into a specific Thread to keep the rest of your app running :)
Superfeedr.connect("demo@superfeedr.com", "*********") do
puts "Yay... connected ;)"
Superfeedr.on_notification do |notification|
puts "The feed #{notification.feed_url} has been fetched (#{notification.http_status}: #{notification.message_status}) and will be fecthed again in #{(notification.next_fetch - Time.now)/60} minutes."
notification.entries.each do |e|
puts " - #{e.title} (#{e.link}) was published (#{e.published}) with #{e.unique_id} as unique id : \n #{e.summary} (#{e.chunk}/#{e.chunks})"
end
end
Superfeedr.subscribe("http://github.com/superfeedr.atom") do |result|
puts "Yay, subscribed to the github Atom feed for Superfeedr" if result
Superfeedr.unsubscribe("http://github.com/superfeedr.atom") do |result|
puts "Sad, you unsubscribed from the github Atom feed for Superfeedr" if result
end
end
Superfeedr.subscribe("http://feeds.feedburner.com/NotifixiousFoundersBlog") do |result|
puts "Subscribed to Notifixious' blog" if result
end
end
@hackervera
Copy link

Might want to require "time"

@hackervera
Copy link

Also I think according to this: http://github.com/superfeedr/superfeedr-ruby/blob/master/lib/stanzas/notification_stanza.rb#L156

I think its e.links on line 17

@hackervera
Copy link

is it e.links? e.link gives me a fail

@superfeedr
Copy link
Author

Yes, it might be e.links =)

@peterc
Copy link

peterc commented Mar 13, 2011

Update it then ;-)

@hackervera
Copy link

i think it was actually my ruby version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment