Class: Gitlab::Email::Handler::BaseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/email/handler/base_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#mailObject (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_keyObject (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

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/gitlab/email/handler/base_handler.rb', line 16

def can_handle?
  raise NotImplementedError
end

#executeObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/gitlab/email/handler/base_handler.rb', line 20

def execute
  raise NotImplementedError
end

#metrics_eventObject

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

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/gitlab/email/handler/base_handler.rb', line 32

def metrics_event
  raise NotImplementedError
end

#metrics_paramsObject



24
25
26
# File 'lib/gitlab/email/handler/base_handler.rb', line 24

def metrics_params
  { handler: self.class.name }
end