Sha256: 818f25bf0345f9efdaab9e49a9b0de917c03700d7abd355102bdf3d1a27fd5a1

Contents?: true

Size: 936 Bytes

Versions: 14

Compression:

Stored size: 936 Bytes

Contents

require 'pact_broker/api/resources/base_resource'
require 'pact_broker/pacts/pact_params'
require 'pact_broker/pacts/diff'

module PactBroker
  module Api
    module Resources

      class PactContentDiff < BaseResource

        def content_types_provided
          [["text/plain", :to_text]]
        end

        def allowed_methods
          ["GET"]
        end

        def resource_exists?
          pacticipant_service.find_pacticipant_by_name(consumer_name) &&
            pacticipant_service.find_pacticipant_by_name(provider_name)
        end

        def to_text
          _, body = PactBroker::Pacts::Diff.run pact_params, base_url: base_url
          response.body = body
        end

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

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

      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pact_broker-1.11.1 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.11.0 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.10.0 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.9.3 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.9.2 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.9.1 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.9.0 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.9.0.rc1 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.8.1 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.8.0 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.7.0 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.6.0 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.5.0 lib/pact_broker/api/resources/pact_content_diff.rb
pact_broker-1.4.0 lib/pact_broker/api/resources/pact_content_diff.rb