Module: InfluxDB::HTTP
- Included in:
- Client
- Defined in:
- lib/influxdb/client/http.rb
Overview
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize
Instance Method Summary collapse
Instance Method Details
#get(url, options = {}) ⇒ Object
:nodoc:
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/influxdb/client/http.rb', line 10 def get(url, = {}) connect_with_retry do |http| response = do_request http, Net::HTTP::Get.new(url) if response.is_a? Net::HTTPSuccess handle_successful_response(response, ) elsif response.is_a? Net::HTTPUnauthorized fail InfluxDB::AuthenticationError, response.body else resolve_error(response.body) end end end |
#post(url, data) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/influxdb/client/http.rb', line 23 def post(url, data) headers = { "Content-Type" => "application/octet-stream" } connect_with_retry do |http| response = do_request http, Net::HTTP::Post.new(url, headers), data if response.is_a? Net::HTTPSuccess return response elsif response.is_a? Net::HTTPUnauthorized fail InfluxDB::AuthenticationError, response.body else resolve_error(response.body) end end end |