Sha256: ebc4b236bd61e05694a6b8e933833051f7a480d4dc0322f4af20536be00dffc3

Contents?: true

Size: 938 Bytes

Versions: 16

Compression:

Stored size: 938 Bytes

Contents

require "pact_broker/api/resources/base_resource"
require "pact_broker/db/clean"
require "pact_broker/matrix/unresolved_selector"

# Not exposed yet as we'd need to support administrator auth first

module PactBroker
  module Api
    module Resources
      class Clean < BaseResource
        def content_types_provided
          [["application/hal+json"]]
        end

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

        def process_post
          if content_type_json?
            keep_selectors = (params[:keep] || []).collect do | hash |
              PactBroker::Matrix::UnresolvedSelector.new(hash)
            end

            result = PactBroker::DB::Clean.call(Sequel::Model.db, { keep: keep_selectors })
            response.body = result.to_json
          else
            415
          end
        end

        def policy_name
          :'integrations::clean'
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
pact_broker-2.112.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.111.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.109.1 lib/pact_broker/api/resources/clean.rb
pact_broker-2.109.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.108.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.107.1 lib/pact_broker/api/resources/clean.rb
pact_broker-2.107.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/api/resources/clean.rb
pact_broker-2.106.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.105.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.104.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.103.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.102.2 lib/pact_broker/api/resources/clean.rb
pact_broker-2.102.1 lib/pact_broker/api/resources/clean.rb
pact_broker-2.102.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.101.0 lib/pact_broker/api/resources/clean.rb