class Deltacloud::EC2::ResultParser

Attributes

context[R]
object[R]
query[R]

Public Class Methods

new(query, object, context) click to toggle source
# File lib/ec2/query_parser.rb, line 89
def initialize(query, object, context)
  @context = context
  @query = query
  @object = object
end
parse(query, result, context) click to toggle source
# File lib/ec2/query_parser.rb, line 81
def self.parse(query, result, context)
  parser = new(query, result, context)
  layout = "%#{query.action.to_s.camelize}Response{:xmlns => 'http://ec2.amazonaws.com/doc/2012-04-01/'}\n"+
    "\t%requestId #{query.request_id}\n" +
    "\t=render(:#{query.action}, object)\n"
  Haml::Engine.new(layout, :filename => 'layout').render(parser)
end

Public Instance Methods

build_xml() click to toggle source
# File lib/ec2/query_parser.rb, line 95
def build_xml
  Converter.convert(query.action, object)
end
render(template, obj) click to toggle source
# File lib/ec2/query_parser.rb, line 99
def render(template, obj)
  template_filename = File.join(File.dirname(__FILE__), 'views', '%s.haml' % template.to_s)
  Haml::Engine.new(File.read(template_filename), :filename => template_filename).render(self, :object => obj)
end