Method: CPEE::Notifications.implementation

Defined in:
lib/cpee/implementation_notifications.rb

.implementation(id, opts) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cpee/implementation_notifications.rb', line 21

def self::implementation(id,opts)
  Proc.new do
    if CPEE::Persistence::exists?(id,opts)
      on resource "notifications" do
        run CPEE::Notifications::Overview if get
        on resource "topics" do
          run CPEE::Notifications::Topics, opts if get
        end
        on resource "subscriptions" do
          run CPEE::Notifications::Subscriptions, id, opts if get
          run CPEE::Notifications::CreateSubscription, id, opts if post 'create_subscription'
          on resource do
            run CPEE::Notifications::Subscription, id, opts if get
            run CPEE::Notifications::UpdateSubscription, id, opts if put 'change_subscription'
            run CPEE::Notifications::DeleteSubscription, id, opts if delete
            on resource 'sse' do
              run CPEE::Notifications::SSE, id, opts if sse
            end
          end
        end
      end
    else
      run CPEE::FAIL
    end
  end
end