Class: Ridley::Middleware::ChefResponse
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Ridley::Middleware::ChefResponse
- Includes:
- Logging
- Defined in:
- lib/ridley/middleware/chef_response.rb
Class Method Summary collapse
-
.success?(env) ⇒ Boolean
Determines if a response from the Chef server was successful.
Instance Method Summary collapse
Methods included from Logging
Class Method Details
.success?(env) ⇒ Boolean
Determines if a response from the Chef server was successful
11 12 13 |
# File 'lib/ridley/middleware/chef_response.rb', line 11 def success?(env) (200..210).to_a.index(env[:status].to_i) ? true : false end |
Instance Method Details
#on_complete(env) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/ridley/middleware/chef_response.rb', line 18 def on_complete(env) log.debug { "==> handling Chef response" } log.debug { "request env: #{env}" } unless self.class.success?(env) log.debug { "** error encounted in Chef response" } raise Errors::HTTPError.fabricate(env) end end |