class HttpStub::Server::Stub::Match::Rules
Constants
- EMPTY
Attributes
body[R]
headers[R]
method[R]
parameters[R]
uri[R]
Public Class Methods
new(args)
click to toggle source
# File lib/http_stub/server/stub/match/rules.rb, line 10 def initialize(args) @uri = HttpStub::Server::Stub::Match::Rule::Uri.new(args[:uri]) @method = HttpStub::Server::Stub::Match::Rule::Method.new(args[:method]) @headers = HttpStub::Server::Stub::Match::Rule::Headers.new(args[:headers]) @parameters = HttpStub::Server::Stub::Match::Rule::Parameters.new(args[:parameters]) @body = HttpStub::Server::Stub::Match::Rule::Body.create(args[:body]) end
Public Instance Methods
matches?(request, logger)
click to toggle source
# File lib/http_stub/server/stub/match/rules.rb, line 20 def matches?(request, logger) [ @uri, @method, @headers, @parameters, @body ].all? { |matcher| matcher.matches?(request, logger) } end
to_json(*args)
click to toggle source
# File lib/http_stub/server/stub/match/rules.rb, line 24 def to_json(*args) { uri: @uri, method: @method, headers: @headers, parameters: @parameters, body: @body }.to_json(*args) end