Class: Mailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/mailer.rb

Instance Method Summary collapse

Instance Method Details

#comment_notification(comment) ⇒ Object


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/mailers/mailer.rb', line 44

def comment_notification(comment)
  @comment  = comment
  @user     = comment.user
  @problem  = comment.err
  @notice   = @problem.notices.first
  @app      = @problem.app

  recipients = @comment.notification_recipients

  errbit_headers 'App' => @app.name,
                 'Environment' => @notice.environment_name,
                 'Problem-Id' => @problem.id,
                 'Comment-Author' => @user.name

  mail :to      => recipients,
       :subject => "#{@user.name} commented on [#{@app.name}][#{@notice.environment_name}] #{@notice.message.truncate(50)}"
end

#deploy_notification(deploy) ⇒ Object


31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/mailers/mailer.rb', line 31

def deploy_notification(deploy)
  @deploy   = deploy
  @app  = deploy.app

  errbit_headers 'App' => @app.name,
                 'Environment' => @deploy.environment,
                 'Deploy-Revision' => @deploy.revision,
                 'Deploy-User' => @deploy.username

  mail :to       => @app.notification_recipients,
       :subject  => "[#{@app.name}] Deployed to #{@deploy.environment} by #{@deploy.username}"
end

#err_notification(notice) ⇒ Object


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/mailers/mailer.rb', line 16

def err_notification(notice)
  @notice   = notice
  @app      = notice.app

  count = @notice.similar_count
  count = count > 1 ? "(#{count}) " : ""

  errbit_headers 'App' => @app.name,
                 'Environment' => @notice.environment_name,
                 'Error-Id' => @notice.err_id

  mail :to      => @app.notification_recipients,
       :subject => "#{count}[#{@app.name}][#{@notice.environment_name}] #{@notice.message.truncate(50)}"
end