Class: Response::ParseSlideshareXml
- Inherits:
-
Middleware
- Object
- Middleware
- Response::ParseSlideshareXml
- Defined in:
- lib/faraday/parse_slideshare_xml.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(app) ⇒ ParseSlideshareXml
constructor
A new instance of ParseSlideshareXml.
Constructor Details
#initialize(app) ⇒ ParseSlideshareXml
Returns a new instance of ParseSlideshareXml.
28 29 30 31 |
# File 'lib/faraday/parse_slideshare_xml.rb', line 28 def initialize(app) super @parser = nil end |
Class Method Details
.register_on_complete(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/faraday/parse_slideshare_xml.rb', line 14 def self.register_on_complete(env) # parse and raise either proper error or just return the response env[:response].on_complete do |response| response[:body] = begin error_id = nil doc = Nokogiri::XML(response[:body]) doc.search('Message').each do |node| raise Slideshare::SlideshareError, (response, node['ID'].to_s + " " + node.text) end ::MultiXml.parse(response[:body]) end end end |