Class: Twilio::Call

Inherits:
Object
  • Object
show all
Extended by:
Associations, Finder
Includes:
Persistable, Resource
Defined in:
lib/twilio/call.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Finder

all, count, find

Methods included from Associations

has_many

Methods included from Persistable

included

Methods included from Resource

#[], #[]=, #initialize, #inspect, #update_attributes

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Twilio::Resource

Class Method Details

.create(attrs = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/twilio/call.rb', line 14

def create(attrs={})
  attrs = attrs.with_indifferent_access
  attrs.each { |k,v| v.upcase! if k.to_s =~ /method$/ }
  attrs[:send_digits] = CGI.escape(attrs[:send_digits]) if attrs[:send_digits]
  attrs['if_machine'].try :capitalize
  old_create attrs
end

.old_createObject



13
# File 'lib/twilio/call.rb', line 13

alias old_create create

Instance Method Details

#cancel!Object

Cancels a call if its state is ‘queued’ or ‘ringing’



39
40
41
# File 'lib/twilio/call.rb', line 39

def cancel!
  update_attributes :status => 'cancelled'
end

#complete!Object



43
44
45
# File 'lib/twilio/call.rb', line 43

def complete!
  update_attributes :status => 'completed'
end