Class: Cuenote::Api::XmlBuilder
- Inherits:
-
Object
- Object
- Cuenote::Api::XmlBuilder
- Defined in:
- lib/cuenote/api/xml_builder.rb
Instance Method Summary collapse
- #add_command(command, id = nil, params = nil) ⇒ Object
- #build ⇒ Object
-
#initialize ⇒ XmlBuilder
constructor
A new instance of XmlBuilder.
Constructor Details
#initialize ⇒ XmlBuilder
Returns a new instance of XmlBuilder.
6 7 8 9 |
# File 'lib/cuenote/api/xml_builder.rb', line 6 def initialize @builder = ::Builder::XmlMarkup.new @commands = [] end |
Instance Method Details
#add_command(command, id = nil, params = nil) ⇒ Object
11 12 13 14 |
# File 'lib/cuenote/api/xml_builder.rb', line 11 def add_command command, id=nil, params=nil id, params = [nil, id] if id && !params && Hash === id @commands << [command, id, params] end |
#build ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/cuenote/api/xml_builder.rb', line 16 def build @builder.forecast do |forecast| @commands.each do |command, id, params| build_command command, id, params end end end |