Class: InfluxDB2::PingApi
- Inherits:
-
DefaultApi
- Object
- DefaultApi
- InfluxDB2::PingApi
- Defined in:
- lib/influxdb2/client/ping_api.rb
Overview
The client of the InfluxDB 2.x that implement Ping HTTP API endpoint.
Constant Summary
Constants inherited from DefaultApi
DefaultApi::DEFAULT_REDIRECT_COUNT, DefaultApi::DEFAULT_TIMEOUT, DefaultApi::HEADER_CONTENT_TYPE
Instance Method Summary collapse
-
#initialize(options:) ⇒ PingApi
constructor
A new instance of PingApi.
-
#ping ⇒ Ping
Checks the status of InfluxDB instance and version of InfluxDB.
Methods inherited from DefaultApi
Constructor Details
#initialize(options:) ⇒ PingApi
Returns a new instance of PingApi.
27 28 29 |
# File 'lib/influxdb2/client/ping_api.rb', line 27 def initialize(options:) super(options: ) end |
Instance Method Details
#ping ⇒ Ping
Checks the status of InfluxDB instance and version of InfluxDB.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/influxdb2/client/ping_api.rb', line 34 def ping uri = _parse_uri('/ping') headers = _get(uri) Ping.new.tap do |model| model.status = 'ok' model.build = headers['X-Influxdb-Build'] model.version = headers['X-Influxdb-Version'] model. = 'ready for queries and writes' end rescue StandardError => e Ping.new.tap do |model| model.status = 'fail' model. = e. end end |