metricky 0.8.2 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/metrics_controller.rb +6 -8
- data/lib/metricky/helper.rb +3 -3
- data/lib/metricky/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ece31c1fd6f70ab5b10c574070833a82fa1b2a8ea6caeacab0f33dfd9a7960a4
|
4
|
+
data.tar.gz: f487ba9aae518d8c43dbb6c912e60aca6b5adde25414a86c3f402ddb79adfcc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43209e2310ba54cad0fe1d268e7932378ed994fba73ee2224e13ad31fb85279c6b482b21fbc304b6d5af66173cc699de91e963deb7e14ce5fe4d06fc6c19d753
|
7
|
+
data.tar.gz: 647d5d8f5af3285a4c3d3ba4c6e96e8eb1a50c768db9ae250e9c04c8506c9c32892abad2af9d2c0749e82fda641164b110bb753295ad7d53c6e0d834565424d6
|
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
raise RenderError, "results must be a hash or array"
|
7
|
-
end
|
8
|
-
render json: metric.to_json
|
1
|
+
class Metricky::MetricsController < ActionController::Base
|
2
|
+
def show
|
3
|
+
metric = "#{params[:name].classify}Metric".constantize.new(params[:query] || {}, params[:options] || {})
|
4
|
+
unless metric.results.is_a?(Hash) || metric.results.is_a?(Array)
|
5
|
+
raise RenderError, "results must be a hash or array"
|
9
6
|
end
|
7
|
+
render json: metric.to_json
|
10
8
|
end
|
11
9
|
end
|
data/lib/metricky/helper.rb
CHANGED
@@ -6,8 +6,8 @@ module Metricky
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
9
|
+
def metrick_path(metric, options = {})
|
10
|
+
Metricky::Engine.routes.url_helpers.metric_path(name: metric.name.underscore, query: request.query_parameters, options: options)
|
11
11
|
end
|
12
12
|
|
13
13
|
def render_metric(metric_name, options = {})
|
@@ -29,7 +29,7 @@ module Metricky
|
|
29
29
|
|
30
30
|
def metricky_chart(metric, options = {})
|
31
31
|
if metric.json?
|
32
|
-
send(metric.chart,
|
32
|
+
send(metric.chart, metrick_path(metric, options))
|
33
33
|
else
|
34
34
|
send(metric.chart, metric.results, options)
|
35
35
|
end
|
data/lib/metricky/version.rb
CHANGED