Class: VoiceML::Recording

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

Overview

A Twilio-compatible Recording resource.

Constant Summary collapse

ATTRIBUTES =
%w[
  sid account_sid call_sid conference_sid status source channels
  duration api_version uri date_created date_updated start_time
  price price_unit encryption_details subresource_uris media_url error_code
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Recording

Returns a new instance of Recording.



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

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



23
24
25
26
27
# File 'lib/voiceml/models/recordings.rb', line 23

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

  new(hash)
end