Sha256: 7225c909b52ca9129421cdedf5c4c8946741f52e16c2127b10e92b4f1e3ea368

Contents?: true

Size: 853 Bytes

Versions: 6

Compression:

Stored size: 853 Bytes

Contents

# frozen_string_literal: true

class EasyPost::Services::Webhook < EasyPost::Services::Service
  MODEL_CLASS = EasyPost::Models::Webhook

  # Create a Webhook.
  def create(params = {})
    wrapped_params = { webhook: params }
    @client.make_request(:post, 'webhooks', MODEL_CLASS, wrapped_params)
  end

  # Retrieve a Webhook
  def retrieve(id)
    @client.make_request(:get, "webhooks/#{id}", MODEL_CLASS)
  end

  # Retrieve a list of Webhooks
  def all(params = {})
    @client.make_request(:get, 'webhooks', MODEL_CLASS, params)
  end

  # Update a Webhook.
  def update(id, params = {})
    @client.make_request(:patch, "webhooks/#{id}", MODEL_CLASS, params)
  end

  # Delete a Webhook.
  def delete(id)
    @client.make_request(:delete, "webhooks/#{id}")

    # Return true if succeeds, an error will be thrown if it fails
    true
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
easypost-5.3.0 lib/easypost/services/webhook.rb
easypost-5.2.0 lib/easypost/services/webhook.rb
easypost-5.1.1 lib/easypost/services/webhook.rb
easypost-5.1.0 lib/easypost/services/webhook.rb
easypost-5.0.1 lib/easypost/services/webhook.rb
easypost-5.0.0 lib/easypost/services/webhook.rb