Sha256: 264152442591185254fcdebe6d3dbc79dd968c79a1a65ec33f45b3742668ead0

Contents?: true

Size: 961 Bytes

Versions: 8

Compression:

Stored size: 961 Bytes

Contents

require "pact_broker/api/resources/base_resource"
require "pact_broker/pacts/pact_params"
require "pact_broker/pacts/diff"
require "pact_broker/api/decorators/pact_decorator"

module PactBroker
  module Api
    module Resources
      class PreviousDistinctPactVersion < BaseResource

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

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

        def resource_exists?
          !!pact
        end

        def to_json
          decorator_class(:pact_decorator).new(pact).to_json(**decorator_options)
        end

        def pact
          @pact ||= pact_service.find_previous_distinct_pact_version(pact_params)
        end

        def pact_params
          @pact_params ||= PactBroker::Pacts::PactParams.from_request request, identifier_from_path
        end

        def policy_name
          :'pacts::pact'
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pact_broker-2.112.0 lib/pact_broker/api/resources/previous_distinct_pact_version.rb
pact_broker-2.111.0 lib/pact_broker/api/resources/previous_distinct_pact_version.rb
pact_broker-2.109.1 lib/pact_broker/api/resources/previous_distinct_pact_version.rb
pact_broker-2.109.0 lib/pact_broker/api/resources/previous_distinct_pact_version.rb
pact_broker-2.108.0 lib/pact_broker/api/resources/previous_distinct_pact_version.rb
pact_broker-2.107.1 lib/pact_broker/api/resources/previous_distinct_pact_version.rb
pact_broker-2.107.0 lib/pact_broker/api/resources/previous_distinct_pact_version.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/api/resources/previous_distinct_pact_version.rb