class WebMock::URIAddressablePattern
Public Instance Methods
add_query_params(query_params)
click to toggle source
Calls superclass method
WebMock::URIPattern#add_query_params
# File lib/webmock/request_pattern.rb, line 166 def add_query_params(query_params) @@add_query_params_warned ||= false if not @@add_query_params_warned @@add_query_params_warned = true warn "WebMock warning: ignoring query params in RFC 6570 template and checking them with WebMock" end super(query_params) end
matches?(uri)
click to toggle source
# File lib/webmock/request_pattern.rb, line 155 def matches?(uri) if @query_params.nil? # Let Addressable check the whole URI matches_with_variations?(uri) else # WebMock checks the query, Addressable checks everything else matches_with_variations?(uri.omit(:query)) && @query_params == WebMock::Util::QueryMapper.query_to_values(uri.query) end end
to_s()
click to toggle source
# File lib/webmock/request_pattern.rb, line 175 def to_s str = @pattern.pattern.inspect str += " with variables #{@pattern.variables.inspect}" if @pattern.variables str end
Private Instance Methods
matches_with_variations?(uri)
click to toggle source
# File lib/webmock/request_pattern.rb, line 183 def matches_with_variations?(uri) template = begin Addressable::Template.new(WebMock::Util::URI.heuristic_parse(@pattern.pattern)) rescue Addressable::URI::InvalidURIError Addressable::Template.new(@pattern.pattern) end WebMock::Util::URI.variations_of_uri_as_strings(uri).any? { |u| template.match(u) } end