Class: Marathon::EventSubscriptions
- Inherits:
-
Object
- Object
- Marathon::EventSubscriptions
- 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
-
.list ⇒ Object
List all event subscriber callback URLs.
-
.register(callbackUrl) ⇒ Object
Register a callback URL as an event subscriber.
-
.unregister(callbackUrl) ⇒ Object
Unregister a callback URL from the event subscribers list.
Instance Method Summary collapse
-
#initialize(marathon_instance = Marathon.singleton) ⇒ EventSubscriptions
constructor
A new instance of EventSubscriptions.
-
#list ⇒ Object
List all event subscriber callback URLs.
-
#register(callbackUrl) ⇒ Object
Register a callback URL as an event subscriber.
-
#unregister(callbackUrl) ⇒ Object
Unregister a callback URL from the event subscribers list.
Constructor Details
#initialize(marathon_instance = Marathon.singleton) ⇒ EventSubscriptions
Returns a new instance of EventSubscriptions.
5 6 7 |
# File 'lib/marathon/event_subscriptions.rb', line 5 def initialize(marathon_instance = Marathon.singleton) @connection = marathon_instance.connection end |
Class Method Details
.list ⇒ Object
List all event subscriber callback URLs. Returns a list of strings/URLs.
40 41 42 |
# File 'lib/marathon/event_subscriptions.rb', line 40 def list Marathon.singleton.event_subscriptions.list 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.
47 48 49 |
# File 'lib/marathon/event_subscriptions.rb', line 47 def register(callbackUrl) Marathon.singleton.event_subscriptions.register(callbackUrl) 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.
54 55 56 |
# File 'lib/marathon/event_subscriptions.rb', line 54 def unregister(callbackUrl) Marathon.singleton.event_subscriptions.unregister(callbackUrl) end |
Instance Method Details
#list ⇒ Object
List all event subscriber callback URLs. Returns a list of strings/URLs.
11 12 13 14 |
# File 'lib/marathon/event_subscriptions.rb', line 11 def list json = @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.
19 20 21 22 23 24 |
# File 'lib/marathon/event_subscriptions.rb', line 19 def register(callbackUrl) query = {} query[:callbackUrl] = callbackUrl json = @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.
29 30 31 32 33 34 |
# File 'lib/marathon/event_subscriptions.rb', line 29 def unregister(callbackUrl) query = {} query[:callbackUrl] = callbackUrl json = @connection.delete('/v2/eventSubscriptions', query) json end |