Class: Ridley::Middleware::ChefResponse
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Ridley::Middleware::ChefResponse
- 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
Class Method Details
.success?(env) ⇒ Boolean
Determines if a response from the Chef server was successful
12 13 14 |
# File 'lib/ridley/middleware/chef_response.rb', line 12 def success?(env) (200..210).to_a.index(env[:status].to_i) ? true : false end |
Instance Method Details
#on_complete(env) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/ridley/middleware/chef_response.rb', line 17 def on_complete(env) Ridley.log.debug("Handling Chef Response") Ridley.log.debug(env) unless self.class.success?(env) Ridley.log.debug("Error encounted in Chef Response") raise Errors::HTTPError.fabricate(env) end end |