Sha256: 2e0ccbcf513bdf553d036eef463cc1380c312b89dbfddf9e597ee7ae5d4127f1

Contents?: true

Size: 837 Bytes

Versions: 28

Compression:

Stored size: 837 Bytes

Contents

require 'pact_broker/services'
require 'pact_broker/api/decorators/webhook_decorator'

module PactBroker
  module Api
    module Resources

      class Webhook < BaseResource

        def content_types_provided
          [["application/hal+json", :to_json]]
        end

        def allowed_methods
          ["GET", "DELETE"]
        end

        def resource_exists?
          webhook
        end

        def to_json
          Decorators::WebhookDecorator.new(webhook).to_json(user_options: { base_url: base_url })
        end

        def delete_resource
          webhook_service.delete_by_uuid uuid
          true
        end

        private

        def webhook
          @webhook ||= webhook_service.find_by_uuid uuid
        end

        def uuid
          identifier_from_path[:uuid]
        end

      end
    end

  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
pact_broker-2.4.2 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.4.1 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.4.0 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.3.0 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.2.0 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.1.1 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.1.0 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.5 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.4 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.3 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.2 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.1 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.0 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.0.beta.8 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.0.beta.7 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.0.beta.6 lib/pact_broker/api/resources/webhook.rb
pact_broker-1.18.0 lib/pact_broker/api/resources/webhook.rb
pact_broker-2.0.0.beta.5 lib/pact_broker/api/resources/webhook.rb
pact_broker-1.18.0.beta.1 lib/pact_broker/api/resources/webhook.rb
pact_broker-1.17.2 lib/pact_broker/api/resources/webhook.rb