Class: AirbrakeApi::V3::NoticeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/airbrake_api/v3/notice_parser.rb

Defined Under Namespace

Classes: ParamsError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ NoticeParser

Returns a new instance of NoticeParser


8
9
10
# File 'lib/airbrake_api/v3/notice_parser.rb', line 8

def initialize(params)
  @params = params || {}
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params


6
7
8
# File 'lib/airbrake_api/v3/notice_parser.rb', line 6

def params
  @params
end

Instance Method Details

#reportObject


12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/airbrake_api/v3/notice_parser.rb', line 12

def report
  attributes = {
    error_class: error['type'],
    message: error['message'],
    backtrace: backtrace,
    request: request,
    server_environment: server_environment,
    api_key: params['key'].present? ? params['key'] : params['project_id'],
    notifier: params['notifier'],
    user_attributes: user_attributes
  }

  ErrorReport.new(attributes)
end