Class: Mailersend::SMSNumber
- Inherits:
-
Object
- Object
- Mailersend::SMSNumber
- Defined in:
- lib/mailersend/sms_number/sms_number.rb
Overview
SMS Number 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.
-
#paused ⇒ Object
Returns the value of attribute paused.
-
#sms_number_id ⇒ Object
Returns the value of attribute sms_number_id.
Instance Method Summary collapse
- #delete(sms_number_id:) ⇒ Object
- #get(sms_number_id:) ⇒ Object
-
#initialize(client = Mailersend::Client.new) ⇒ SMSNumber
constructor
A new instance of SMSNumber.
- #list(page: nil, limit: nil) ⇒ Object
- #update(sms_number_id:, paused: nil) ⇒ Object
Constructor Details
#initialize(client = Mailersend::Client.new) ⇒ SMSNumber
Returns a new instance of SMSNumber.
12 13 14 15 16 17 18 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 12 def initialize(client = Mailersend::Client.new) @client = client @paused = paused @page = page @limit = limit @sms_number_id = sms_number_id end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 6 def client @client end |
#limit ⇒ Object
Returns the value of attribute limit.
6 7 8 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 6 def limit @limit end |
#page ⇒ Object
Returns the value of attribute page.
6 7 8 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 6 def page @page end |
#paused ⇒ Object
Returns the value of attribute paused.
6 7 8 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 6 def paused @paused end |
#sms_number_id ⇒ Object
Returns the value of attribute sms_number_id.
6 7 8 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 6 def sms_number_id @sms_number_id end |
Instance Method Details
#delete(sms_number_id:) ⇒ Object
41 42 43 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 41 def delete(sms_number_id:) client.http.delete("#{MAILERSEND_API_URL}/sms-numbers/#{sms_number_id}") end |
#get(sms_number_id:) ⇒ Object
30 31 32 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 30 def get(sms_number_id:) client.http.get("#{MAILERSEND_API_URL}/sms-numbers/#{sms_number_id}") end |
#list(page: nil, limit: nil) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 20 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-numbers', query: URI.encode_www_form(hash))) end |
#update(sms_number_id:, paused: nil) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/mailersend/sms_number/sms_number.rb', line 34 def update(sms_number_id:, paused: nil) hash = { 'paused' => paused } client.http.put("#{MAILERSEND_API_URL}/sms-numbers/#{sms_number_id}", json: hash.compact) end |