Sha256: ba57f4b626676fbb4b63065021fefc25fb94362956509d15dc7c1f4c31884eca

Contents?: true

Size: 994 Bytes

Versions: 2

Compression:

Stored size: 994 Bytes

Contents

require 'pact_broker/api/resources/matrix'
require 'pact_broker/matrix/can_i_deploy_query_schema'
require 'pact_broker/matrix/parse_can_i_deploy_query'

module PactBroker
  module Api
    module Resources
      class CanIDeploy < Matrix
        def initialize
          @query_params = JSON.parse(Rack::Utils.parse_nested_query(request.uri.query).to_json, symbolize_names: true)
          @selectors, @options = PactBroker::Matrix::ParseCanIDeployQuery.call(query_params)
        end

        def malformed_request?
          if (errors = query_schema.call(query_params)).any?
            set_json_validation_error_messages(errors)
            true
          else
            false
          end
        end

        private

        attr_reader :query_params

        def query_schema
          PactBroker::Api::Contracts::CanIDeployQuerySchema
        end

        def selectors
          @selectors
        end

        def options
          @options
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pact_broker-2.40.0 lib/pact_broker/api/resources/can_i_deploy.rb
pact_broker-2.39.0 lib/pact_broker/api/resources/can_i_deploy.rb