Sha256: decb06f1617bf19fef9fa1b7d3a361daf3d4e4cf44f3f53d09534e5a4da077ba

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

require 'metric/version'
require 'metric/configuration'
require 'open-uri'
require 'cgi'

module Metric
  class << self
    attr_accessor :configuration

    def configure
      self.configuration ||= Metric::Configuration.new
      yield(configuration)
    end

    def track(metric)
      key = "?api_key=" + Metric.configuration.api_key
      url = Metric.configuration.metric_host + '/track.js' + key + parse_metric(metric)
      open(url).read
    end

    def parse_metric(metric)
    "&metric=#{CGI.escape(metric)}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metric-0.0.1 lib/metric.rb