Class: ITunes::Store::Transporter::XML::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/itunes/store/transporter/xml/status.rb

Overview

XML parser for the status and statusAll commands XML output

Constant Summary collapse

NA =
"N/A".freeze

Instance Method Summary collapse

Instance Method Details

#parse(xml) ⇒ Object

Parse status or statusAll XML

Arguments

xml (String|IO)

The XML

Errors

ParseError, ExecutionError

An ExecutionError is raised if the XML contains iTMSTransporter error messages.

Returns

A Hash representation of the XML output. Hash keys and values are slightly different (better, I hope) than the elements and attributes returned by Apple. See the documentation for ITunes::Store::Transporter::ITMSTransporter#status

Raises:

  • (self)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/itunes/store/transporter/xml/status.rb', line 36

def parse(xml)
  doc = _parse(xml)
  status = []

  # No elements means there's just text nodes with an error message
  raise self, doc.root.get_text.to_s unless doc.root.has_elements?

  doc.root.each_element do |e|
    next unless e.node_type == :element
    status << upload_status(e)
  end

  status
end