Class: ApiBrasil::Services::Messaging::SmsService

Inherits:
DeviceProxyService show all
Defined in:
lib/api_brasil/services/messaging/sms_service.rb

Overview

API de SMS (device-based): POST /sms/{action}. Exige Authorization: Bearer + DeviceToken.

Instance Attribute Summary

Attributes inherited from DeviceProxyService

#service

Attributes inherited from BaseService

#http

Instance Method Summary collapse

Methods inherited from DeviceProxyService

#queue, #request

Methods inherited from BaseService

#delete, #download, #get, #patch, #post, #put

Constructor Details

#initialize(http) ⇒ SmsService

Returns a new instance of SmsService.



11
12
13
# File 'lib/api_brasil/services/messaging/sms_service.rb', line 11

def initialize(http)
  super(http, "sms")
end

Instance Method Details

#send_message(body, options = {}) ⇒ Object Also known as: send

Envia um SMS pelo device: POST /sms/send.

Campos: number, message, operator, user_reply, webhook_url.

Returns:

  • (Object)


20
21
22
# File 'lib/api_brasil/services/messaging/sms_service.rb', line 20

def send_message(body, options = {})
  request("send", body, options)
end

#send_with_credits(body, options = {}) ⇒ Object

Envia um SMS debitando creditos da conta (sem DeviceToken): POST /sms/send/credits.

Returns:

  • (Object)


34
35
36
# File 'lib/api_brasil/services/messaging/sms_service.rb', line 34

def send_with_credits(body, options = {})
  post("/sms/send/credits", body, options)
end