Class: Gitlab::Email::Handler::BaseHandler
- Inherits:
-
Object
- Object
- Gitlab::Email::Handler::BaseHandler
- Defined in:
- lib/gitlab/email/handler/base_handler.rb
Direct Known Subclasses
CreateIssueHandler, CreateMergeRequestHandler, CreateNoteHandler, CreateNoteOnIssuableHandler, ServiceDeskHandler, UnsubscribeHandler
Constant Summary collapse
- HANDLER_ACTION_BASE_REGEX =
/(?<project_slug>.+)-(?<project_id>\d+)/
Instance Attribute Summary collapse
-
#mail ⇒ Object
readonly
Returns the value of attribute mail.
-
#mail_key ⇒ Object
readonly
Returns the value of attribute mail_key.
Instance Method Summary collapse
- #can_handle? ⇒ Boolean
- #execute ⇒ Object
-
#initialize(mail, mail_key) ⇒ BaseHandler
constructor
A new instance of BaseHandler.
-
#metrics_event ⇒ Object
Each handler should use it’s own metric event.
- #metrics_params ⇒ Object
Constructor Details
#initialize(mail, mail_key) ⇒ BaseHandler
Returns a new instance of BaseHandler.
11 12 13 14 |
# File 'lib/gitlab/email/handler/base_handler.rb', line 11 def initialize(mail, mail_key) @mail = mail @mail_key = mail_key end |
Instance Attribute Details
#mail ⇒ Object (readonly)
Returns the value of attribute mail.
7 8 9 |
# File 'lib/gitlab/email/handler/base_handler.rb', line 7 def mail @mail end |
#mail_key ⇒ Object (readonly)
Returns the value of attribute mail_key.
7 8 9 |
# File 'lib/gitlab/email/handler/base_handler.rb', line 7 def mail_key @mail_key end |
Instance Method Details
#can_handle? ⇒ Boolean
16 17 18 |
# File 'lib/gitlab/email/handler/base_handler.rb', line 16 def can_handle? raise NotImplementedError end |
#execute ⇒ Object
20 21 22 |
# File 'lib/gitlab/email/handler/base_handler.rb', line 20 def execute raise NotImplementedError end |
#metrics_event ⇒ Object
Each handler should use it’s own metric event. Otherwise there is a possibility that within the same Sidekiq process, that same event with different metrics_params will cause Prometheus to throw an error
32 33 34 |
# File 'lib/gitlab/email/handler/base_handler.rb', line 32 def metrics_event raise NotImplementedError end |
#metrics_params ⇒ Object
24 25 26 |
# File 'lib/gitlab/email/handler/base_handler.rb', line 24 def metrics_params { handler: self.class.name } end |