Class: BoringMetrics::LiveMethods

Inherits:
Object
  • Object
show all
Defined in:
lib/boringmetrics/live_methods.rb

Overview

Methods for updating live metrics

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ LiveMethods

Initialize the lives API

Parameters:



9
10
11
# File 'lib/boringmetrics/live_methods.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#update(update) ⇒ void

This method returns an undefined value.

Update a live metric value

Parameters:

  • update (Hash)

    The live update to send

Options Hash (update):

  • :liveId (String)

    The ID of the live metric

  • :value (Numeric)

    The value to set or increment

  • :operation (String)

    The operation to perform (“set” or “increment”)

  • :sentAt (String)

    ISO8601 date - will be automatically set if not provided



21
22
23
# File 'lib/boringmetrics/live_methods.rb', line 21

def update(update)
  @client.update_live(update)
end

#update_batch(updates) ⇒ void

This method returns an undefined value.

Update multiple live metrics values in a batch

Parameters:

  • updates (Array<Hash>)

    Array of live updates to send



29
30
31
# File 'lib/boringmetrics/live_methods.rb', line 29

def update_batch(updates)
  updates.each { |update| update(update) }
end