Module: Bandwidth::Voice::XmlVerb

Included in:
Forward, Gather, Hangup, Pause, PhoneNumber, PlayAudio, Redirect, SendDtmf, SpeakSentence, Transfer
Defined in:
lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb', line 9

def method_missing(name, *args, &block)
  if name[name.size - 1] == '='
    @data[name[0..-2].to_sym] = args[0]
  else
    @data[name]
  end
end

Instance Method Details

#compact_hash(hash) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb', line 17

def compact_hash(hash)
  hash.inject({}) do |new_hash, (k,v)|
    if !v.nil?
      new_hash[k] = v.class == Hash ? compact_hash(v) : v
    end
    new_hash
  end
end

#initialize(data = nil) ⇒ Object



5
6
7
# File 'lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb', line 5

def initialize(data = nil)
  @data = (data || {}).clone()
end