Class: Backup::Notifier::Campfire
- Defined in:
- lib/backup/notifier/campfire.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Campfire api authentication token.
-
#model ⇒ Object
Container for the Model object.
-
#room_id ⇒ Object
Campfire account’s room id.
-
#subdomain ⇒ Object
Campfire account’s subdomain.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(&block) ⇒ Campfire
constructor
Instantiates a new Backup::Notifier::Campfire object.
-
#perform!(model, exception = false) ⇒ Object
Performs the notification Takes an exception object that might’ve been created if an exception occurred.
Methods inherited from Base
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_token ⇒ Object
Campfire api authentication token
23 24 25 |
# File 'lib/backup/notifier/campfire.rb', line 23 def api_token @api_token end |
#model ⇒ Object
Container for the Model object
35 36 37 |
# File 'lib/backup/notifier/campfire.rb', line 35 def model @model end |
#room_id ⇒ Object
Campfire account’s room id
31 32 33 |
# File 'lib/backup/notifier/campfire.rb', line 31 def room_id @room_id end |
#subdomain ⇒ Object
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 |