class Upkey::Helios::Response
Attributes
contents[R]
raw_headers[R]
status[R]
Public Class Methods
new(args = {})
click to toggle source
# File lib/upkey/helios/response.rb, line 8 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/upkey/helios/response.rb, line 16 def parsed_contents(contents, error) return [error] if @status >= 400 begin JSON.parse(contents) unless @status == 204 rescue JSON::ParserError => e [contents] end end