Sha256: 1ef7f59926788a5a36f13302710993e106eaa71cb0586b1ca1e59fd9497fe8f2
Contents?: true
Size: 681 Bytes
Versions: 6
Compression:
Stored size: 681 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_pretty puts "Status: #{@status.code}" puts "Body:" puts JSON.pretty_generate(@body) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems