Class: Motel::Callbacks::Stopped

Inherits:
Omega::Server::Callback show all
Defined in:
lib/motel/callbacks/stopped.rb

Overview

Defines a Omega::Server::Callback to invoke callback when a location stops.

Simple wrapper around the callback base interface, does no requirement checking on its own locally

Instance Attribute Summary

Attributes inherited from Omega::Server::Callback

#endpoint_id, #event_type, #handler, #only_if, #rjr_event

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Omega::Server::Callback

#invoke, #should_invoke?

Constructor Details

#initialize(args = {}, &block) ⇒ Stopped

Motel::Callbacks::Stopped initializer

Parameters:

  • args (Hash) (defaults to: {})

    hash of options to initialize callback with


20
21
22
# File 'lib/motel/callbacks/stopped.rb', line 20

def initialize(args = {}, &block)
  super(args, &block)
end

Class Method Details

.json_create(o) ⇒ Object

Create new callback from json representation


39
40
41
42
# File 'lib/motel/callbacks/stopped.rb', line 39

def self.json_create(o)
  callback = new(o['data'])
  return callback
end

Instance Method Details

#to_json(*a) ⇒ Object

Convert callback to json representation and return it


30
31
32
33
34
35
36
# File 'lib/motel/callbacks/stopped.rb', line 30

def to_json(*a)
  {
    'json_class' => self.class.name,
    'data'       =>
      { :endpoint_id => @endpoint_id }
  }.to_json(*a)
end

#to_sObject

Convert callback to human readable string and return it


25
26
27
# File 'lib/motel/callbacks/stopped.rb', line 25

def to_s
  "stopped"
end