Class: TwilioTestToolkit::CallInProgress

Inherits:
CallScope
  • Object
show all
Defined in:
lib/twilio-test-toolkit/call_in_progress.rb

Overview

Models a call

Instance Method Summary collapse

Methods inherited from CallScope

#current_path, #follow_redirect, #follow_redirect!, #gather?, #gather_action, #gather_finish_on_key, #gather_method, has_element, #has_redirect_to?, #method_missing, #press, #respond_to_missing?, #response_xml, #root_call

Constructor Details

#initialize(initial_path, from_number, to_number, options = {}) ⇒ CallInProgress

Initiate a call. Options:

  • :method - specify the http method of the initial api call

  • :call_sid - specify an optional fixed value to be passed as params

  • :is_machine - controls params



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 10

def initialize(initial_path, from_number, to_number, options = {})
  # Save our variables for later
  @initial_path = initial_path
  @from_number = from_number
  @to_number = to_number
  @is_machine = options[:is_machine]
  @method = options[:method] || :post

  # Generate an initial call SID if we don't have one
  if (options[:call_sid].nil?)
    @sid = UUIDTools::UUID.random_create.to_s
  else
    @sid = options[:call_sid]
  end

  # We are the root call
  self.root_call = self

  # Create the request
  request_for_twiml!(@initial_path, :method => @method, :is_machine => @is_machine)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TwilioTestToolkit::CallScope

Instance Method Details

#from_numberObject



40
41
42
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 40

def from_number
  @from_number
end

#http_methodObject



52
53
54
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 52

def http_method
  @method
end

#initial_pathObject



36
37
38
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 36

def initial_path
  @initial_path
end

#is_machineObject



48
49
50
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 48

def is_machine
  @is_machine
end

#sidObject



32
33
34
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 32

def sid
  @sid
end

#to_numberObject



44
45
46
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 44

def to_number
  @to_number
end