NAME

InfluxDB::Client::Response - response class of the InfluxDB::Client

VERSION

version 0.1

METHODS

new(%args)

creates a new InfluxDB::Client::Response instance.

The arguments are:

  • http_response the HTTP::Response object returned from a request to the InfluxDB

  • status the HTTP::Response object returned from a request to the InfluxDB

  • content the HTTP::Response object returned from a request to the InfluxDB

If http_response is given, all other arguments are ignored.

status will default to InfluxDB::Client::Response::Status::OK.

If status is InfluxDB::Client::Response::Status::OK and content is a string, content will be parsed as JSON.

status()

returns: the InfluxDB::Client::Response::Status value of the response

status($status)

Sets the status to $status

returns: the new InfluxDB::Client::Response::Status value of the response

http_code()

returns: the original code of the HTTP::Response if this object was created or updated with a valid HTTP::Response

content()

returns: the content of the response

content($content)

Sets the content to $content

If $content is a string, it will be parsed with JSON. If any parsing errors occour, the result will be undef, the status will be set to InfluxDB::Client::Response::Status::INTFAIL and error() will return the full error message of JSON

If $content is a reference, it will just stored as the new content without further processing

returns: the new content of the response

error()

returns: the error string of the object

error($error)

Sets the error string to $status

returns: the new error string of the object

meta()

returns: the InfluxDB::Client::Response::Meta Object of the response

parse_http_response($response)

Parses the given $response, and updates the object

$response must be a HTTP::Response object

returns: the new InfluxDB::Client::Response::Status value of the response

AUTHOR

Thomas Berger <thomas.berger@1und1.de>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017 by 1&1 Telecommunication SE.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004