Class: Awsum::Error::ErrorParser

Inherits:
Parser show all
Defined in:
lib/error.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Parser

#parse, #result, #xmldecl

Constructor Details

#initializeErrorParser

Returns a new instance of ErrorParser.



25
26
27
28
# File 'lib/error.rb', line 25

def initialize
  @additional = {}
  @text = ""
end

Instance Attribute Details

#additionalObject (readonly)

Returns the value of attribute additional.



23
24
25
# File 'lib/error.rb', line 23

def additional
  @additional
end

#codeObject (readonly)

Returns the value of attribute code.



23
24
25
# File 'lib/error.rb', line 23

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



23
24
25
# File 'lib/error.rb', line 23

def message
  @message
end

#request_idObject (readonly)

Returns the value of attribute request_id.



23
24
25
# File 'lib/error.rb', line 23

def request_id
  @request_id
end

Instance Method Details

#tag_end(tag) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/error.rb', line 37

def tag_end(tag)
  text = @text.strip
  return if text.blank?

  case tag
    when 'Code'
      @code = text
    when 'Message'
      @message = text
    when 'RequestID', 'RequestId'
      @request_id = text
    else
      @additional[tag] = text
  end
  @text = ''
end

#tag_start(tag, attributes) ⇒ Object



30
31
# File 'lib/error.rb', line 30

def tag_start(tag, attributes)
end

#text(text) ⇒ Object



33
34
35
# File 'lib/error.rb', line 33

def text(text)
  @text << text unless @text.nil?
end