Class: ValidationRage::ValidationRageNotifier
- Inherits:
-
BaseNotifier
- Object
- BaseNotifier
- ValidationRage::ValidationRageNotifier
- Defined in:
- lib/validation_rage/validation_rage_notifier.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#socket ⇒ Object
Returns the value of attribute socket.
Instance Method Summary collapse
- #call(event_name, payload) ⇒ Object
-
#initialize(args) ⇒ ValidationRageNotifier
constructor
A new instance of ValidationRageNotifier.
Methods inherited from BaseNotifier
Constructor Details
#initialize(args) ⇒ ValidationRageNotifier
Returns a new instance of ValidationRageNotifier.
6 7 8 9 10 11 |
# File 'lib/validation_rage/validation_rage_notifier.rb', line 6 def initialize(args) self.socket = UDPSocket.new self.host = "localhost" self.port = 33333 self.api_key = args[:api_key] end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/validation_rage/validation_rage_notifier.rb', line 5 def api_key @api_key end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/validation_rage/validation_rage_notifier.rb', line 5 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
5 6 7 |
# File 'lib/validation_rage/validation_rage_notifier.rb', line 5 def port @port end |
#socket ⇒ Object
Returns the value of attribute socket.
5 6 7 |
# File 'lib/validation_rage/validation_rage_notifier.rb', line 5 def socket @socket end |
Instance Method Details
#call(event_name, payload) ⇒ Object
13 14 15 16 |
# File 'lib/validation_rage/validation_rage_notifier.rb', line 13 def call(event_name, payload) data = {:api_key => self.api_key, :payload => payload} self.socket.send(data.to_json, 0, self.host, self.port) end |