Class: ExceptionNotifier::GitlabNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab_exception_notification/gitlab_notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ GitlabNotifier

Returns a new instance of GitlabNotifier.



5
6
7
# File 'lib/gitlab_exception_notification/gitlab_notifier.rb', line 5

def initialize(options)
  @options = options
end

Instance Method Details

#call(exception, options = {}) ⇒ Object



19
20
21
22
# File 'lib/gitlab_exception_notification/gitlab_notifier.rb', line 19

def call(exception, options={})
  env = options[:env] || {}
  exception_notification(env, exception, @options.merge(options))
end

#exception_notification(env, exception, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/gitlab_exception_notification/gitlab_notifier.rb', line 10

def exception_notification(env, exception, options={})
  issue = GitlabExceptionNotification::Issue.new(env, exception, options)
  if issue_id = issue.exists?
    issue.update(issue_id)
  else
    issue.create
  end
end