Class: Mailersend::SMSRecipient
- Inherits:
-
Object
- Object
- Mailersend::SMSRecipient
- Defined in:
- lib/mailersend/sms_recipient/sms_recipient.rb
Overview
SMS Recipient 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.
-
#sms_number_id ⇒ Object
Returns the value of attribute sms_number_id.
-
#sms_recipient_id ⇒ Object
Returns the value of attribute sms_recipient_id.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #get(sms_recipient_id:) ⇒ Object
-
#initialize(client = Mailersend::Client.new) ⇒ SMSRecipient
constructor
A new instance of SMSRecipient.
- #list(page: nil, limit: nil) ⇒ Object
- #update(sms_recipient_id:, status: nil) ⇒ Object
Constructor Details
#initialize(client = Mailersend::Client.new) ⇒ SMSRecipient
Returns a new instance of SMSRecipient.
13 14 15 16 17 18 19 20 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 13 def initialize(client = Mailersend::Client.new) @client = client @status = status @sms_number_id = sms_number_id @sms_recipient_id = sms_recipient_id @page = page @limit = limit end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 6 def client @client end |
#limit ⇒ Object
Returns the value of attribute limit.
6 7 8 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 6 def limit @limit end |
#page ⇒ Object
Returns the value of attribute page.
6 7 8 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 6 def page @page end |
#sms_number_id ⇒ Object
Returns the value of attribute sms_number_id.
6 7 8 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 6 def sms_number_id @sms_number_id end |
#sms_recipient_id ⇒ Object
Returns the value of attribute sms_recipient_id.
6 7 8 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 6 def sms_recipient_id @sms_recipient_id end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 6 def status @status end |
Instance Method Details
#get(sms_recipient_id:) ⇒ Object
32 33 34 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 32 def get(sms_recipient_id:) client.http.get("#{MAILERSEND_API_URL}/sms-recipients/#{sms_recipient_id}") end |
#list(page: nil, limit: nil) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 22 def list(page: nil, limit: nil) hash = { 'page' => page, 'limit' => limit } client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/sms-recipients', query: URI.encode_www_form(hash))) end |
#update(sms_recipient_id:, status: nil) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/mailersend/sms_recipient/sms_recipient.rb', line 36 def update(sms_recipient_id:, status: nil) hash = { 'status' => status } client.http.put("#{MAILERSEND_API_URL}/sms-recipients/#{sms_recipient_id}", json: hash.compact) end |