Object
XML input is in string format
# File lib/amazon/ecs.rb, line 143 def initialize(xml) @doc = Nokogiri::XML(xml, nil, 'UTF-8') @doc.remove_namespaces! # @doc.xpath("//*").each { |elem| elem.name = elem.name.downcase } # @doc.xpath("//@*").each { |att| att.name = att.name.downcase } end
Return Nokogiri::XML::Document object.
# File lib/amazon/ecs.rb, line 151 def doc @doc end
Return error message.
# File lib/amazon/ecs.rb, line 166 def error Element.get(@doc, "//Error/Message") end
Return error code
# File lib/amazon/ecs.rb, line 171 def error_code Element.get(@doc, "//Error/Code") end
Return the first item (Amazon::Element)
# File lib/amazon/ecs.rb, line 181 def first_item items.first end
Return true if response has an error.
# File lib/amazon/ecs.rb, line 161 def has_error? !(error.nil? || error.empty?) end
Return true if request is valid.
# File lib/amazon/ecs.rb, line 156 def is_valid_request? Element.get(@doc, "//IsValid") == "True" end
Return current page no if :item_page option is when initiating the request.
# File lib/amazon/ecs.rb, line 186 def item_page @item_page ||= Element.get(@doc, "//ItemPage").to_i end
Return an array of Amazon::Element item objects.
# File lib/amazon/ecs.rb, line 176 def items @items ||= (@doc/"Item").collect { |item| Element.new(item) } end
# File lib/amazon/ecs.rb, line 200 def marshal_dump @doc.to_s end
# File lib/amazon/ecs.rb, line 204 def marshal_load(xml) initialize(xml) end
Generated with the Darkfish Rdoc Generator 2.