Sha256: 099828bea12fcb95a54a59eeb3ff7700804505bb664b3d07bbcc2eabcac55abd

Contents?: true

Size: 864 Bytes

Versions: 15

Compression:

Stored size: 864 Bytes

Contents

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

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

        def content_types_provided
          [["application/hal+json"]]
        end

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

        def process_post
          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
        end

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/api/resources/clean.rb
pact_broker-2.79.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.78.1 lib/pact_broker/api/resources/clean.rb
pact_broker-2.78.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.77.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.76.2 lib/pact_broker/api/resources/clean.rb
pact_broker-2.76.1 lib/pact_broker/api/resources/clean.rb
pact_broker-2.76.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.75.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.74.1 lib/pact_broker/api/resources/clean.rb
pact_broker-2.74.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.73.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.72.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.71.0 lib/pact_broker/api/resources/clean.rb
pact_broker-2.70.0 lib/pact_broker/api/resources/clean.rb