Commit e8e70dfd37ce3da61fdfeb6fc4149b7355e2fb61
1 parent
d9de2210
Exists in
master
and in
1 other branch
add new files
Showing
3 changed files
with
33 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +class NotificationService | ||
2 | + include Mongoid::Document | ||
3 | + | ||
4 | + field :room_id, :type => String | ||
5 | + field :api_token, :type => String | ||
6 | + field :subdomain, :type => String | ||
7 | + | ||
8 | + validate :check_params | ||
9 | + | ||
10 | + # Subclasses are responsible for overwriting this method. | ||
11 | + def check_params; true; end | ||
12 | + | ||
13 | + def notification_description(problem) | ||
14 | + "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}" | ||
15 | + end | ||
16 | + | ||
17 | + # Allows us to set the issue tracker class from a single form. | ||
18 | + def type; self._type; end | ||
19 | + def type=(t); self._type=t; end | ||
20 | + | ||
21 | + # Retrieve tracker label from either class or instance. | ||
22 | + Label = '' | ||
23 | + def self.label; self::Label; end | ||
24 | + def label; self.class.label; end | ||
25 | +end |