Class: WireMockMapper::Builders::UrlMatchBuilder
- Inherits:
-
Object
- Object
- WireMockMapper::Builders::UrlMatchBuilder
- Defined in:
- lib/builders/url_match_builder.rb
Instance Method Summary collapse
-
#equal_to(url) ⇒ RequestBuilder
Expect url to equal.
-
#initialize(request_builder, path = false) ⇒ UrlMatchBuilder
constructor
A new instance of UrlMatchBuilder.
-
#matching(regexp) ⇒ RequestBuilder
Expect url to match.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(request_builder, path = false) ⇒ UrlMatchBuilder
Returns a new instance of UrlMatchBuilder.
6 7 8 9 10 11 |
# 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 |
Instance Method Details
#equal_to(url) ⇒ RequestBuilder
Expect url to equal
16 17 18 19 20 |
# 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) ⇒ RequestBuilder
Expect url to match
25 26 27 28 29 30 |
# 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 ⇒ Object
32 33 34 |
# File 'lib/builders/url_match_builder.rb', line 32 def to_hash(*) { @type => @url_or_pattern } end |
#to_json ⇒ Object
36 37 38 |
# File 'lib/builders/url_match_builder.rb', line 36 def to_json(*) to_hash.to_json end |