Sha256: a1d13c2d58d93a19438d669b67de0aa5c10b478fea411b22099bcd7521e68cf5

Contents?: true

Size: 1.18 KB

Versions: 10

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module Mailersend
  # SMS Webhook endpoint from MailerSend API.
  class SMSWebhooks
    attr_accessor :client,
                  :page,
                  :limit,
                  :sms_webhook_id,
                  :settings

    def initialize(client = Mailersend::Client.new)
      @client = client
      @page = page
      @limit = limit
      @sms_webhook_id = sms_webhook_id
      @settings = []
    end

    def list(sms_number_id:)
      hash = {
        'sms_number_id' => sms_number_id
      }
      client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/sms-webhooks',
                                       query: URI.encode_www_form(hash)))
    end

    def get_sms_webhook_route(sms_webhook_id:)
      client.http.get("#{API_URL}/sms-webhooks/#{sms_webhook_id}")
    end

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

    def update_sms_webhook_route(sms_webhook_id:)
      client.http.put("#{API_URL}/sms-webhooks/#{sms_webhook_id}", json: @settings)
    end

    def delete_sms_webhook_route(sms_webhook_id:)
      client.http.delete("#{API_URL}/sms-webhooks/#{sms_webhook_id}")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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