lib/ecoportal/api/common/response.rb in ecoportal-api-0.9.7 vs lib/ecoportal/api/common/response.rb in ecoportal-api-0.10.0
- old
+ new
@@ -1,20 +1,20 @@
module Ecoportal
module API
module Common
class Response
-
attr_reader :status, :body
+ attr_reader :src_body
def initialize(response)
- @status = response.status
- @body = [].tap do |body_data|
+ @status = response.status
+ @src_body = [].tap do |body_data|
response.body.each do |chunk|
body_data << chunk
end
- end.join("")
- @body = JSON.parse(@body.to_s) rescue nil
- response
+ end.join.to_s
+
+ @body = JSON.parse(@src_body) rescue nil # rubocop:disable Style/RescueModifier
end
def success?
@status.success?
end