Class: YouTubeG::Parser::UploadErrorParser
- Inherits:
-
Object
- Object
- YouTubeG::Parser::UploadErrorParser
- Defined in:
- lib/youtube_g/parser.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(xml) ⇒ UploadErrorParser
constructor
A new instance of UploadErrorParser.
- #parse ⇒ Object
Constructor Details
#initialize(xml) ⇒ UploadErrorParser
Returns a new instance of UploadErrorParser.
33 34 35 36 |
# File 'lib/youtube_g/parser.rb', line 33 def initialize(xml) raise YouTubeG::Parser::FeedParserError.new("You must pass some xml") if xml == '' @doc = REXML::Document.new(xml) end |
Instance Method Details
#parse ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/youtube_g/parser.rb', line 38 def parse upload_errors = [] @doc.elements.each("//error") do |error| location = error.elements["location"].text #[/media:group\/media:(.*)\/text\(\)/,1] code = error.elements["code"].text domain = error.elements["domain"].text upload_errors << YouTubeG::Model::UploadError.new(:location => location, :code => code, :domain => domain) end return upload_errors end |