class Datacentred::Response
A response from the API server.
Attributes
body[R]
status[R]
Public Class Methods
new(server_response)
click to toggle source
A response from the API server, initialized with A Faraday HTTP Response
.
@param [Faraday::Response] server_response A response object returned from Faraday. @raise [Errors::Error] Raised if response isn't a 2xx status code.
# File lib/datacentred/response.rb, line 10 def initialize(server_response) @body = JSON.parse server_response.body rescue nil @status = server_response.status Errors.raise_unless_successful(status, @body) end