class Statuspageio::ResponseError
Attributes
code[R]
errors[R]
response[R]
Public Class Methods
new(res)
click to toggle source
# File lib/statuspageio/response_error.rb, line 6 def initialize(res) @response = res.response @code = res.code begin @errors = parse_errors(res.parsed_response) rescue JSON::ParserError @errors = [res.response.body] end end
Public Instance Methods
to_s()
click to toggle source
# File lib/statuspageio/response_error.rb, line 16 def to_s "#{code.to_s} #{response.msg}".strip end
Private Instance Methods
parse_errors(errors)
click to toggle source
# File lib/statuspageio/response_error.rb, line 22 def parse_errors(errors) return case errors when Hash errors.collect{|k,v| "#{k}: #{v}"} when String [errors] when Array errors else [] end end