Exception: Ogc::Errors::ExceptionReport

Inherits:
OgcError
  • Object
show all
Defined in:
lib/ogc/errors/exception_report.rb

Constant Summary collapse

ROOTS =
%w( ServiceExceptionReport ExceptionReport ).freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ ExceptionReport

Returns a new instance of ExceptionReport.

Raises:

  • (ArgumentError)


16
17
18
19
20
# File 'lib/ogc/errors/exception_report.rb', line 16

def initialize(report)
  raise ArgumentError unless self.class.exception?(report)
  @report = report
  super(first_exception_message)
end

Instance Attribute Details

#reportObject (readonly)

Returns the value of attribute report.



8
9
10
# File 'lib/ogc/errors/exception_report.rb', line 8

def report
  @report
end

Class Method Details

.exception?(report) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/ogc/errors/exception_report.rb', line 11

def exception?(report)
  ROOTS.include?(report.root.name)
end

Instance Method Details

#at_xpath(xpath) ⇒ Object



22
23
24
# File 'lib/ogc/errors/exception_report.rb', line 22

def at_xpath(xpath)
  @report.at_xpath(xpath)
end

#versionObject



30
31
32
33
# File 'lib/ogc/errors/exception_report.rb', line 30

def version
  xpath = @report.at_xpath('/*/@version')
  xpath ? xpath.text : nil
end

#xpath(xpath) ⇒ Object



26
27
28
# File 'lib/ogc/errors/exception_report.rb', line 26

def xpath(xpath)
  @report.xpath(xpath)
end