def success(response)
      log.info "Parsing response as success..."

      case response['Content-Type']
      when /json/
        log.debug "Detected response as JSON"
        log.debug "Parsing response body as JSON"
        JSON.parse(response.body)
      else
        log.debug "Detected response as text/plain"
        response.body
      end
    end
def success(response)
      log.info "Parsing response as success..."

      case response['Content-Type']
      when /json/
        log.debug "Detected response as JSON"
        log.debug "Parsing response body as JSON"
        JSON.parse(response.body)
      else
        log.debug "Detected response as text/plain"
        response.body
      end
    end
Parse the response object and manipulate the result based on the given
 +Content-Type+ header. For now, this method only parses JSON, but it
 could be expanded in the future to accept other content types.

 @param [HTTP::Message] response
   the response object from the request

 @return [String, Hash]
   the parsed response, as an object