Class: RaygunClient::Data

Inherits:
Object
  • Object
show all
Includes:
Schema::DataStructure
Defined in:
lib/raygun_client/data.rb,
lib/raygun_client/data/client_info.rb

Defined Under Namespace

Modules: Transform Classes: ClientInfo

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/raygun_client/data.rb', line 12

def ==(other)
  self.class == other.class &&
    occurred_time == other.occurred_time &&
    machine_name == other.machine_name &&
    client == other.client &&
    error == other.error
end

#transform_write(data) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/raygun_client/data.rb', line 20

def transform_write(data)
  data[:occurred_on] = data.delete(:occurred_time)

  details = {}
  details[:machine_name] = data.delete(:machine_name)

  client = data.delete(:client)
  details[:client] = client.to_h

  error = data.delete(:error)

  error_data = {}
  error_data[:class_name] = error.class_name
  error_data[:message] = error.message

  stack_trace = []
  error.backtrace.each do |frame|
    frame_data = {}
    frame_data[:file_name] = frame.filename
    frame_data[:line_number] = frame.line_number
    frame_data[:method_name] = frame.method_name
    stack_trace << frame_data
  end

  error_data[:stack_trace] = stack_trace

  details[:error] = error_data

  tags = data.delete(:tags)
  details[:tags] = tags unless tags.empty?

  custom_data = data.delete(:custom_data)
  details[:user_custom_data] = custom_data unless custom_data.empty?

  data[:details] = details
end