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
8
# File 'lib/gitlab_exception_notification/gitlab_notifier.rb', line 5

def initialize(options)
  puts "On init, options => #{options.inspect}"
  @options = options
end

Instance Method Details

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



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

def call(exception, options={})
  puts "On call, exception => #{exception.inspect}, options => #{options.inspect}"
  env = options[:env] || {}
  exception_notification(env, exception, @options.merge(options))
end

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



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

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