Sha256: c76114d97ae4a7a215588262e2be3204718f2c2b9ae437325a1ae357dc2fe6a5

Contents?: true

Size: 963 Bytes

Versions: 1

Compression:

Stored size: 963 Bytes

Contents

require 'net/http'

require 'rubygems'
require 'multi_json'

module DogapiDemo

  # <b>DEPRECATED:</b> Going forward, use the V1 services. This legacy service will be
  # removed in an upcoming release.
  class MetricService < DogapiDemo::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] DogapiDemo::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

1 entries across 1 versions & 1 rubygems

Version Path
dogapi-demo-0.1.0 lib/dogapi-demo/metric.rb