class Skynet::Response

Attributes

contents[R]
raw_headers[R]
status[R]

Public Class Methods

new(args = {}) click to toggle source
# File lib/skynet/response.rb, line 5
def initialize(args = {})
  @status = args[:status]
  @raw_headers = args[:headers]
  @contents = parsed_contents(args[:contents], args[:error])
end

Private Instance Methods

parsed_contents(contents, error) click to toggle source
# File lib/skynet/response.rb, line 13
def parsed_contents(contents, error)
  return [error] if @status >= 400

  begin
    JSON.parse(contents)
  rescue JSON::ParserError => e
    [contents]
  end
end