Class: Runcible::Resources::EventNotifier

Inherits:
Base
  • Object
show all
Defined in:
lib/runcible/resources/event_notifier.rb

Overview

Defined Under Namespace

Classes: EventTypes, NotifierTypes

Instance Attribute Summary

Attributes inherited from Base

#logs

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add_http_auth_header, #add_oauth_header, #call, #combine_get_params, #config, #exception_to_log, #format_payload_json, #generate_payload, #get_response, #initialize, #lazy_config=, #log_debug, #log_exception, #log_info, #logger, #path, #process_response, #required_params

Constructor Details

This class inherits a constructor from Runcible::Base

Class Method Details

.path(id = nil) ⇒ String

Generates the API path for Event Notifiers

Parameters:

  • id (String) (defaults to: nil)

    the ID of the event notifier

Returns:

  • (String)

    the event notifier path, may contain the ID if passed



20
21
22
# File 'lib/runcible/resources/event_notifier.rb', line 20

def self.path(id = nil)
  id.nil? ? 'events/' : "events/#{id}/"
end

Instance Method Details

#create(notifier_type_id, notifier_config, event_types) ⇒ RestClient::Response

Creates an Event Notification

Parameters:

  • notifier_type_id (String)

    the type ID of the event notifier

  • notifier_config (Hash)

    configuration options for the notifier

  • event_types (Hash)

    event types to include in the notifier

Returns:

  • (RestClient::Response)


30
31
32
33
# File 'lib/runcible/resources/event_notifier.rb', line 30

def create(notifier_type_id, notifier_config, event_types)
  required = required_params(binding.send(:local_variables), binding)
  call(:post, path, :payload => {:required => required})
end

#delete(id) ⇒ RestClient::Response

Deletes an Event Notification

Parameters:

  • id (String)

    the ID of the event notifier

Returns:

  • (RestClient::Response)


39
40
41
# File 'lib/runcible/resources/event_notifier.rb', line 39

def delete(id)
  call(:delete, path(id))
end

#listRestClient::Response

List all Event Notifiers

Parameters:

  • id (String)

    the ID of the event notifier

Returns:

  • (RestClient::Response)


47
48
49
# File 'lib/runcible/resources/event_notifier.rb', line 47

def list
  call(:get, path)
end