Class: SmsRu::Callbacks
- Inherits:
-
Object
- Object
- SmsRu::Callbacks
- Defined in:
- lib/sms_ru/callbacks.rb
Overview
Manages callback (webhook) URLs that SMS.ru notifies with delivery statuses. Reached via SmsRu#callbacks, e.g. ‘client.callbacks.add(“https://…”)`. Each method returns the full Array of registered URLs after the change.
Instance Method Summary collapse
-
#add(url) ⇒ Array<String>
Registers a callback URL.
-
#initialize(request) ⇒ Callbacks
constructor
private
A new instance of Callbacks.
-
#list ⇒ Array<String>
Lists the registered callback URLs.
-
#remove(url) ⇒ Array<String>
Removes a callback URL.
Constructor Details
#initialize(request) ⇒ Callbacks
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Callbacks.
10 11 12 |
# File 'lib/sms_ru/callbacks.rb', line 10 def initialize(request) @request = request end |
Instance Method Details
#add(url) ⇒ Array<String>
Registers a callback URL.
19 |
# File 'lib/sms_ru/callbacks.rb', line 19 def add(url) = urls(@request.call("/callback/add", url: url)) |
#list ⇒ Array<String>
Lists the registered callback URLs.
32 |
# File 'lib/sms_ru/callbacks.rb', line 32 def list = urls(@request.call("/callback/get")) |
#remove(url) ⇒ Array<String>
Removes a callback URL.
26 |
# File 'lib/sms_ru/callbacks.rb', line 26 def remove(url) = urls(@request.call("/callback/del", url: url)) |