Class: VoiceML::Application

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

Overview

Persistent TwiML+callback bundle dispatched by ‘<Dial><Application>`.

Constant Summary collapse

ATTRIBUTES =
%w[
  sid account_sid friendly_name api_version voice_url voice_method
  voice_fallback_url voice_fallback_method voice_caller_id_lookup
  status_callback status_callback_method status_callback_event
  date_created date_updated uri
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Application

Returns a new instance of Application.



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

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



24
25
26
27
28
# File 'lib/voiceml/models/applications.rb', line 24

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

  new(hash)
end