Sha256: a154af0fc9be43fd9ceae8cb7ec7c5779f72742d8e49b351afe91af937e2d16c

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

# frozen_string_literal: true

require "date"
require "securerandom"

module Hachi
  module Clients
    class Alert < Base
      #
      # Get an alert
      #
      # @param [String] id Alert ID
      #
      # @return [Hash]
      #
      def get_by_id(id)
        get("/alert/#{id}") { |json| json }
      end

      #
      # Delete an alert
      #
      # @param [String] id Alert ID
      #
      # @return [String]
      #
      def delete_by_id(id)
        delete("/alert/#{id}") { |json| json }
      end

      #
      # Create an alert
      #
      # @param [Hash] payload
      #
      # @return [Hash]
      #
      def create(**payload)
        post("/alert", json: payload) { |json| json }
      end

      # Update an alert
      #
      # @param [String] id
      # @param [Hash] payload
      #
      # @return [Hash]
      #
      def update(id, **payload)
        patch("/alert/#{id}", json: payload) { |json| json }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hachi-2.0.0 lib/hachi/clients/alert.rb