Class: GitAgent::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/git_agent/notification.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, homepage = nil, diff = {}) ⇒ Notification

Returns a new instance of Notification.



25
26
27
28
29
30
31
# File 'lib/git_agent/notification.rb', line 25

def initialize(title, homepage = nil, diff = {})
  assert_config!

  @title    = title
  @diff     = diff
  @homepage = homepage
end

Class Attribute Details

.configObject

Returns the value of attribute config.



7
8
9
# File 'lib/git_agent/notification.rb', line 7

def config
  @config
end

Instance Attribute Details

#diffObject (readonly)

Returns the value of attribute diff.



23
24
25
# File 'lib/git_agent/notification.rb', line 23

def diff
  @diff
end

#homepageObject (readonly)

Returns the value of attribute homepage.



23
24
25
# File 'lib/git_agent/notification.rb', line 23

def homepage
  @homepage
end

#titleObject (readonly)

Returns the value of attribute title.



23
24
25
# File 'lib/git_agent/notification.rb', line 23

def title
  @title
end

Instance Method Details

#send!Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/git_agent/notification.rb', line 33

def send!
  mail = Mail.new
  mail.from         = config[:sender_username]
  mail.to           = config[:recipient_username]
  mail.subject      = title
  mail.body         = construct_body
  mail.content_type = 'text/html; charset=UTF-8'

  mail.deliver!
end