Class: Mailersend::SMSInbounds
- Inherits:
-
Object
- Object
- Mailersend::SMSInbounds
- Defined in:
- lib/mailersend/sms_inbounds/sms_inbounds.rb
Overview
SMS Inbound 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_inbound_id ⇒ Object
Returns the value of attribute sms_inbound_id.
-
#sms_number_id ⇒ Object
Returns the value of attribute sms_number_id.
Instance Method Summary collapse
- #add_sms_inbound_route ⇒ Object
- #delete_sms_inbound_route(sms_inbound_id:) ⇒ Object
- #get_sms_inbound_route(sms_inbound_id:) ⇒ Object
-
#initialize(client = Mailersend::Client.new) ⇒ SMSInbounds
constructor
A new instance of SMSInbounds.
- #list(page: nil, limit: nil) ⇒ Object
- #update_sms_inbound_route(sms_inbound_id:) ⇒ Object
Constructor Details
#initialize(client = Mailersend::Client.new) ⇒ SMSInbounds
Returns a new instance of SMSInbounds.
13 14 15 16 17 18 19 20 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 13 def initialize(client = Mailersend::Client.new) @client = client @page = page @limit = limit @sms_number_id = sms_number_id @sms_inbound_id = sms_inbound_id @settings = [] end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 6 def client @client end |
#limit ⇒ Object
Returns the value of attribute limit.
6 7 8 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 6 def limit @limit end |
#page ⇒ Object
Returns the value of attribute page.
6 7 8 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 6 def page @page end |
#settings ⇒ Object
Returns the value of attribute settings.
6 7 8 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 6 def settings @settings end |
#sms_inbound_id ⇒ Object
Returns the value of attribute sms_inbound_id.
6 7 8 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 6 def sms_inbound_id @sms_inbound_id end |
#sms_number_id ⇒ Object
Returns the value of attribute sms_number_id.
6 7 8 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 6 def sms_number_id @sms_number_id end |
Instance Method Details
#add_sms_inbound_route ⇒ Object
36 37 38 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 36 def add_sms_inbound_route client.http.post("#{MAILERSEND_API_URL}/sms-inbounds", json: @settings) end |
#delete_sms_inbound_route(sms_inbound_id:) ⇒ Object
44 45 46 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 44 def delete_sms_inbound_route(sms_inbound_id:) client.http.delete("#{MAILERSEND_API_URL}/sms-inbounds/#{sms_inbound_id}") end |
#get_sms_inbound_route(sms_inbound_id:) ⇒ Object
32 33 34 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 32 def get_sms_inbound_route(sms_inbound_id:) client.http.get("#{MAILERSEND_API_URL}/sms-inbounds/#{sms_inbound_id}") end |
#list(page: nil, limit: nil) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.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-inbounds', query: URI.encode_www_form(hash))) end |
#update_sms_inbound_route(sms_inbound_id:) ⇒ Object
40 41 42 |
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 40 def update_sms_inbound_route(sms_inbound_id:) client.http.put("#{MAILERSEND_API_URL}/sms-inbounds/#{sms_inbound_id}", json: @settings) end |