class Ecoportal::API::Common::Response
Attributes
body[R]
status[R]
Public Class Methods
new(response)
click to toggle source
# File lib/ecoportal/api/common/response.rb, line 8 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
Public Instance Methods
print_pretty()
click to toggle source
# File lib/ecoportal/api/common/response.rb, line 23 def print_pretty puts "Status: #{@status.code}" puts "Body:" puts JSON.pretty_generate(@body) end
success?()
click to toggle source
# File lib/ecoportal/api/common/response.rb, line 19 def success? @status.success? end