Class: Awsum::Error::ErrorParser

Inherits:
Parser show all
Defined in:
lib/awsum/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.



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

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

Instance Attribute Details

#additionalObject (readonly)

Returns the value of attribute additional.



21
22
23
# File 'lib/awsum/error.rb', line 21

def additional
  @additional
end

#codeObject (readonly)

Returns the value of attribute code.



21
22
23
# File 'lib/awsum/error.rb', line 21

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



21
22
23
# File 'lib/awsum/error.rb', line 21

def message
  @message
end

#request_idObject (readonly)

Returns the value of attribute request_id.



21
22
23
# File 'lib/awsum/error.rb', line 21

def request_id
  @request_id
end

Instance Method Details

#tag_end(tag) ⇒ Object



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

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



28
29
# File 'lib/awsum/error.rb', line 28

def tag_start(tag, attributes)
end

#text(text) ⇒ Object



31
32
33
# File 'lib/awsum/error.rb', line 31

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