lib/caseblocks_api.rb in caseblocks_api-0.2.15 vs lib/caseblocks_api.rb in caseblocks_api-0.2.16
- old
+ new
@@ -30,10 +30,13 @@
end
def create_case(params, case_type=nil)
params.merge!(:case_type_id => fetch_case_type_id(case_type))
response = self.class.post("/case_blocks/cases", :body => {:case => params}.to_json)
- raise CaseblocksAPI::CaseCreationError, "Unable to create case - received response code #{response.code}" if response.code != 201
+ if response.code != 201
+ response_hash = {:body => response.body, :code => response.code, :message => response.message, :headers => response.headers.inspect}
+ raise CaseblocksAPI::CaseCreationError.new("Unable to create case - received response code #{response.code}", response_hash)
+ end
end
private
def fetch_case_type_id(case_type_name)