Sha256: 3f13b56620a5e01f1e07da76d8d52dd5fa196aba2ac98757510b9068a9523472

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

module Mailersend
  # SMS Messages endpoint from MailerSend API.
  class SMSMessages
    attr_accessor :client,
                  :page,
                  :limit,
                  :sms_message_id

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

    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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailersend-ruby-2.0.3 lib/mailersend/sms_messages/sms_messages.rb
mailersend-ruby-2.0.2 lib/mailersend/sms_messages/sms_messages.rb