class WebMock::URIPattern

def add_query_params(query_params)

def add_query_params(query_params)
  @query_params = if query_params.is_a?(Hash)
    query_params
  elsif query_params.is_a?(WebMock::Matchers::HashIncludingMatcher) \
          || query_params.is_a?(WebMock::Matchers::HashExcludingMatcher)
    query_params
  elsif rSpecHashIncludingMatcher?(query_params)
    WebMock::Matchers::HashIncludingMatcher.from_rspec_matcher(query_params)
  elsif rSpecHashExcludingMatcher?(query_params)
    WebMock::Matchers::HashExcludingMatcher.from_rspec_matcher(query_params)
  else
    WebMock::Util::QueryMapper.query_to_values(query_params, notation: Config.instance.query_values_notation)
  end
end

def initialize(pattern)

def initialize(pattern)
  @pattern = if pattern.is_a?(Addressable::URI) \
                || pattern.is_a?(Addressable::Template)
    pattern
  elsif pattern.respond_to?(:call)
    pattern
  else
    WebMock::Util::URI.normalize_uri(pattern)
  end
  @query_params = nil
end

def matches?(uri)

def matches?(uri)
  pattern_matches?(uri) && query_params_matches?(uri)
end

def pattern_inspect

def pattern_inspect
  @pattern.inspect
end

def query_params_matches?(uri)

def query_params_matches?(uri)
  @query_params.nil? || @query_params == WebMock::Util::QueryMapper.query_to_values(uri.query, notation: Config.instance.query_values_notation)
end

def to_s

def to_s
  str = pattern_inspect
  str += " with query params #{@query_params.inspect}" if @query_params
  str
end