Class: Gemometer::Notifiers::Mailgun

Inherits:
Base
  • Object
show all
Defined in:
lib/gemometer/notifiers/mailgun.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#gems, #key

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#notify

Constructor Details

#initialize(opts) ⇒ Mailgun

Returns a new instance of Mailgun.



7
8
9
10
11
# File 'lib/gemometer/notifiers/mailgun.rb', line 7

def initialize(opts)
  @domain = opts[:domain]
  @to     = opts[:to]
  super(opts)
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



5
6
7
# File 'lib/gemometer/notifiers/mailgun.rb', line 5

def domain
  @domain
end

#toObject (readonly)

Returns the value of attribute to.



5
6
7
# File 'lib/gemometer/notifiers/mailgun.rb', line 5

def to
  @to
end

Class Method Details

.mandatory_optionsObject



13
14
15
# File 'lib/gemometer/notifiers/mailgun.rb', line 13

def self.mandatory_options
  [:domain, :to, :key]
end

Instance Method Details

#messageObject



17
18
19
20
21
# File 'lib/gemometer/notifiers/mailgun.rb', line 17

def message
  msg = '<p>Outdated gems:</p><ul>'
  gems.each { |g| msg += "<li>#{ruby_gems_link(g.name)} #{g.message_line}</li>" }
  msg += '</ul>'
end

#urlObject



27
28
29
# File 'lib/gemometer/notifiers/mailgun.rb', line 27

def url
  "https://api.mailgun.net/v3/#{domain}/messages"
end

#usernameObject



23
24
25
# File 'lib/gemometer/notifiers/mailgun.rb', line 23

def username
  'api'
end