Sha256: d03292ab690df5a09cb6f675e56ee349e978eff96327848a91019b86419b1ea2

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

module Pixela
  class Webhook
    # @!attribute [r] client
    # @return [Pixela::Client]
    attr_reader :client

    # @!attribute [r] webhook_hash
    # @return [String]
    attr_reader :webhook_hash

    # @param client       [Pixela::Client]
    # @param webhook_hash [String]
    def initialize(client:, webhook_hash:)
      @client       = client
      @webhook_hash = webhook_hash
    end

    # Invoke the webhook registered in advance.
    #
    # @return [Pixela::Response]
    #
    # @raise [Pixela::PixelaError] API is failed
    #
    # @see https://docs.pixe.la/#/invoke-webhook
    #
    # @example
    #   client.webhook("<webhookHash>").invoke
    def invoke
      client.invoke_webhook(webhook_hash: webhook_hash)
    end

    # Delete the registered Webhook.
    #
    # @return [Pixela::Response]
    #
    # @raise [Pixela::PixelaError] API is failed
    #
    # @see https://docs.pixe.la/#/delete-webhook
    #
    # @example
    #   client.webhook("<webhookHash>").delete
    def delete
      client.delete_webhook(webhook_hash: webhook_hash)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pixela-1.2.0 lib/pixela/webhook.rb
pixela-1.1.0 lib/pixela/webhook.rb
pixela-1.0.1 lib/pixela/webhook.rb
pixela-1.0.0 lib/pixela/webhook.rb