class WireMockMapper::Builders::UrlMatchBuilder

Public Class Methods

new(request_builder, path = false) click to toggle source
# File lib/builders/url_match_builder.rb, line 6
def initialize(request_builder, path = false)
  @request_builder = request_builder
  @path = path
  @type = ''
  @url_or_pattern = ''
end

Public Instance Methods

equal_to(url) click to toggle source

Expect url to equal @param url [String] url to match against @return [RequestBuilder] calling request builder for chaining additional attributes

# File lib/builders/url_match_builder.rb, line 16
def equal_to(url)
  @type = @path ? :urlPath : :url
  @url_or_pattern = url
  @request_builder
end
matching(regexp) click to toggle source

Expect url to match @param regexp [Regexp, String] regex for url to match against @return [RequestBuilder] calling request builder for chaining additional attributes

# File lib/builders/url_match_builder.rb, line 25
def matching(regexp)
  regexp = Helpers.regexp_to_string regexp if regexp.is_a? Regexp
  @type = @path ? :urlPathPattern : :urlPattern
  @url_or_pattern = regexp
  @request_builder
end
to_hash(*) click to toggle source
# File lib/builders/url_match_builder.rb, line 32
def to_hash(*)
  { @type => @url_or_pattern }
end
to_json(*) click to toggle source
# File lib/builders/url_match_builder.rb, line 36
def to_json(*)
  to_hash.to_json
end