Class: Mailersend::Messages
- Inherits:
-
Object
- Object
- Mailersend::Messages
- Defined in:
- lib/mailersend/messages/messages.rb
Overview
Messages endpoint from MailerSend API.
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#page ⇒ Object
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(client = Mailersend::Client.new) ⇒ Messages
constructor
A new instance of Messages.
- #list(page: nil, limit: nil) ⇒ Object
- #single(message_id:) ⇒ Object
Constructor Details
#initialize(client = Mailersend::Client.new) ⇒ Messages
Returns a new instance of Messages.
11 12 13 14 15 16 |
# File 'lib/mailersend/messages/messages.rb', line 11 def initialize(client = Mailersend::Client.new) @client = client @page = page @limit = limit @message_id = end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/mailersend/messages/messages.rb', line 6 def client @client end |
#limit ⇒ Object
Returns the value of attribute limit.
6 7 8 |
# File 'lib/mailersend/messages/messages.rb', line 6 def limit @limit end |
#message_id ⇒ Object
Returns the value of attribute message_id.
6 7 8 |
# File 'lib/mailersend/messages/messages.rb', line 6 def @message_id end |
#page ⇒ Object
Returns the value of attribute page.
6 7 8 |
# File 'lib/mailersend/messages/messages.rb', line 6 def page @page end |
Instance Method Details
#list(page: nil, limit: nil) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/mailersend/messages/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/messages', query: URI.encode_www_form(hash))) end |
#single(message_id:) ⇒ Object
28 29 30 |
# File 'lib/mailersend/messages/messages.rb', line 28 def single(message_id:) client.http.get("#{MAILERSEND_API_URL}/messages/#{}") end |