Class: VoiceML::UserDefinedMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/models/user_defined_messages.rb

Overview

Twilio-compatible UserDefinedMessage resource — out-of-band messages a caller can attach to an in-progress call, delivered via the SDK 2.x WebSocket. VoiceML doesn't surface this as a first-class resource yet; the model exists to decode the response shape (KX-prefixed sid + account/call sids) for conformance and round-trip tooling.

Constant Summary collapse

ATTRIBUTES =
%w[
  sid account_sid call_sid date_created
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ UserDefinedMessage

Returns a new instance of UserDefinedMessage.



18
19
20
21
22
23
# File 'lib/voiceml/models/user_defined_messages.rb', line 18

def initialize(attrs = {})
  ATTRIBUTES.each do |field|
    value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
    instance_variable_set("@#{field}", value)
  end
end

Class Method Details

.from_hash(hash) ⇒ Object



25
26
27
28
29
# File 'lib/voiceml/models/user_defined_messages.rb', line 25

def self.from_hash(hash)
  return nil if hash.nil?

  new(hash)
end