Class: Backup::Notifier::Campfire

Inherits:
Base
  • Object
show all
Defined in:
lib/backup/notifier/campfire.rb

Defined Under Namespace

Classes: Interface, Room

Instance Attribute Summary collapse

Attributes inherited from Base

#on_failure, #on_success

Instance Method Summary collapse

Methods inherited from Base

#log!

Methods included from Configuration::Helpers

#clear_defaults!, #getter_methods, #load_defaults!, #setter_methods

Constructor Details

#initialize(&block) ⇒ Campfire

Instantiates a new Backup::Notifier::Campfire object



39
40
41
42
43
44
45
# File 'lib/backup/notifier/campfire.rb', line 39

def initialize(&block)
  load_defaults!

  instance_eval(&block) if block_given?

  set_defaults!
end

Instance Attribute Details

#api_tokenObject

Campfire api authentication token



23
24
25
# File 'lib/backup/notifier/campfire.rb', line 23

def api_token
  @api_token
end

#modelObject

Container for the Model object



35
36
37
# File 'lib/backup/notifier/campfire.rb', line 35

def model
  @model
end

#room_idObject

Campfire account’s room id



31
32
33
# File 'lib/backup/notifier/campfire.rb', line 31

def room_id
  @room_id
end

#subdomainObject

Campfire account’s subdomain



27
28
29
# File 'lib/backup/notifier/campfire.rb', line 27

def subdomain
  @subdomain
end

Instance Method Details

#perform!(model, exception = false) ⇒ Object

Performs the notification Takes an exception object that might’ve been created if an exception occurred. If this is the case it’ll invoke notify_failure!(exception), otherwise, if no error was raised, it’ll go ahead and notify_success!

If’ll only perform these if on_success is true or on_failure is true



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/backup/notifier/campfire.rb', line 54

def perform!(model, exception = false)
  @model = model

  if notify_on_success? and exception.eql?(false)
    log!
    notify_success!
  elsif notify_on_failure? and not exception.eql?(false)
    log!
    notify_failure!(exception)
  end
end