Class: Vonage::SMS
- Inherits:
-
Namespace
- Object
- Namespace
- Vonage::SMS
- Extended by:
- T::Sig
- Defined in:
- lib/vonage/sms.rb
Instance Method Summary collapse
- #send(params) ⇒ Object
-
#verify_webhook_sig(webhook_params:, signature_secret: @config.signature_secret, signature_method: @config.signature_method) ⇒ Boolean
Validate a Signature from an SMS API Webhook.
Instance Method Details
#send(params) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/vonage/sms.rb', line 76 def send(params) if unicode?(params.fetch(:text)) && params[:type] != 'unicode' = 'Sending unicode text SMS without setting the type parameter to "unicode". ' \ 'See https://developer.nexmo.com/messaging/sms for details, ' \ 'or email [email protected] if you have any questions.' logger.warn() end response = request('/sms/json', params: hyphenate(params), type: Post) unless response..first.status == '0' raise ServiceError.new(response: response), response..first[:error_text] end response end |
#verify_webhook_sig(webhook_params:, signature_secret: @config.signature_secret, signature_method: @config.signature_method) ⇒ Boolean
Validate a Signature from an SMS API Webhook.
103 104 105 |
# File 'lib/vonage/sms.rb', line 103 def verify_webhook_sig(webhook_params:, signature_secret: @config.signature_secret, signature_method: @config.signature_method) signature.check(webhook_params, signature_secret: signature_secret, signature_method: signature_method) end |