Sha256: ba9a0f131ec3b0149f60aa6d3c875baad866b74ea8bee6433fd54f2d4403f5f3

Contents?: true

Size: 1.64 KB

Versions: 33

Compression:

Stored size: 1.64 KB

Contents

require_relative 'base_decorator'
require 'pact_broker/api/decorators/webhook_request_decorator'
require 'pact_broker/api/decorators/timestamps'
require 'pact_broker/domain/webhook_request'
require 'pact_broker/api/decorators/basic_pacticipant_decorator'

module PactBroker
  module Api
    module Decorators
      class WebhookDecorator < BaseDecorator

        property :request, :class => PactBroker::Domain::WebhookRequest, :extend => WebhookRequestDecorator

        include Timestamps

        property :consumer, :extend => PactBroker::Api::Decorators::BasicPacticipantDecorator, :embedded => true, writeable: false
        property :provider, :extend => PactBroker::Api::Decorators::BasicPacticipantDecorator, :embedded => true, writeable: false

        link :self do | options |
          {
            title: represented.description,
            href: webhook_url(represented.uuid, options[:base_url])
          }

        end

        link :'pact-webhooks' do | options |
          {
            title: "All webhooks for the pact between #{represented.consumer.name} and #{represented.provider.name}",
            href: webhooks_for_pact_url(represented.consumer, represented.provider, options[:base_url])
          }
        end

        link :'webhooks' do | options |
          {
            title: "All webhooks",
            href: webhooks_url(options[:base_url])
          }
        end

        link :execute do | options |
          {
            title: "Test the execution of the webhook by sending a POST request to this URL",
            href: webhook_execution_url(represented, options[:base_url])
          }

        end

      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
pact_broker-2.0.0 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-2.0.0.beta.8 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-2.0.0.beta.7 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-2.0.0.beta.6 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.18.0 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-2.0.0.beta.5 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.18.0.beta.1 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.17.2 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.17.1 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-2.0.0.beta.4 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-2.0.0.beta.3 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-2.0.0.beta.2 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-2.0.0.beta.1 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.17.0 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.16.0 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.15.0 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.14.0 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.13.0 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.12.0 lib/pact_broker/api/decorators/webhook_decorator.rb
pact_broker-1.11.2 lib/pact_broker/api/decorators/webhook_decorator.rb