Class: Mailersend::SMSInbounds

Inherits:
Object
  • Object
show all
Defined in:
lib/mailersend/sms_inbounds/sms_inbounds.rb

Overview

SMS Inbound endpoint from MailerSend API.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 6

def client
  @client
end

#limitObject

Returns the value of attribute limit.



6
7
8
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 6

def limit
  @limit
end

#pageObject

Returns the value of attribute page.



6
7
8
# File 'lib/mailersend/sms_inbounds/sms_inbounds.rb', line 6

def page
  @page
end

#settingsObject

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_idObject

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_idObject

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_routeObject



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