Class: Freeswitch::ESL::Protocol::Event
- Inherits:
-
Object
- Object
- Freeswitch::ESL::Protocol::Event
- Defined in:
- lib/freeswitch/esl/protocol/event.rb
Overview
Represents a FreeSWITCH event received in JSON format.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #body ⇒ Object
- #channel_variable(name) ⇒ Object
-
#initialize(raw_json) ⇒ Event
constructor
A new instance of Event.
- #job_uuid ⇒ Object
- #name ⇒ Object
- #subclass ⇒ Object
- #uuid ⇒ Object
Constructor Details
#initialize(raw_json) ⇒ Event
Returns a new instance of Event.
12 13 14 |
# File 'lib/freeswitch/esl/protocol/event.rb', line 12 def initialize(raw_json) @data = JSON.parse(raw_json).freeze end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/freeswitch/esl/protocol/event.rb', line 10 def data @data end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/freeswitch/esl/protocol/event.rb', line 16 def [](key) data[key] end |
#body ⇒ Object
36 37 38 |
# File 'lib/freeswitch/esl/protocol/event.rb', line 36 def body data["_body"] end |
#channel_variable(name) ⇒ Object
40 41 42 |
# File 'lib/freeswitch/esl/protocol/event.rb', line 40 def channel_variable(name) data["variable_#{name}"] end |
#job_uuid ⇒ Object
32 33 34 |
# File 'lib/freeswitch/esl/protocol/event.rb', line 32 def job_uuid data["Job-UUID"] end |
#name ⇒ Object
20 21 22 |
# File 'lib/freeswitch/esl/protocol/event.rb', line 20 def name data["Event-Name"] end |
#subclass ⇒ Object
24 25 26 |
# File 'lib/freeswitch/esl/protocol/event.rb', line 24 def subclass data["Event-Subclass"] end |
#uuid ⇒ Object
28 29 30 |
# File 'lib/freeswitch/esl/protocol/event.rb', line 28 def uuid data["Unique-ID"] end |