class WebMock::URIPattern
Public Class Methods
new(pattern)
click to toggle source
# File lib/webmock/request_pattern.rb, line 90 def initialize(pattern) @pattern = case pattern when Addressable::URI, Addressable::Template pattern else WebMock::Util::URI.normalize_uri(pattern) end @query_params = nil end
Public Instance Methods
add_query_params(query_params)
click to toggle source
# File lib/webmock/request_pattern.rb, line 100 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 elsif rSpecHashIncludingMatcher?(query_params) WebMock::Matchers::HashIncludingMatcher.from_rspec_matcher(query_params) else WebMock::Util::QueryMapper.query_to_values(query_params, :notation => Config.instance.query_values_notation) end end
to_s()
click to toggle source
# File lib/webmock/request_pattern.rb, line 112 def to_s str = @pattern.inspect str += " with query params #{@query_params.inspect}" if @query_params str end