Class: EC2::DescribeImagesResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/EC2/responses.rb

Constant Summary collapse

ELEMENT_XPATH =
"DescribeImagesResponse/imagesSet/item"

Constants inherited from Response

Response::ERROR_XPATH

Instance Attribute Summary

Attributes inherited from Response

#http_response, #http_xml, #structure

Instance Method Summary collapse

Methods inherited from Response

#initialize, #is_error?, #parse_error, #to_s

Constructor Details

This class inherits a constructor from EC2::Response

Instance Method Details

#parseObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/EC2/responses.rb', line 60

def parse
  doc = REXML::Document.new(@http_xml)
  lines = []
  
  doc.elements.each(ELEMENT_XPATH) do |element|
    imageId = REXML::XPath.first(element, "imageId").text
    imageLocation = REXML::XPath.first(element, "imageLocation").text
    imageOwnerId = REXML::XPath.first(element, "imageOwnerId").text
    imageState = REXML::XPath.first(element, "imageState").text
    isPublic = REXML::XPath.first(element, "isPublic").text
    lines << ["IMAGE", imageId, imageLocation, imageOwnerId, imageState, isPublic]
  end
  lines
end