Class: Backup::Notifier::Hipchat

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

Instance Attribute Summary collapse

Attributes inherited from Base

#max_retries, #message, #model, #on_failure, #on_success, #on_warning, #retry_waitsec

Instance Method Summary collapse

Methods inherited from Base

#perform!

Methods included from Config::Helpers

included

Constructor Details

#initialize(model, &block) ⇒ Hipchat

Returns a new instance of Hipchat.



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

def initialize(model, &block)
  super
  instance_eval(&block) if block_given?

  @notify_users   ||= false
  @rooms_notified ||= []
  @success_color  ||= "yellow"
  @warning_color  ||= "yellow"
  @failure_color  ||= "yellow"
  @api_version    ||= "v1"
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backup::Config::Helpers

Instance Attribute Details

#api_versionObject

The Hipchat API version Either ‘v1’ or ‘v2’ (default is ‘v1’)



13
14
15
# File 'lib/backup/notifier/hipchat.rb', line 13

def api_version
  @api_version
end

#failure_colorObject

The background color of an error message. One of :yellow, :red, :green, :purple, or :random. (default: yellow)



44
45
46
# File 'lib/backup/notifier/hipchat.rb', line 44

def failure_color
  @failure_color
end

#fromObject

Who the notification should appear from



17
18
19
# File 'lib/backup/notifier/hipchat.rb', line 17

def from
  @from
end

#notify_usersObject

Notify users in the room



29
30
31
# File 'lib/backup/notifier/hipchat.rb', line 29

def notify_users
  @notify_users
end

#rooms_notifiedObject

The rooms that should be notified



25
26
27
# File 'lib/backup/notifier/hipchat.rb', line 25

def rooms_notified
  @rooms_notified
end

#server_urlObject

Custom server URL



21
22
23
# File 'lib/backup/notifier/hipchat.rb', line 21

def server_url
  @server_url
end

#success_colorObject

The background color of a success message. One of :yellow, :red, :green, :purple, or :random. (default: yellow)



34
35
36
# File 'lib/backup/notifier/hipchat.rb', line 34

def success_color
  @success_color
end

#tokenObject

The Hipchat API token



8
9
10
# File 'lib/backup/notifier/hipchat.rb', line 8

def token
  @token
end

#warning_colorObject

The background color of a warning message. One of :yellow, :red, :green, :purple, or :random. (default: yellow)



39
40
41
# File 'lib/backup/notifier/hipchat.rb', line 39

def warning_color
  @warning_color
end