{"id":17463030,"url":"https://github.com/influxdata/influxdb-client-ruby","last_synced_at":"2025-05-15T17:07:25.007Z","repository":{"id":39822836,"uuid":"225798392","full_name":"influxdata/influxdb-client-ruby","owner":"influxdata","description":"InfluxDB 2.0 Ruby Client","archived":false,"fork":false,"pushed_at":"2025-01-01T12:07:32.000Z","size":836,"stargazers_count":48,"open_issues_count":6,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-11T23:57:54.921Z","etag":null,"topics":["flux","influxdata","influxdb","ruby","timeseries"],"latest_commit_sha":null,"homepage":"https://influxdata.github.io/influxdb-client-ruby/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/influxdata.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-04T06:45:01.000Z","updated_at":"2025-04-08T21:43:09.000Z","dependencies_parsed_at":"2023-11-14T11:31:05.656Z","dependency_job_id":"a120bb54-2f3b-43c2-acae-f94f2410dd3b","html_url":"https://github.com/influxdata/influxdb-client-ruby","commit_stats":{"total_commits":186,"total_committers":14,"mean_commits":"13.285714285714286","dds":"0.13440860215053763","last_synced_commit":"d0fb0d5a27e84088370a539140a2dcdbdbe9bb4b"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-client-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-client-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-client-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-client-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/influxdata","download_url":"https://codeload.github.com/influxdata/influxdb-client-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254133014,"owners_count":22020258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flux","influxdata","influxdb","ruby","timeseries"],"created_at":"2024-10-18T10:07:51.805Z","updated_at":"2025-05-15T17:07:19.997Z","avatar_url":"https://github.com/influxdata.png","language":"Ruby","readme":"# influxdb-client-ruby\n\n[![CircleCI](https://circleci.com/gh/influxdata/influxdb-client-ruby.svg?style=svg)](https://circleci.com/gh/influxdata/influxdb-client-ruby)\n[![codecov](https://codecov.io/gh/influxdata/influxdb-client-ruby/branch/master/graph/badge.svg)](https://codecov.io/gh/influxdata/influxdb-client-ruby)\n[![Gem Version](https://badge.fury.io/rb/influxdb-client.svg)](https://badge.fury.io/rb/influxdb-client)\n[![License](https://img.shields.io/github/license/influxdata/influxdb-client-ruby.svg)](https://github.com/influxdata/influxdb-client-ruby/blob/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues-raw/influxdata/influxdb-client-ruby.svg)](https://github.com/influxdata/influxdb-client-ruby/issues)\n[![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/influxdata/influxdb-client-ruby.svg)](https://github.com/influxdata/influxdb-client-ruby/pulls)\n[![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack\u0026style=social)](https://www.influxdata.com/slack)\n\nThis repository contains the reference Ruby client for the InfluxDB 2.x.\n\n#### Note: Use this client library with InfluxDB 2.x and InfluxDB 1.8+ ([see details](#influxdb-18-api-compatibility)). For connecting to InfluxDB 1.7 or earlier instances, use the [influxdb-ruby](https://github.com/influxdata/influxdb-ruby) client library.\n\n- [Features](#features)\n- [Installation](#installation)\n    - [Install the Gem](#install-the-gem)\n- [Usage](#usage)\n    - [Creating a client](#creating-a-client)\n    - [Writing data](#writing-data)\n    - [Querying data](#queries)\n    - [Delete data](#delete-data)\n    - [Management API](#management-api)\n- [Advanced Usage](#advanced-usage)\n    - [Default Tags](#default-tags)\n    - [Proxy configuration](#proxy-configuration)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Documentation\n\nThis section contains links to the client library documentation.\n\n* [Product documentation](https://docs.influxdata.com/influxdb/latest/api-guide/client-libraries/), [Getting Started](#installation)\n* [Examples](examples)\n* [API Reference](https://influxdata.github.io/influxdb-client-ruby/InfluxDB2.html)\n* [Changelog](CHANGELOG.md)\n\n## Features\n\nInfluxDB 2.x client consists of two packages\n\n- `influxdb-client`\n    - Querying data using the Flux language\n    - Writing data\n        - batched in chunks on background\n        - automatic retries on write failures\n- `influxdb-client-apis`\n    - provides all other InfluxDB 2.x APIs for managing\n        - buckets\n        - labels\n        - authorizations\n        - ...\n    - built on top of `influxdb-client`\n\n## Installation\n\nThe InfluxDB 2 client is bundled as a gem and is hosted on [Rubygems](https://rubygems.org/gems/influxdb-client).\n\n### Install the Gem\n\nThe client can be installed manually or with bundler.\n\nTo install the client gem manually:\n\n```\ngem install influxdb-client -v 3.2.0\n```\n\nFor management API:\n\n```\ngem install influxdb-client-apis -v 3.2.0\n```\n\n## Usage\n\n### Creating a client\n\nUse **InfluxDB::Client** to create a client connected to a running InfluxDB 2 instance.\n\n```ruby\nclient = InfluxDB2::Client.new('https://localhost:8086', 'my-token')\n\nclient.do_something\n\nclient.close!\n```\n\nthe **InfluxDB::Client** can be also used as a resource:\n\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token') do |client|\n  client.do_something\nend\n```\n\n#### Client Options\n\n| Option                         | Description                                                                        | Type                                                       | Default  |\n|--------------------------------|------------------------------------------------------------------------------------|------------------------------------------------------------|----------|\n| bucket                         | Default destination bucket for writes                                              | String                                                     | none     |\n| org                            | Default organization bucket for writes                                             | String                                                     | none     |\n| precision                      | Default precision for the unix timestamps within the body line-protocol            | String                                                     | none     |\n| open_timeout                   | Number of seconds to wait for the connection to open                               | Integer                                                    | 10       |\n| write_timeout                  | Number of seconds to wait for one block of data to be written                      | Integer                                                    | 10       |\n| read_timeout                   | Number of seconds to wait for one block of data to be read                         | Integer                                                    | 10       |\n| max_redirect_count             | Maximal number of followed HTTP redirects                                          | Integer                                                    | 10       |\n| redirect_forward_authorization | Pass Authorization header to different domain during HTTP redirect.                | bool                                                       | false    |\n| use_ssl                        | Turn on/off SSL for HTTP communication                                             | bool                                                       | true     |\n| verify_mode                    | Sets the flags for the certification verification at beginning of SSL/TLS session. | `OpenSSL::SSL::VERIFY_NONE` or `OpenSSL::SSL::VERIFY_PEER` | none     |\n| logger                         | Logger used for logging. Disable logging by set to false.                          | Logger                                                     | `STDOUT` |\n| debugging                      | Enable debugging for HTTP request/response.                                        | bool                                                       | false    |\n\n```ruby\nclient = InfluxDB2::Client.new('https://localhost:8086', 'my-token',\n  bucket: 'my-bucket',\n  org: 'my-org',\n  precision: InfluxDB2::WritePrecision::NANOSECOND)\n```\n\n### Queries\n\nThe result retrieved by [QueryApi](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/query_api.rb) could be formatted as a:\n\n   1. Raw query response\n   2. Flux data structure: [FluxTable, FluxColumn and FluxRecord](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/flux_table.rb)\n   3. Stream of [FluxRecord](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/flux_table.rb)\n\n#### Query raw\n\nSynchronously executes the Flux query and return result as unprocessed String\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token', org: 'my-org') do |client|\n\n  result = client\n    .create_query_api\n    .query_raw(query: 'from(bucket:\"my-bucket\") |\u003e range(start: 1970-01-01) |\u003e last()')\n  puts result\nend\n```\n#### Synchronous query\nSynchronously executes the Flux query and return result as a Array of [FluxTables](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/flux_table.rb)\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token', org: 'my-org') do |client|\n\n  result = client\n    .create_query_api\n    .query(query: 'from(bucket:\"my-bucket\") |\u003e range(start: 1970-01-01) |\u003e last()')\n  \n  result.each do |table|\n    table.records.each { |record| puts record.values }\n  end\nend\n```\n\n#### Query stream\nSynchronously executes the Flux query and return stream of [FluxRecord](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/flux_table.rb)\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token', org: 'my-org') do |client|\n\n  stream = client\n    .create_query_api\n    .query_stream(query: 'from(bucket:\"my-bucket\") |\u003e range(start: 1970-01-01) |\u003e last()')\n\n  stream.each do |record|\n    puts record.values\n  end\nend\n```\n\n#### Parameterized queries\nInfluxDB Cloud supports [Parameterized Queries](https://docs.influxdata.com/influxdb/cloud/query-data/parameterized-queries/)\nthat let you dynamically change values in a query using the InfluxDB API. Parameterized queries make Flux queries more\nreusable and can also be used to help prevent injection attacks.\n\nInfluxDB Cloud inserts the params object into the Flux query as a Flux record named `params`. Use dot or bracket\nnotation to access parameters in the `params` record in your Flux query. Parameterized Flux queries support only `int`\n, `float`, and `string` data types. To convert the supported data types into\nother [Flux basic data types, use Flux type conversion functions](https://docs.influxdata.com/influxdb/cloud/query-data/parameterized-queries/#supported-parameter-data-types).\n\nParameterized query example:\n\u003e :warning: Parameterized Queries are supported only in InfluxDB Cloud, currently there is no support in InfluxDB OSS.\n\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token', org: 'my-org') do |client|\n\n    query = 'from(bucket: params.bucketParam) |\u003e range(start: duration(v: params.startParam))'\n    params = { 'bucketParam' =\u003e 'my-bucket', 'startParam' =\u003e '-1h' }\n    \n    query_api = client.create_query_api\n    result = query_api.query(query: query, params: params)\n    \n    result[0].records.each { |record| puts \"#{record.time} #{record.measurement}: #{record.field} #{record.value}\" }\nend\n```\n\n### Writing data\nThe [WriteApi](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/write_api.rb) supports synchronous and batching writes into InfluxDB 2.x. In default api uses synchronous write. To enable batching you can use WriteOption.\n\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token',\n                      bucket: 'my-bucket',\n                      org: 'my-org',\n                      precision: InfluxDB2::WritePrecision::NANOSECOND) do |client|\n\n  write_api = client.create_write_api\n  write_api.write(data: 'h2o,location=west value=33i 15')\nend\n```\n\n#### Batching\nThe writes are processed in batches which are configurable by `WriteOptions`:\n\n| Property                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Default Value |\n|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| batch_size                | the number of data point to collect in batch                                                                                                                                                                                                                                                                                                                                                                                                                                         | 1_000         |\n| flush_interval           | the number of milliseconds before the batch is written                                                                                                                                                                                                                                                                                                                                                                                                                               | 1_000         |\n| retry_interval           | the number of milliseconds to retry unsuccessful write. The retry interval is used when the InfluxDB server does not specify \"Retry-After\" header.                                                                                                                                                                                                                                                                                                                                   | 5_000         |\n| jitter_interval          | the number of milliseconds to increase the batch flush interval by a random amount                                                                                                                                                                                                                                                                                                                                                                                                   | 0             |\n| max_retries              | the number of max retries when write fails                                                                                                                                                                                                                                                                                                                                                                                                                                           | 5             |\n| max_retry_delay          | maximum delay when retrying write in milliseconds                                                                                                                                                                                                                                                                                                                                                                                                                                    | 125_000       |\n| max_retry_time           | maximum total retry timeout in milliseconds                                                                                                                                                                                                                                                                                                                                                                                                                                          | 180_000       |\n| exponential_base         | the base for the exponential retry delay, the next delay is computed using random exponential backoff as a random value within the interval  ``retry_interval * exponential_base^(attempts-1)`` and ``retry_interval * exponential_base^(attempts)``. Example for ``retry_interval=5000, exponential_base=2, max_retry_delay=125000, total=5`` Retry delays are random distributed values within the ranges of ``[5000-10000, 10000-20000, 20000-40000, 40000-80000, 80000-125000]`` | 2             |\n| batch_abort_on_exception | the batching worker will be aborted after failed retry strategy                                                                                                                                                                                                                                                                                                                                                                                                                      | false         |\n```ruby\nInfluxDB2::Client.use('http://localhost:8086',\n                      'my-token',\n                      bucket: 'my-bucket',\n                      org: 'my-org',\n                      precision: InfluxDB2::WritePrecision::NANOSECOND,\n                      use_ssl: false) do |client|\n\n  write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BATCHING,\n                                              batch_size: 10, flush_interval: 5_000,\n                                              max_retries: 3, max_retry_delay: 15_000,\n                                              exponential_base: 2)\n\n  write_api = client.create_write_api(write_options: write_options)\n  write_api.write(data: 'h2o,location=west value=33i 15')\nend\n```\n\n#### Time precision\n\nConfigure default time precision:\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token',\n                      bucket: 'my-bucket',\n                      org: 'my-org',\n                      precision: InfluxDB2::WritePrecision::NANOSECOND) do |client|\n\n  client.do_something\nend\n```\n\nConfigure precision per write:\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token',\n                      bucket: 'my-bucket',\n                      org: 'my-org',\n                      precision: InfluxDB2::WritePrecision::NANOSECOND) do |client|\n\n  write_api = client.create_write_api\n  write_api.write(data: 'h2o,location=west value=33i 15', precision: InfluxDB2::WritePrecision::SECOND)\nend\n```\nAllowed values for precision are:\n- `InfluxDB2::WritePrecision::NANOSECOND` for nanosecond\n- `InfluxDB2::WritePrecision::MICROSECOND` for microsecond\n- `InfluxDB2::WritePrecision::MILLISECOND` for millisecond\n- `InfluxDB2::WritePrecision::SECOND` for second\n\n#### Configure destination\n\nDefault `bucket` and `organization` destination are configured via `InfluxDB::Client`:\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token',\n                      bucket: 'my-bucket',\n                      org: 'my-org') do |client|\n\n  client.do_something\nend\n```\n\nbut there is also possibility to override configuration per write:\n\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token') do |client|\n\n  write_api = client.create_write_api\n  write_api.write(data: 'h2o,location=west value=33i 15', bucket: 'production-data', org: 'customer-1')\nend\n```\n\n#### Data format\n\nThe data could be written as:\n\n1. `String` that is formatted as a InfluxDB's line protocol\n1. `Hash` with keys: name, tags, fields and time\n1. [Data Point](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/point.rb#L28) structure\n1. `Array` of above items\n\n```ruby\nInfluxDB2::Client.use('https://localhost:8086', 'my-token',\n                      bucket: 'my-bucket',\n                      org: 'my-org',\n                      precision: InfluxDB2::WritePrecision::NANOSECOND) do |client|\n\n  point = InfluxDB2::Point.new(name: 'h2o')\n                          .add_tag('location', 'europe')\n                          .add_field('level', 2)\n\n  hash = { name: 'h2o',\n           tags: { host: 'aws', region: 'us' },\n           fields: { level: 5, saturation: '99%' }, time: 123 }\n\n  write_api = client.create_write_api\n  write_api.write(data: ['h2o,location=west value=33i 15', point, hash])\nend\n```\n\n#### Default Tags\n\nSometimes is useful to store same information in every measurement e.g. `hostname`, `location`, `customer`. \nThe client is able to use static value, app settings or env variable as a tag value.\n\nThe expressions:\n- `California Miner` - static value\n- `${env.hostname}` - environment property\n\n##### Via API\n\n```ruby\nInfluxDB2::Client.use('http://localhost:8086', 'my-token',\n                      bucket: 'my-bucket',\n                      org: 'my-org',\n                      precision: InfluxDB2::WritePrecision::NANOSECOND,\n                      use_ssl: false,\n                      tags: { id: '132-987-655' }) do |client|\n\n  point_settings = InfluxDB2::PointSettings.new(default_tags: { customer: 'California Miner' })\n  point_settings.add_default_tag('data_center', '${env.data_center}')\n\n  write_api = client.create_write_api(write_options: InfluxDB2::SYNCHRONOUS,\n                                      point_settings: point_settings)\n\n  write_api.write(data: InfluxDB2::Point.new(name: 'h2o')\n                                        .add_tag('location', 'europe')\n                                        .add_field('level', 2))\nend\n```\n\n### Delete data\n\nThe [DeleteApi](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/delete_api.rb) supports deletes [points](https://docs.influxdata.com/influxdb/latest/reference/key-concepts/data-elements/#point) from an InfluxDB bucket.\n\n```ruby\nInfluxDB2::Client.use('http://localhost:8086', 'my-token',\n                      bucket: 'my-bucket',\n                      org: 'my-org',\n                      precision: InfluxDB2::WritePrecision::NANOSECOND) do |client|\n\n  client.create_delete_api.delete(DateTime.rfc3339('2019-02-03T04:05:06+07:00'),\n                                  DateTime.rfc3339('2019-03-03T04:05:06+07:00'),\n                                  predicate: 'key1=\"value1\" AND key2=\"value\"')\nend\n```\n\nThe time range could be specified as:\n\n1. String - `\"2019-02-03T04:05:06+07:00\"`\n1. DateTime - `DateTime.rfc3339('2019-03-03T04:05:06+07:00')`\n1. Time - `Time.utc(2015, 10, 16, 8, 20, 15)`\n\n### Management API\n\nThe client supports following management API:\n\n|                                                                                                                 | API docs                                                              |\n|-----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|\n| [**AuthorizationsApi**](https://influxdata.github.io/influxdb-client-ruby/InfluxDB2/API/AuthorizationsApi.html) | https://docs.influxdata.com/influxdb/latest/api/#tag/Authorizations   |\n| [**BucketsApi**](https://influxdata.github.io/influxdb-client-ruby/InfluxDB2/API/BucketsApi.html)               | https://docs.influxdata.com/influxdb/latest/api/#tag/Buckets          |\n| [**LabelsApi**](https://influxdata.github.io/influxdb-client-ruby/InfluxDB2/API/LabelsApi.html)                 | https://docs.influxdata.com/influxdb/latest/api/#tag/Labels           |\n| [**OrganizationsApi**](https://influxdata.github.io/influxdb-client-ruby/InfluxDB2/API/OrganizationsApi.html)   | https://docs.influxdata.com/influxdb/latest/api/#tag/Organizations    |\n| [**UsersApi**](https://influxdata.github.io/influxdb-client-ruby/InfluxDB2/API/UsersApi.html)                   | https://docs.influxdata.com/influxdb/latest/api/#tag/Users            |\n\n\nThe following example demonstrates how to use a InfluxDB 2.x Management API to create new bucket. For further information see docs and [examples](/examples).\n\n```ruby\n#\n# This is an example how to create new bucket with permission to write.\n#\n# You could run example via: `cd apis \u0026\u0026 bundle exec ruby ../examples/create_new_bucket.rb`\n#\n$LOAD_PATH.unshift File.expand_path('../lib', __dir__)\nrequire 'influxdb-client'\n$LOAD_PATH.unshift File.expand_path('../apis/lib', __dir__)\nrequire 'influxdb-client-apis'\n\nurl = 'http://localhost:8086'\nbucket = 'my-bucket'\norg = 'my-org'\ntoken = 'my-token'\n\nInfluxDB2::Client.use(url,\n                      token,\n                      bucket: bucket,\n                      org: org,\n                      use_ssl: false,\n                      precision: InfluxDB2::WritePrecision::NANOSECOND) do |client|\n\n  api = InfluxDB2::API::Client.new(client)\n\n  # Find my organization\n  organization = api.create_organizations_api\n                    .get_orgs\n                    .orgs\n                    .select { |it| it.name == 'my-org' }\n                    .first\n\n  #\n  # Create new Bucket\n  #\n  retention_rule = InfluxDB2::API::RetentionRule.new(type: 'expire', every_seconds: 3600)\n  bucket_name = 'new-bucket-name'\n  request = InfluxDB2::API::PostBucketRequest.new(org_id: organization.id,\n                                                  name: bucket_name,\n                                                  retention_rules: [retention_rule])\n  bucket = api.create_buckets_api\n              .post_buckets(request)\n\n  #\n  # Create Permission to read/write from Bucket\n  #\n  resource = InfluxDB2::API::Resource.new(type: 'buckets',\n                                          id: bucket.id,\n                                          org_id: organization.id)\n  authorization = InfluxDB2::API::Authorization.new(description: \"Authorization to read/write bucket: #{bucket.name}\",\n                                                    org_id: organization.id,\n                                                    permissions: [\n                                                      InfluxDB2::API::Permission.new(action: 'read', resource: resource),\n                                                      InfluxDB2::API::Permission.new(action: 'write', resource: resource)\n                                                    ])\n  result = api.create_authorizations_api\n              .post_authorizations(authorization)\n\n  print(\"The token: '#{result.token}' is authorized to read/write from/to bucket: '#{bucket.name}'.\")\nend\n\n```\n- sources - [create_new_bucket.rb](/examples/create_new_bucket.rb)\n\n## Advanced Usage\n\n### Check the server status \n\nServer availability can be checked using the `client.ping` method. That is equivalent of the [influx ping](https://docs.influxdata.com/influxdb/latest/reference/cli/influx/ping/).\n\n### Proxy configuration\n\nYou can configure the client to tunnel requests through an HTTP proxy. To configure the proxy use a `http_proxy` environment variable. \n\n```ruby\nENV['HTTP_PROXY'] = 'http://my-user:my-password@my-proxy:8099'\n```\n\nClient automatically follows HTTP redirects. The default redirect policy is to follow up to 10 consecutive requests.\nYou can configure redirect counts by the client property: `max_redirect_count`. \n\nDue to a security reason `Authorization` header is not forwarded when redirect leads to a different domain. \nTo overcome this limitation you have to set the client property `redirect_forward_authorization` to `true`.\n\n### InfluxDB 1.8 API compatibility\n\n[InfluxDB 1.8.0 introduced forward compatibility APIs](https://docs.influxdata.com/influxdb/v1.8/tools/api/#influxdb-2-0-api-compatibility-endpoints) for InfluxDB 2.x. This allow you to easily move from InfluxDB 1.x to InfluxDB 2.x Cloud or open source.\n\nThe following forward compatible APIs are available:\n\n| API                                                 | Endpoint                                                                                           | Description                                                                                                                                                                                                                                                    |\n|:----------------------------------------------------|:---------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [query_api.rb](lib/influxdb2/client/query_api.rb)   | [/api/v2/query](https://docs.influxdata.com/influxdb/latest/tools/api/#api-v2-query-http-endpoint) | Query data in InfluxDB 1.8.0+ using the InfluxDB 2.x API and [Flux](https://docs.influxdata.com/flux/latest/) _(endpoint should be enabled by [`flux-enabled` option](https://docs.influxdata.com/influxdb/latest/administration/config/#flux-enabled-false))_ |\n| [write_api.rb](lib/influxdb2/client/write_api.rb)   | [/api/v2/write](https://docs.influxdata.com/influxdb/latest/tools/api/#api-v2-write-http-endpoint) | Write data to InfluxDB 1.8.0+ using the InfluxDB 2.x API                                                                                                                                                                                                       |\n| [health_api.rb](lib/influxdb2/client/health_api.rb) | [/health](https://docs.influxdata.com/influxdb/latest/tools/api/#health-http-endpoint)             | Check the health of your InfluxDB instance                                                                                                                                                                                                                     |    \n\nFor detail info see [InfluxDB 1.8 example](examples/influxdb_18_example.rb).\n\n## Local tests\n\n```\nbrew install wget # on a mac, if not yet installed!\nbin/influxdb-restart.sh\nrake test\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/influxdata/influxdb-client-ruby.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdb-client-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfluxdata%2Finfluxdb-client-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdb-client-ruby/lists"}