lib/immoscout/models/concerns/modelable.rb in immoscout-1.3.1 vs lib/immoscout/models/concerns/modelable.rb in immoscout-1.3.2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'json'
module Immoscout
module Models
module Concerns
@@ -35,19 +37,20 @@
new(unpack(hash))
end
def handle_response(response)
return response if response.success?
+
raise Immoscout::Errors::Failed, response
end
def id_from_response(response)
response
.body
- .fetch("common.messages")
+ .fetch('common.messages')
.first
- .fetch("message", {})
- .fetch("id", nil)
+ .fetch('message', {})
+ .fetch('id', nil)
end
end
end
end
end