Module: TwilioContactable::Gateway
- Defined in:
- lib/gateway.rb
Defined Under Namespace
Classes: ControllerNotConfiguredError, Error, Response, Success, WebsiteAddressNotConfiguredError
Constant Summary
collapse
- API_VERSION =
'2010-04-01'
Class Method Summary
collapse
Class Method Details
.deliver_sms(message, to, from = nil) ⇒ Object
58
59
60
61
62
63
|
# File 'lib/gateway.rb', line 58
def deliver_sms(message, to, from = nil)
deliver :sms,
'Body' => message,
'To' => to,
'From' => from
end
|
.initiate_voice_call(record, to, from = nil) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/gateway.rb', line 39
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
|