Sha256: de130b9ef4b90522942af1465262b0460ee9edb36fd5645361972183f13c9ab3

Contents?: true

Size: 953 Bytes

Versions: 2

Compression:

Stored size: 953 Bytes

Contents

require 'metric/configuration'
require 'metric/util'
require 'metric/track'
require 'metric/receive'
require 'metric/rails'
require 'cgi'

module Metric
  class << self
    # Holds the configuration for easy access to settings
    attr_accessor :configuration

    # Configures gem options
    #
    # @param [Block]
    def configure
      self.configuration ||= Metric::Configuration.new
      yield(configuration)
    end

    # Tracks metrics
    #
    # @param [String] metric Metric identifier
    # @param [Hash] options Options
    # @return [Hash] API Response
    def track(metric, options = {})
      Metric::Track.track(metric, options)
    end

    # Fetches data from the API
    #
    # @param [String] metric Metric identifier
    # @param [String] range Range identifier, either total, today, week or month
    # @return [Hash] API Response
    def receive(metric, range)
      Metric::Receive.receive(metric, range)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metric-0.1.2 lib/metric.rb
metric-0.1.1 lib/metric.rb