Class: Splunker::FaradayMiddleware

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/splunker/faraday_middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ FaradayMiddleware

Returns a new instance of FaradayMiddleware.



4
5
6
# File 'lib/splunker/faraday_middleware.rb', line 4

def initialize(app)
  super(app)
end

Instance Method Details

#on_complete(env) ⇒ Object



8
9
10
11
12
13
# File 'lib/splunker/faraday_middleware.rb', line 8

def on_complete(env)
  env[:body] = Nokogiri::XML(env[:body])
  Splunker.logger.debug("Response Body: #{env[:body]}")
  Splunker::Errors.raise_error_for_status!(env[:status], env[:body])
  Splunker.logger.debug "Request successful!"
end