Module: GuardrailNotifier

Defined in:
lib/guardrail_notifier.rb,
lib/guardrail_notifier/sender.rb,
lib/guardrail_notifier/version.rb,
lib/guardrail_notifier/configuration.rb,
lib/guardrail_notifier/rails/action_controller_monitor.rb

Defined Under Namespace

Modules: Rails Classes: Configuration, Sender

Constant Summary collapse

API_VERSION =
"alpha 1"
VERSION =
'0.2.12'

Class Method Summary collapse

Class Method Details

.configurationObject



13
14
15
# File 'lib/guardrail_notifier.rb', line 13

def configuration
  @configuration ||= Configuration.new
end

.configure {|self.configuration| ... } ⇒ Object

Yields:



17
18
19
# File 'lib/guardrail_notifier.rb', line 17

def configure
  yield(self.configuration)
end

.notifier_paramsObject



29
30
31
32
33
34
35
# File 'lib/guardrail_notifier.rb', line 29

def notifier_params
  @notifier_params ||= {
    :notifier_version => self.configuration.notifier_version,
    :api_key          => self.configuration.api_key || ENV['GUARDRAIL_API_KEY'] || ENV['TRIPWIRE_API_KEY'],
    :api_version      => API_VERSION
  }
end

.notify(data) ⇒ Object



25
26
27
# File 'lib/guardrail_notifier.rb', line 25

def notify(data)
  self.sender.send_to_guardrail(data.merge(notifier_params))
end

.senderObject



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

def sender
  @sender ||= Sender.new(self.configuration)
end