Sha256: be2eb69214c38a4c04d8768d42feee9da0573fbced6469cba64e37804452355f
Contents?: true
Size: 639 Bytes
Versions: 4
Compression:
Stored size: 639 Bytes
Contents
module Ecoportal module API module Common class Response attr_reader :status, :body def initialize(response) @status = response.status @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 def success? @status.success? end def print puts "Status: #{@status.code}" puts "Body:" puts JSON.pretty_generate(@body) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems