Sha256: 0c9539d2a8b19354aa8f640eb8d9ec4833e5972ca23cc73ea5ca64065b6e6e14

Contents?: true

Size: 945 Bytes

Versions: 34

Compression:

Stored size: 945 Bytes

Contents

require 'net/http'

require 'rubygems'
require 'json'

module Dogapi

  # <b>DEPRECATED:</b> Going forward, use the V1 services. This legacy service will be
  # removed in an upcoming release.
  class MetricService < Dogapi::Service

    API_VERSION = "1.0.0"

    # <b>DEPRECATED:</b> Going forward, use the V1 services. This legacy service will be
    # removed in an upcoming release.
    def submit(api_key, scope, metric, points)
      warn "[DEPRECATION] Dogapi::MetricService.submit() has been deprecated in favor of the newer V1 services"
      series = [{
        :host    =>  scope.host,
        :device  =>  scope.device,
        :metric  =>  metric,
        :points  =>  points.map { |p| [p[0].to_i, p[1]] }
      }]

      params = {
        :api_key      =>  api_key,
        :api_version  =>  API_VERSION,
        :series       =>  series.to_json
      }

      request Net::HTTP::Post, '/series/submit', params
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
dogapi-1.16.0 lib/dogapi/metric.rb
dogapi-1.15.0 lib/dogapi/metric.rb
dogapi-1.14.0 lib/dogapi/metric.rb
dogapi-1.13.0 lib/dogapi/metric.rb
dogapi-1.12.0 lib/dogapi/metric.rb
dogapi-1.11.0 lib/dogapi/metric.rb
dogapi-1.10.0 lib/dogapi/metric.rb
dogapi-1.9.2 lib/dogapi/metric.rb
dogapi-1.9.1 lib/dogapi/metric.rb
dogapi-1.9.0 lib/dogapi/metric.rb
dogapi-1.8.1 lib/dogapi/metric.rb
dogapi-1.8.0 lib/dogapi/metric.rb
dogapi-1.7.1 lib/dogapi/metric.rb
dogapi-1.6.0 lib/dogapi/metric.rb
dogapi-1.5.2 lib/dogapi/metric.rb
dogapi-1.5.0 lib/dogapi/metric.rb
dogapi-1.4.3 lib/dogapi/metric.rb
dogapi-1.4.2 lib/dogapi/metric.rb
dogapi-1.4.1 lib/dogapi/metric.rb
dogapi-1.4.0 lib/dogapi/metric.rb