Class: Signalwire::Relay::Event

Inherits:
Blade::Message show all
Defined in:
lib/signalwire/relay/event.rb

Direct Known Subclasses

Messaging::Message, Messaging::SendResult

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Blade::Message

#build_request, #error?, #error_code, #error_message, from_json, #id, #initialize, #payload, #to_s

Constructor Details

This class inherits a constructor from Signalwire::Blade::Message

Class Method Details

.from_blade(blade_event) ⇒ Object



41
42
43
# File 'lib/signalwire/relay/event.rb', line 41

def self.from_blade(blade_event)
  new(blade_event.payload)
end

Instance Method Details

#call_idObject



13
14
15
16
17
# File 'lib/signalwire/relay/event.rb', line 13

def call_id
  dig(:params, :params, :params, :call_id)
rescue StandardError
  nil
end

#call_paramsObject



31
32
33
34
35
# File 'lib/signalwire/relay/event.rb', line 31

def call_params
  dig(:params, :params, :params)
rescue StandardError
  {}
end

#control_idObject



19
20
21
22
23
# File 'lib/signalwire/relay/event.rb', line 19

def control_id
  dig(:params, :params, :params, :control_id)
rescue StandardError
  nil
end

#event_paramsObject



25
26
27
28
29
# File 'lib/signalwire/relay/event.rb', line 25

def event_params
  dig(:params, :params)
rescue StandardError
  {}
end

#event_typeObject



5
6
7
# File 'lib/signalwire/relay/event.rb', line 5

def event_type
  dig(:params, :params, :event_type)
end

#messageObject



37
38
39
# File 'lib/signalwire/relay/event.rb', line 37

def message
  event_params[:message]
end

#nameObject



9
10
11
# File 'lib/signalwire/relay/event.rb', line 9

def name
  event_type
end