Module: PublicsHelper

Defined in:
app/helpers/publics_helper.rb

Overview

Copyright © 2010-2011, Diaspora Inc. This file is

licensed under the Affero General Public License version 3 or later.  See
the COPYRIGHT file.

Instance Method Summary collapse

Instance Method Details

#subscribe(opts = {}) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/publics_helper.rb', line 6

def subscribe(opts = {})
  subscriber = Subscriber.first(:url => opts[:callback], :topic => opts[:topic])
  subscriber ||= Subscriber.new(:url => opts[:callback], :topic => opts[:topic])

  if subscriber.save
    if opts[:verify] == 'sync'
      204
    elsif opts[:verify] == 'async'
      202
    end
  else
    400
  end
end