Sha256: 96c4ad8e71667b8e263066c6f5c2615ad8b7c9cbb77b23ba5a9f34613b11ba3f

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require "resend/request"
require "resend/errors"

module Resend
  # broadcasts api wrapper
  module Broadcasts
    class << self
      # https://resend.com/docs/api-reference/broadcasts/create-broadcast
      def create(params = {})
        path = "broadcasts"
        Resend::Request.new(path, params, "post").perform
      end

      # https://resend.com/docs/api-reference/broadcasts/send-broadcast
      def send(params = {})
        path = "broadcasts/#{params[:broadcast_id]}/send"
        Resend::Request.new(path, params, "post").perform
      end

      # https://resend.com/docs/api-reference/broadcasts/list-broadcasts
      def list
        path = "broadcasts"
        Resend::Request.new(path, {}, "get").perform
      end

      # https://resend.com/docs/api-reference/broadcasts/delete-broadcast
      def remove(broadcast_id = "")
        path = "broadcasts/#{broadcast_id}"
        Resend::Request.new(path, {}, "delete").perform
      end

      # https://resend.com/docs/api-reference/broadcasts/get-broadcast
      def get(broadcast_id = "")
        path = "broadcasts/#{broadcast_id}"
        Resend::Request.new(path, {}, "get").perform
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
resend-0.18.0 lib/resend/broadcasts.rb
resend-0.17.2 lib/resend/broadcasts.rb
resend-0.17.1 lib/resend/broadcasts.rb
resend-0.17.0 lib/resend/broadcasts.rb
resend-0.16.0 lib/resend/broadcasts.rb