Module: ProbyNotifier

Defined in:
lib/proby_notifier/version.rb,
lib/proby_notifier/resque_plugin.rb,
lib/proby_notifier/proby_notifier.rb

Defined Under Namespace

Modules: ResquePlugin

Constant Summary collapse

VERSION =
"1.1.0"
BASE_URL =
"https://proby.signalhq.com/tasks/"

Class Method Summary collapse

Class Method Details

.api_key=(api_key) ⇒ Object

Set your Proby API key.

Examples:

ProbyNotifier.api_key = '1234567890abcdefg'

Parameters:

  • api_key (String)

    Your Proby API key



17
18
19
# File 'lib/proby_notifier/proby_notifier.rb', line 17

def api_key=(api_key)
  @api_key = api_key
end

.loggerObject

Get the logger used by Proby.



33
34
35
# File 'lib/proby_notifier/proby_notifier.rb', line 33

def logger
  @logger || Logger.new("/dev/null")
end

.logger=(logger) ⇒ Object

Set the logger to be used by Proby.

Examples:

ProbyNotifier.logger = Rails.logger
ProbyNotifier.logger = Logger.new(STDERR)

Parameters:

  • logger (Logger)

    The logger you would like ProbyNotifier to use



28
29
30
# File 'lib/proby_notifier/proby_notifier.rb', line 28

def logger=(logger)
  @logger = logger
end

.send_finish_notification(proby_task_id = nil, options = {}) ⇒ Object

Send a finish notification for this task to Proby

Parameters:

  • proby_task_id (String) (defaults to: nil)

    The id of the task to be notified. If nil, the value of the PROBY_TASK_ID environment variable will be used.

  • options (Hash) (defaults to: {})

    The options for the finish notification

Options Hash (options):

  • :failed (Boolean)

    true if this task run resulted in some sort of failure. Setting this parameter to true will trigger a notification to be sent to the alarms configured for the given task. Defaults to false.

  • :error_message (String)

    A string message describing the failure that occurred. 1,000 character limit.



55
56
57
# File 'lib/proby_notifier/proby_notifier.rb', line 55

def send_finish_notification(proby_task_id=nil, options={})
  send_notification('/finish', proby_task_id, options)
end

.send_start_notification(proby_task_id = nil) ⇒ Object

Send a start notification for this task to Proby.

Parameters:

  • proby_task_id (String) (defaults to: nil)

    The id of the task to be notified. If nil, the value of the PROBY_TASK_ID environment variable will be used.



41
42
43
# File 'lib/proby_notifier/proby_notifier.rb', line 41

def send_start_notification(proby_task_id=nil)
  send_notification('/start', proby_task_id)
end