Class: Bandwidth::Voice::Transfer

Inherits:
Object
  • Object
show all
Includes:
XmlVerb
Defined in:
lib/bandwidth/voice_lib/bxml/verbs/transfer.rb

Overview

The Transfer verb is used to transfer the call to another number

Instance Method Summary collapse

Methods included from XmlVerb

#compact_hash, #initialize, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Bandwidth::Voice::XmlVerb

Instance Method Details

#to_bxml(xml) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/bandwidth/voice_lib/bxml/verbs/transfer.rb', line 9

def to_bxml(xml)
  xml.Transfer(compact_hash({
   'transferCallerId' => transfer_caller_id,
   'callTimeout' => call_timeout,
   'tag' => tag,
   'transferCompleteUrl' => transfer_complete_url,
   'transferCompleteMethod' => transfer_complete_method,
   'username' => username,
   'password' => password,
   'diversionTreatment' => diversion_treatment,
   'diversionReason' => diversion_reason,
   'transferCompleteFallbackUrl' => transfer_complete_fallback_url,
   'transferCompleteFallbackMethod' => transfer_complete_fallback_method,
   'fallbackUsername' => fallback_username,
   'fallbackPassword' => fallback_password
  })) do
    def embedded_xml(xml, property, type)
      if property
        s = if property.is_a?(type)
            then property
            else type.new(property)
            end
        s.to_bxml(xml)
      end
    end
    if not phone_numbers.nil?
      phone_numbers.each do |number|
        embedded_xml(xml, number, PhoneNumber)
      end
    end
    if not sip_uris.nil?
      sip_uris.each do |sip_uri|
        embedded_xml(xml, sip_uri, SipUri)
      end
    end
  end
end