Class: ActionSms::ConnectionAdapters::TropoAdapter
Overview
All the concrete gateway adapters follow the interface laid down in this class. You can use this interface directly by borrowing the gateway connection from the Base with Base.connection.
Constant Summary
collapse
- SERVICE_URL =
"http://api.tropo.com/1.0/sessions"
Instance Method Summary
collapse
#authenticate, #authentication_key, #authentication_key=, #configuration, #configuration=, #initialize, #use_ssl, #use_ssl=
Instance Method Details
#deliver(sms, options = {}) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/action_sms/connection_adapters/tropo_adapter.rb', line 28
def deliver(sms, options = {})
tropo_message = Tropo::Message.new
tropo_message.to = sms.recipient
tropo_message.text = sms.body || ""
tropo_message.from = sms.from if sms.respond_to?(:from)
tropo_message.token = @config[:outgoing_token]
response = send_http_request(service_url, tropo_message.request_xml)
options[:filter_response] ? filter_response(response) : response
end
|
#delivery_request_successful?(gateway_response) ⇒ Boolean
38
39
40
|
# File 'lib/action_sms/connection_adapters/tropo_adapter.rb', line 38
def delivery_request_successful?(gateway_response)
gateway_response =~ /\<success\>true\<\/success\>/
end
|
#message_id(data) ⇒ Object
42
43
44
|
# File 'lib/action_sms/connection_adapters/tropo_adapter.rb', line 42
def message_id(data)
end
|
#message_text(params) ⇒ Object
46
47
48
|
# File 'lib/action_sms/connection_adapters/tropo_adapter.rb', line 46
def message_text(params)
session(params)["initial_text"]
end
|
#sender(params) ⇒ Object
50
51
52
|
# File 'lib/action_sms/connection_adapters/tropo_adapter.rb', line 50
def sender(params)
session(params)["from"]["id"]
end
|
#service_url ⇒ Object
54
55
56
|
# File 'lib/action_sms/connection_adapters/tropo_adapter.rb', line 54
def service_url
super(SERVICE_URL)
end
|
#status(delivery_receipt) ⇒ Object
58
59
60
|
# File 'lib/action_sms/connection_adapters/tropo_adapter.rb', line 58
def status(delivery_receipt)
end
|