Class: Neo4j::Driver::Summary::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/driver/summary/notification.rb

Overview

Server-emitted notification (e.g. "this query has a missing index"). Mirrors org.neo4j.driver.summary.Notification.

Defined Under Namespace

Classes: Position

Constant Summary collapse

KNOWN_SEVERITIES =

Severity mapping matches the Java driver's NotificationSeverity: WARNING/INFORMATION/OFF/UNKNOWN. Anything else stays as nil on severity_level but is preserved verbatim in raw_severity_level.

%w[WARNING INFORMATION OFF UNKNOWN].freeze
KNOWN_CATEGORIES =
%w[HINT UNRECOGNIZED UNSUPPORTED PERFORMANCE
DEPRECATION GENERIC SECURITY TOPOLOGY SCHEMA].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Notification

Returns a new instance of Notification.



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/neo4j/driver/summary/notification.rb', line 19

def initialize(data)
  @code = data[:code]
  @title = data[:title]
  @description = data[:description]
  # Old wire format used :severity, newer uses :severityLevel.
  @raw_severity_level = data[:severityLevel] || data[:severity]
  @severity_level = KNOWN_SEVERITIES.include?(@raw_severity_level) ? @raw_severity_level : 'UNKNOWN'
  @severity = @raw_severity_level
  @raw_category = data[:category]
  @category = KNOWN_CATEGORIES.include?(@raw_category) ? @raw_category : 'UNKNOWN'
  @position = data[:position] && Position.new(data[:position])
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



9
10
11
# File 'lib/neo4j/driver/summary/notification.rb', line 9

def category
  @category
end

#codeObject (readonly)

Returns the value of attribute code.



9
10
11
# File 'lib/neo4j/driver/summary/notification.rb', line 9

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



9
10
11
# File 'lib/neo4j/driver/summary/notification.rb', line 9

def description
  @description
end

#positionObject (readonly)

Returns the value of attribute position.



9
10
11
# File 'lib/neo4j/driver/summary/notification.rb', line 9

def position
  @position
end

#raw_categoryObject (readonly)

Returns the value of attribute raw_category.



9
10
11
# File 'lib/neo4j/driver/summary/notification.rb', line 9

def raw_category
  @raw_category
end

#raw_severity_levelObject (readonly)

Returns the value of attribute raw_severity_level.



9
10
11
# File 'lib/neo4j/driver/summary/notification.rb', line 9

def raw_severity_level
  @raw_severity_level
end

#severityObject (readonly)

Returns the value of attribute severity.



9
10
11
# File 'lib/neo4j/driver/summary/notification.rb', line 9

def severity
  @severity
end

#severity_levelObject (readonly)

Returns the value of attribute severity_level.



9
10
11
# File 'lib/neo4j/driver/summary/notification.rb', line 9

def severity_level
  @severity_level
end

#titleObject (readonly)

Returns the value of attribute title.



9
10
11
# File 'lib/neo4j/driver/summary/notification.rb', line 9

def title
  @title
end