lib/rancher/api/helpers/model.rb in rancher-api-0.5.0 vs lib/rancher/api/helpers/model.rb in rancher-api-0.5.1
- old
+ new
@@ -23,10 +23,18 @@
raise RancherActionNotAvailableError, "Available actions: '#{actions.inspect}'" if url.blank?
handle_response(self.class.post(url, data))
end
def handle_response(response)
- raise RancherModelError, response.inspect if response.type.eql?('error')
+ case response
+ when Her::Collection
+ response
+ when Her::Model
+ raise RancherModelError, response.inspect if response.type.eql?('error')
+ response
+ else
+ raise RancherModelError, response.inspect
+ end
end
def wait_for_state(desired_state)
EM.run do
EM.add_timer(TIMEOUT_LIMIT) do