Class: Mailersend::SMSWebhooks
- Inherits:
-
Object
- Object
- Mailersend::SMSWebhooks
- Defined in:
- lib/mailersend/sms_webhooks/sms_webhooks.rb
Overview
SMS Webhook endpoint from MailerSend API.
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#page ⇒ Object
Returns the value of attribute page.
-
#settings ⇒ Object
Returns the value of attribute settings.
-
#sms_webhook_id ⇒ Object
Returns the value of attribute sms_webhook_id.
Instance Method Summary collapse
- #add_sms_webhook_route ⇒ Object
- #delete_sms_webhook_route(sms_webhook_id:) ⇒ Object
- #get_sms_webhook_route(sms_webhook_id:) ⇒ Object
-
#initialize(client = Mailersend::Client.new) ⇒ SMSWebhooks
constructor
A new instance of SMSWebhooks.
- #list(sms_number_id:) ⇒ Object
- #update_sms_webhook_route(sms_webhook_id:) ⇒ Object
Constructor Details
#initialize(client = Mailersend::Client.new) ⇒ SMSWebhooks
Returns a new instance of SMSWebhooks.
12 13 14 15 16 17 18 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 12 def initialize(client = Mailersend::Client.new) @client = client @page = page @limit = limit @sms_webhook_id = sms_webhook_id @settings = [] end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 6 def client @client end |
#limit ⇒ Object
Returns the value of attribute limit.
6 7 8 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 6 def limit @limit end |
#page ⇒ Object
Returns the value of attribute page.
6 7 8 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 6 def page @page end |
#settings ⇒ Object
Returns the value of attribute settings.
6 7 8 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 6 def settings @settings end |
#sms_webhook_id ⇒ Object
Returns the value of attribute sms_webhook_id.
6 7 8 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 6 def sms_webhook_id @sms_webhook_id end |
Instance Method Details
#add_sms_webhook_route ⇒ Object
32 33 34 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 32 def add_sms_webhook_route client.http.post("#{MAILERSEND_API_URL}/sms-webhooks", json: @settings) end |
#delete_sms_webhook_route(sms_webhook_id:) ⇒ Object
40 41 42 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 40 def delete_sms_webhook_route(sms_webhook_id:) client.http.delete("#{MAILERSEND_API_URL}/sms-webhooks/#{sms_webhook_id}") end |
#get_sms_webhook_route(sms_webhook_id:) ⇒ Object
28 29 30 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 28 def get_sms_webhook_route(sms_webhook_id:) client.http.get("#{MAILERSEND_API_URL}/sms-webhooks/#{sms_webhook_id}") end |
#list(sms_number_id:) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 20 def list(sms_number_id:) hash = { 'sms_number_id' => sms_number_id } client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/sms-webhooks', query: URI.encode_www_form(hash))) end |
#update_sms_webhook_route(sms_webhook_id:) ⇒ Object
36 37 38 |
# File 'lib/mailersend/sms_webhooks/sms_webhooks.rb', line 36 def update_sms_webhook_route(sms_webhook_id:) client.http.put("#{MAILERSEND_API_URL}/sms-webhooks/#{sms_webhook_id}", json: @settings) end |