Sha256: a12fda9d8730281609c65b4d09dcf57390e4b26ae96dda4d6b79a591e3272d30

Contents?: true

Size: 1.27 KB

Versions: 10

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

module Mailersend
  # SMS Inbound endpoint from MailerSend API.
  class SMSInbounds
    attr_accessor :client,
                  :page,
                  :limit,
                  :sms_number_id,
                  :sms_inbound_id,
                  :settings

    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

    def list(page: nil, limit: nil)
      hash = {
        'page' => page,
        'limit' => limit
      }

      client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/sms-inbounds',
                                       query: URI.encode_www_form(hash)))
    end

    def get_sms_inbound_route(sms_inbound_id:)
      client.http.get("#{API_URL}/sms-inbounds/#{sms_inbound_id}")
    end

    def add_sms_inbound_route
      client.http.post("#{API_URL}/sms-inbounds", json: @settings)
    end

    def update_sms_inbound_route(sms_inbound_id:)
      client.http.put("#{API_URL}/sms-inbounds/#{sms_inbound_id}", json: @settings)
    end

    def delete_sms_inbound_route(sms_inbound_id:)
      client.http.delete("#{API_URL}/sms-inbounds/#{sms_inbound_id}")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mailersend-ruby-2.0.1 lib/mailersend/sms_inbounds/sms_inbounds.rb
mailersend-ruby-2.0.0 lib/mailersend/sms_inbounds/sms_inbounds.rb
mailersend-ruby-1.6.0 lib/mailersend/sms_inbounds/sms_inbounds.rb
mailersend-ruby-1.5.2 lib/mailersend/sms_inbounds/sms_inbounds.rb
mailersend-ruby-1.5.1 lib/mailersend/sms_inbounds/sms_inbounds.rb
mailersend-ruby-1.5.0 lib/mailersend/sms_inbounds/sms_inbounds.rb
mailersend-ruby-1.4.0 lib/mailersend/sms_inbounds/sms_inbounds.rb
mailersend-ruby-1.3.2 lib/mailersend/sms_inbounds/sms_inbounds.rb
mailersend-ruby-1.3.1 lib/mailersend/sms_inbounds/sms_inbounds.rb
mailersend-ruby-1.3.0 lib/mailersend/sms_inbounds/sms_inbounds.rb