Class: VoiceML::Stream

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

Overview

Media-stream session (REST equivalent of ‘<Connect><Stream>` / `<Start><Stream>`).

Constant Summary collapse

ATTRIBUTES =
%w[
  sid account_sid call_sid name status api_version uri
  date_created date_updated
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Stream

Returns a new instance of Stream.



15
16
17
18
19
20
# File 'lib/voiceml/models/streams.rb', line 15

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



22
23
24
25
26
# File 'lib/voiceml/models/streams.rb', line 22

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

  new(hash)
end