Class: SmsBroker::Client::Nexmo
- Defined in:
- lib/sms_broker/client/nexmo.rb
Instance Attribute Summary
Attributes inherited from Base
#client, #name, #phone_number, #sender_id
Instance Method Summary collapse
-
#initialize(options) ⇒ Nexmo
constructor
A new instance of Nexmo.
- #send_message(message) ⇒ Object
- #send_voice_message(message) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(options) ⇒ Nexmo
Returns a new instance of Nexmo.
4 5 6 7 8 9 |
# File 'lib/sms_broker/client/nexmo.rb', line 4 def initialize() client = \ ::Nexmo::Client.new(key: [:key], secret: [:secret]) super :nexmo, client, end |
Instance Method Details
#send_message(message) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sms_broker/client/nexmo.rb', line 11 def () response = client. \ text: [:text], from: [:from], to: serialize_to_number([:to]) if success_response?(response) Response::NexmoSuccess.new(response) else Response::NexmoError.new(response) end end |
#send_voice_message(message) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sms_broker/client/nexmo.rb', line 24 def () response = client.initiate_tts_call \ text: [:text], from: [:from], to: serialize_to_number([:to]), lg: [:lang] if voice_success_response?(response) Response::NexmoVoiceSuccess.new(response) else Response::NexmoVoiceError.new(response) end end |