Class: TwilioTestToolkit::CallInProgress

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

Overview

Models a call

Instance Attribute Summary collapse

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



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/twilio-test-toolkit/call_in_progress.rb', line 15

def initialize(initial_path, from_number, to_number, options = {})
  default_options = {
    :method     => :post,
    :direction  => 'inbound',
    :is_machine => false
  }

  @options = default_options.merge(options)

  # Save our variables for later
  @initial_path = initial_path
  @from_number  = from_number
  @to_number    = to_number
  @is_machine   = @options[:is_machine]
  @called       = @options[:called]
  @direction    = @options[:direction]
  @http_method  = @options[:method]

  # 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, @options)
end

Dynamic Method Handling

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

Instance Attribute Details

#calledObject (readonly)

Returns the value of attribute called.



9
10
11
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 9

def called
  @called
end

#directionObject (readonly)

Returns the value of attribute direction.



9
10
11
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 9

def direction
  @direction
end

#from_numberObject (readonly)

Returns the value of attribute from_number.



8
9
10
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 8

def from_number
  @from_number
end

#http_methodObject (readonly)

Returns the value of attribute http_method.



7
8
9
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 7

def http_method
  @http_method
end

#initial_pathObject (readonly)

Returns the value of attribute initial_path.



7
8
9
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 7

def initial_path
  @initial_path
end

#is_machineObject (readonly)

Returns the value of attribute is_machine.



9
10
11
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 9

def is_machine
  @is_machine
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 6

def options
  @options
end

#sidObject (readonly)

Returns the value of attribute sid.



7
8
9
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 7

def sid
  @sid
end

#to_numberObject (readonly)

Returns the value of attribute to_number.



8
9
10
# File 'lib/twilio-test-toolkit/call_in_progress.rb', line 8

def to_number
  @to_number
end