Class: Splat::Twilio
- Inherits:
-
Gateway
show all
- Defined in:
- lib/splat/vendors/twilio/twilio_gateway.rb
Instance Attribute Summary
Attributes inherited from Gateway
#vendor
Instance Method Summary
collapse
Methods inherited from Gateway
[], #config_option, #configuration, default_configuration, inherited, #required_config
Methods included from Utils
#url_escape
Methods included from Insertion
#insert_values
Constructor Details
#initialize ⇒ Twilio
Returns a new instance of Twilio.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/splat/vendors/twilio/twilio_gateway.rb', line 9
def initialize()
super
self.required_config([:provider_url, :account_sid, :auth_token])
@service_url = self.config_option(:provider_url)
@account_sid = self.config_option(:account_sid)
@auth_token = self.config_option(:auth_token)
@api_version = self.config_option(:api_version) || '2008-08-01'
@phone_number = self.config_option(:phone_number)
@send_service_url = URI.parse("#{@service_url}/#{@api_version}/Accounts/#{@account_sid}/SMS/Messages")
end
|
Instance Method Details
#send_bulk_sms(message, numbers, options = {}) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/splat/vendors/twilio/twilio_gateway.rb', line 30
def send_bulk_sms(message, numbers, options = {})
numbers.each do |number|
options[:response].add(number, call_service(message, number))
end
options[:response]
end
|
#send_bulk_sms_with_insertion(message, insertions = {}, options = {}) ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/splat/vendors/twilio/twilio_gateway.rb', line 37
def send_bulk_sms_with_insertion(message, insertions = {}, options = {})
number_message_map = insert_values(message, insertions)
number_message_map.each do |number, message|
options[:response].add(number, call_service(message, parse_number(number)))
end
options[:response]
end
|
#send_sms(message, number, options = {}) ⇒ Object
25
26
27
28
|
# File 'lib/splat/vendors/twilio/twilio_gateway.rb', line 25
def send_sms(message, number, options = {})
options[:response].add(number, call_service(message, number))
options[:response]
end
|