Commit cccd26cc49ffa0d4b22e54f8b99729d1f7f396e8
1 parent
d2bf9dbc
Exists in
master
and in
1 other branch
accidental swp file added
Showing
1 changed file
with
0 additions
and
59 deletions
Show diff stats
app/models/#notification_service.rb#
| ... | ... | @@ -1,59 +0,0 @@ |
| 1 | -class NotificationService | |
| 2 | - include Mongoid::Document | |
| 3 | - | |
| 4 | - include Rails.application.routes.url_helpers | |
| 5 | - default_url_options[:host] = ActionMailer::Base.default_url_options[:host] | |
| 6 | - | |
| 7 | - field :room_id, :type => String | |
| 8 | - field :user_id, :type => String | |
| 9 | - field :service_url, :type => String | |
| 10 | - field :service, :type => String | |
| 11 | - field :api_token, :type => String | |
| 12 | - field :subdomain, :type => String | |
| 13 | - field :sender_name, :type => String | |
| 14 | - field :notify_at_notices, :type => Array, :default => Errbit::Config.notify_at_notices | |
| 15 | - | |
| 16 | - embedded_in :app, :inverse_of => :notification_service | |
| 17 | - | |
| 18 | - validate :check_params | |
| 19 | - | |
| 20 | - if Errbit::Config.per_app_notify_at_notices | |
| 21 | - Fields = [[:notify_at_notices, | |
| 22 | - { :placeholder => 'comma separated numbers or simply 0 for every notice', | |
| 23 | - :label => 'notify on errors (0 for all errors)' | |
| 24 | - } | |
| 25 | - ]] | |
| 26 | - else | |
| 27 | - Fields = [] | |
| 28 | - end | |
| 29 | - | |
| 30 | - def notify_at_notices | |
| 31 | - Errbit::Config.per_app_notify_at_notices ? super : Errbit::Config.notify_at_notices | |
| 32 | - end | |
| 33 | - | |
| 34 | - # Subclasses are responsible for overwriting this method. | |
| 35 | - def check_params; true; end | |
| 36 | - | |
| 37 | - def notification_description(problem) | |
| 38 | - "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}" | |
| 39 | - end | |
| 40 | - | |
| 41 | - # Allows us to set the issue tracker class from a single form. | |
| 42 | - def type; self._type; end | |
| 43 | - def type=(t); self._type=t; end | |
| 44 | - | |
| 45 | - def url; nil; end | |
| 46 | - | |
| 47 | - # Retrieve tracker label from either class or instance. | |
| 48 | - Label = '' | |
| 49 | - def self.label; self::Label; end | |
| 50 | - def label; self.class.label; end | |
| 51 | - | |
| 52 | - def configured? | |
| 53 | - api_token.present? | |
| 54 | - end | |
| 55 | - | |
| 56 | - def problem_url(problem) | |
| 57 | - "http://#{Errbit::Config.host}/apps/#{problem.app.id}/problems/#{problem.id}" | |
| 58 | - end | |
| 59 | -end |