Module: PactBroker::Api::Paths

Extended by:
Paths
Included in:
Paths
Defined in:
lib/pact_broker/api/paths.rb

Constant Summary collapse

PACT_BADGE_PATH =
%r{^/pacts/provider/[^/]+/consumer/.*/badge(?:\.[A-Za-z]+)?$}.freeze
MATRIX_BADGE_PATH =
%r{^/matrix/provider/[^/]+/latest/[^/]+/consumer/[^/]+/latest/[^/]+/badge(?:\.[A-Za-z]+)?$}.freeze

Instance Method Summary collapse

Instance Method Details

#is_badge_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/pact_broker/api/paths.rb', line 9

def is_badge_path?(path)
  # Optimise by checking include? first - regexp slow
  path.include?('/badge') && (path =~ PACT_BADGE_PATH || path =~ MATRIX_BADGE_PATH)
end