Class: XmlBuilder
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- XmlBuilder
- Defined in:
- lib/royal_mail_api/xml_builder.rb
Constant Summary collapse
- SPECIAL_CHARACTER_MAP =
{ '"' => """, "&" => "&", "'" => "'", "<" => "<", ">" => ">" }
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(request, attrs = {}) ⇒ XmlBuilder
constructor
A new instance of XmlBuilder.
Constructor Details
#initialize(request, attrs = {}) ⇒ XmlBuilder
Returns a new instance of XmlBuilder.
15 16 17 18 19 20 21 22 23 |
# File 'lib/royal_mail_api/xml_builder.rb', line 15 def initialize(request, attrs={}) @request = request attrs = attrs.reduce({}) do |hash,(k,v)| hash[k]=parse_special_characters(v); hash end super attrs end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
5 6 7 |
# File 'lib/royal_mail_api/xml_builder.rb', line 5 def request @request end |
Instance Method Details
#build ⇒ Object
25 26 27 |
# File 'lib/royal_mail_api/xml_builder.rb', line 25 def build envelope end |