Method: Mutx::Support::Notification#initialize

Defined in:
lib/mutx/support/notification.rb

#initialize(project_name, base_url = nil) ⇒ Notification

Returns a new instance of Notification.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/mutx/support/notification.rb', line 10

def initialize project_name, base_url=nil
  @project_name = project_name
  @base_url = base_url
  @subject_prefix = "[Mutx] [#{@project_name}] "
  if Mutx::Support::Configuration.notification?
    begin
      @email = Gmail.connect!(Mutx::Support::Configuration.notification_username,Mutx::Support::Configuration.notification_password)
      Mutx::Support::Log.debug "Notification: Login to Gmail Succesfully"
      Mutx::Support::Log.debug "Notification: USING notification TO #{Mutx::Support::Configuration.recipients}"
    rescue => e
      Mutx::Support::Log.error "Notification: ERROR TO CONNECT TO GMAIL #{e}".red
      Mutx::Support::Log.error "Notification: Connecting to GMail error => #{e}"
      @email = NoEmail.new
    end
  else
    @email = NoEmail.new
  end

end