Module: TwilioContactable::Gateway
- Defined in:
- lib/gateway.rb
Defined Under Namespace
Classes: ControllerNotConfiguredError, Response, WebsiteAddressNotConfiguredError
Constant Summary
collapse
- Success =
Response.new(:status => :success)
- Error =
Response.new(:status => :error)
- API_VERSION =
'2010-04-01'
Class Method Summary
collapse
Class Method Details
.deliver_sms(message, to, from = nil) ⇒ Object
54
55
56
57
58
59
|
# File 'lib/gateway.rb', line 54
def deliver_sms(message, to, from = nil)
deliver :sms,
'Body' => message,
'To' => to,
'From' => from
end
|
.initiate_voice_call(record, to, from = nil) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/gateway.rb', line 35
def initiate_voice_call(record, to, from = nil)
unless TwilioContactable.configuration.website_address
raise WebsiteAddressNotConfiguredError.new
end
unless controller = record.class.twilio_contactable.controller
raise ControllerNotConfiguredError.new(record)
end
url = TwilioContactable.configuration.website_address.chomp('/')
url = "#{url}/#{record.class.twilio_contactable.controller}"
url = "#{url}/start_voice_confirmation?contactable_type=#{record.class}&contactable_id=#{record.id}"
deliver :voice,
'To' => to,
'From' => from,
'Url' => url
end
|