Class: Mailersend::SMSMessages

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

Overview

SMS Messages endpoint from MailerSend API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client = Mailersend::Client.new) ⇒ SMSMessages

Returns a new instance of SMSMessages.



11
12
13
14
15
16
# File 'lib/mailersend/sms_messages/sms_messages.rb', line 11

def initialize(client = Mailersend::Client.new)
  @client = client
  @page = page
  @limit = limit
  @sms_message_id = sms_message_id
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



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

def client
  @client
end

#limitObject

Returns the value of attribute limit.



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

def limit
  @limit
end

#pageObject

Returns the value of attribute page.



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

def page
  @page
end

#sms_message_idObject

Returns the value of attribute sms_message_id.



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

def sms_message_id
  @sms_message_id
end

Instance Method Details

#get(sms_message_id:) ⇒ Object



28
29
30
# File 'lib/mailersend/sms_messages/sms_messages.rb', line 28

def get(sms_message_id:)
  client.http.get_single_route("#{MAILERSEND_API_URL}/sms-messages/#{sms_message_id}")
end

#list(page: nil, limit: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/mailersend/sms_messages/sms_messages.rb', line 18

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-messages',
                                   query: URI.encode_www_form(hash)))
end