Class: Moon::Response::XML
Overview
Moon::Response::XML is the base class for all xml responses.
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
-
#initialize(status, hash = { }) ⇒ XML
constructor
A new instance of XML.
Constructor Details
#initialize(status, hash = { }) ⇒ XML
Returns a new instance of XML.
9 10 11 |
# File 'lib/moon/response/xml.rb', line 9 def initialize(status, hash = { }) @status, @hash = status, hash end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
7 8 9 |
# File 'lib/moon/response/xml.rb', line 7 def hash @hash end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/moon/response/xml.rb', line 6 def status @status end |
Instance Method Details
#body ⇒ Object
17 18 19 20 21 |
# File 'lib/moon/response/xml.rb', line 17 def body XmlSimple.xml_out @hash, "XmlDeclaration" => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "KeepRoot" => true end |
#headers ⇒ Object
13 14 15 |
# File 'lib/moon/response/xml.rb', line 13 def headers { "Content-Type" => "text/xml" } end |