Class: RestCore::XmlDecode
- Inherits:
-
Object
- Object
- RestCore::XmlDecode
- Includes:
- Middleware
- Defined in:
- lib/em-tvdb/xml_middleware.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.members ⇒ Object
4 |
# File 'lib/em-tvdb/xml_middleware.rb', line 4 def self.members; [:xml_decode]; end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/em-tvdb/xml_middleware.rb', line 7 def call(env) return app.call(env) if env[DRY] if env[ASYNC] app.call(env.merge(ASYNC => lambda{ |response| env[ASYNC].call(process(response)) })) else process(app.call(env)) end end |
#process(response) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/em-tvdb/xml_middleware.rb', line 18 def process(response) response['RESPONSE_BODY'] = xml_decode(response['RESPONSE_BODY']) response # rescue # fail(response, error) end |