Class: Neo4j::Driver::Summary::GqlNotification

Inherits:
GqlStatusObject show all
Defined in:
lib/neo4j/driver/summary/gql_notification.rb

Overview

A GqlStatusObject whose status also maps to a Neo4j notification (the wire status carries a neo4j_code). It exposes the extra notification facets — position, classification and severity — which live in the diagnostic record under _position / _classification / _severity.

The parsed accessors return nil for a value outside the known enum (the backend renders that as "UNKNOWN"); the raw_* accessors hand back whatever the server sent, untouched.

Constant Summary

Constants inherited from GqlStatusObject

Neo4j::Driver::Summary::GqlStatusObject::DIAGNOSTIC_RECORD_DEFAULTS

Instance Attribute Summary

Attributes inherited from GqlStatusObject

#gql_status, #status_description

Instance Method Summary collapse

Methods inherited from GqlStatusObject

#diagnostic_record, #initialize

Constructor Details

This class inherits a constructor from Neo4j::Driver::Summary::GqlStatusObject

Instance Method Details

#classificationObject



24
25
26
# File 'lib/neo4j/driver/summary/gql_notification.rb', line 24

def classification
  raw_classification if Notification::KNOWN_CATEGORIES.include?(raw_classification)
end

#positionObject



16
17
18
# File 'lib/neo4j/driver/summary/gql_notification.rb', line 16

def position
  @data.dig(:diagnostic_record, :_position)&.then { Notification::Position.new(it) }
end

#raw_classificationObject



20
21
22
# File 'lib/neo4j/driver/summary/gql_notification.rb', line 20

def raw_classification
  @data.dig(:diagnostic_record, :_classification)
end

#raw_severityObject



28
29
30
# File 'lib/neo4j/driver/summary/gql_notification.rb', line 28

def raw_severity
  @data.dig(:diagnostic_record, :_severity)
end

#severityObject



32
33
34
# File 'lib/neo4j/driver/summary/gql_notification.rb', line 32

def severity
  raw_severity if Notification::KNOWN_SEVERITIES.include?(raw_severity)
end