Class: Backup::Notifier::Presently

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

Defined Under Namespace

Classes: Client

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) ⇒ Presently

Instantiates a new Backup::Notifier::Presently object



31
32
33
34
35
36
37
# File 'lib/backup/notifier/presently.rb', line 31

def initialize(&block)
  load_defaults!

  instance_eval(&block) if block_given?

  set_defaults!
end

Instance Attribute Details

#group_idObject

Group id



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

def group_id
  @group_id
end

#modelObject

Container for the Model object



15
16
17
# File 'lib/backup/notifier/presently.rb', line 15

def model
  @model
end

#passwordObject

Presently credentials



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

def password
  @password
end

#presently_clientObject

Container for the Presently Client object



11
12
13
# File 'lib/backup/notifier/presently.rb', line 11

def presently_client
  @presently_client
end

#subdomainObject

Presently subdomain



19
20
21
# File 'lib/backup/notifier/presently.rb', line 19

def subdomain
  @subdomain
end

#user_nameObject

Presently credentials



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

def user_name
  @user_name
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



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/backup/notifier/presently.rb', line 46

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