Skip to content

Commit

Permalink
Improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
julien51 committed Jan 21, 2012
1 parent cf4973d commit 49062a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
19 changes: 17 additions & 2 deletions README.rdoc
Expand Up @@ -9,11 +9,26 @@ This should work with any Rack-compatible framework, as well as fully managed pl

== Using

You first need a subscriber account with Superfeedr.
You first need a {subscriber account}[http://superfeedr.com/subscriber] with Superfeedr.

*Warning* : your web application needs to be accessible for Superfeedr to send notifications. If you want to test it locally, we suggest you use it with a tool like {showoff}[https://showoff.io/] which will make your local port accessible from the outside world.

=== Sinatra

See the {example}[https://github.com/superfeedr/rack-superfeedr/blob/master/examples/sinatra_app.rb]... and {check the docs}[http://rubydoc.info/github/superfeedr/rack-superfeedr/master/Rack/Superfeedr] for more details.

*Warning* : your web application needs to be accessible for Superfeedr to send notifications. If you want to test it locally, we suggest you use it with a tool like {showoff}[https://showoff.io/] which will make your local port accessible from the outside world.
=== Rails

Tested with Rails 3.2, but should work with any Rails version that supports Rack.

Install the gem (using bundle), and then in `config/application.rb`, inside the `class Application < Rails::Application` block, just add the following line.

config.middleware.use Rack::Superfeedr, { :host => DOMAIN, :login => SUPERFEEDR_LOGIN, :password => SUPERFEEDR_PASSWORD} do |superfeedr|
Superfeedr = superfeedr
end

You can then access the Superfeedr object anywhere in your rails application with `YOUR_APP_::Application::Superfeedr`.


== Contributing

Expand Down
4 changes: 2 additions & 2 deletions lib/rack-superfeedr.rb
Expand Up @@ -16,7 +16,7 @@ class Superfeedr
# is concerned by a notification.
# The optional block will be called to let you confirm the subscription (or not).
# It returns true if the subscription was successful (or will be confirmed if you used async => true in the options), false otherwise
def subscribe(url, id, &block)
def subscribe(url, id = nil, &block)
feed_id = "#{id ? id : Base64.urlsafe_encode64(url)}"
if block
@verifications[feed_id] ||= {}
Expand All @@ -42,7 +42,7 @@ def subscribe(url, id, &block)
# Unsubscribes a url. If you used an id for the susbcription, you need to use _the same_.
# The optional block will be called to let you confirm the subscription (or not). This is not applicable for if you use params[:async] => true
# It returns true if the unsubscription was successful (or will be confirmed if you used async => true in the options), false otherwise
def unsubscribe(url, id, &block)
def unsubscribe(url, id = nil, &block)
feed_id = "#{id ? id : Base64.urlsafe_encode64(url)}"
if block
@verifications[feed_id] ||= {}
Expand Down

0 comments on commit 49062a3

Please sign in to comment.