Class: ValidationRage::FnordMetricNotifier
- Inherits:
-
BaseNotifier
- Object
- BaseNotifier
- ValidationRage::FnordMetricNotifier
- Defined in:
- lib/validation_rage/fnord_metric_notifier.rb
Instance Attribute Summary collapse
-
#fnord ⇒ Object
Returns the value of attribute fnord.
Instance Method Summary collapse
-
#call(event_name, payload) ⇒ Object
I guess this is toooooo sloooow but anyhow let’s play with it.
-
#initialize(args = {}) ⇒ FnordMetricNotifier
constructor
A new instance of FnordMetricNotifier.
Methods inherited from BaseNotifier
Constructor Details
#initialize(args = {}) ⇒ FnordMetricNotifier
6 7 8 |
# File 'lib/validation_rage/fnord_metric_notifier.rb', line 6 def initialize(args={}) self.fnord = FnordMetric::API.new(:redis_url => args[:redis_url]) end |
Instance Attribute Details
#fnord ⇒ Object
Returns the value of attribute fnord.
4 5 6 |
# File 'lib/validation_rage/fnord_metric_notifier.rb', line 4 def fnord @fnord end |
Instance Method Details
#call(event_name, payload) ⇒ Object
I guess this is toooooo sloooow but anyhow let’s play with it
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/validation_rage/fnord_metric_notifier.rb', line 11 def call(event_name, payload) return unless data_present?(payload) # global validation error event self.fnord.event({ :_type => event_name, :payload => payload }) # class level validation error event self.fnord.event({ :_type => "validation_rage_error.#{payload.keys.first.to_s.downcase}", :payload => payload.values.first.keys }) # two events are enough for now ## attribute level validation error event #payload.values.first.each do |attribute, error_messages| # self.fnord.event({ # :_type => "validation_rage_error.#{payload.keys.first.to_s.downcase}.#{attribute}", # :payload => error_messages # }) #end end |