Commit 5bf9e535 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

json api for three-dim gauges

parent a8d92d6c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ class FnordMetric::App < Sinatra::Base

    data = if gauge.three_dimensional?
      _t = (params[:at] || Time.now).to_i
      
      { :count => gauge.field_values_total(_t), :values => gauge.field_values_at(_t) }
    elsif params[:at] && params[:at] =~ /^[0-9]+$/
      { (_t = gauge.tick_at(params[:at].to_i)) => gauge.value_at(_t) }
    elsif params[:at] && params[:at] =~ /^([0-9]+)-([0-9]+)$/
+0 −2
Original line number Diff line number Diff line
@@ -121,8 +121,6 @@ not yet implemented

== TODOS

-> gauge-api for three-dim gauges

-> toplist-widget

-> set_value
+2 −2
Original line number Diff line number Diff line
@@ -471,8 +471,8 @@ describe "app" do
      get "/foospace/gauge/test3gauge?at=1323691205"
      JSON.parse(last_response.body)["count"].to_i.should == 41
      JSON.parse(last_response.body)["values"].length.should == 2
      JSON.parse(last_response.body)["values"][0].should == ["ubefoo", 23]
      JSON.parse(last_response.body)["values"][1].should == ["fnordyblubb", 18]
      JSON.parse(last_response.body)["values"][0].should == ["uberfoo", "23"]
      JSON.parse(last_response.body)["values"][1].should == ["fnordyblubb", "18"]
    end

  end