Class: Marathon::EventSubscriptions

Inherits:
Object
  • Object
show all
Defined in:
lib/marathon/event_subscriptions.rb

Overview

This class represents a Marathon Event Subscriptions. See mesosphere.github.io/marathon/docs/rest-api.html#event-subscriptions for full list of API’s methods.

Class Method Summary collapse

Class Method Details

.listObject

List all event subscriber callback URLs. Returns a list of strings/URLs.



8
9
10
11
# File 'lib/marathon/event_subscriptions.rb', line 8

def list
  json = Marathon.connection.get('/v2/eventSubscriptions')
  json['callbackUrls']
end

.register(callbackUrl) ⇒ Object

Register a callback URL as an event subscriber. callbackUrl: URL to which events should be posted. Returns an event as hash.



16
17
18
19
20
21
# File 'lib/marathon/event_subscriptions.rb', line 16

def register(callbackUrl)
  query = {}
  query[:callbackUrl] = callbackUrl
  json = Marathon.connection.post('/v2/eventSubscriptions', query)
  json
end

.unregister(callbackUrl) ⇒ Object

Unregister a callback URL from the event subscribers list. callbackUrl: URL passed when the event subscription was created. Returns an event as hash.



26
27
28
29
30
31
# File 'lib/marathon/event_subscriptions.rb', line 26

def unregister(callbackUrl)
  query = {}
  query[:callbackUrl] = callbackUrl
  json = Marathon.connection.delete('/v2/eventSubscriptions', query)
  json
end