Class: HttpStub::Server::Stub::Instance
- Inherits:
-
Object
- Object
- HttpStub::Server::Stub::Instance
- Defined in:
- lib/http_stub/server/stub/instance.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#triggers ⇒ Object
readonly
Returns the value of attribute triggers.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(args) ⇒ Instance
constructor
A new instance of Instance.
- #satisfies?(request) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(args) ⇒ Instance
Returns a new instance of Instance.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/http_stub/server/stub/instance.rb', line 9 def initialize(args) @method = HttpStub::Server::Stub::Method.new(args["method"]) @uri = HttpStub::Server::Stub::Uri.new(args["uri"]) @headers = HttpStub::Server::Stub::RequestHeaders.new(args["headers"]) @parameters = HttpStub::Server::Stub::RequestParameters.new(args["parameters"]) @body = HttpStub::Server::Stub::RequestBody.create(args["body"]) @response = HttpStub::Server::Stub::Response.create(args["response"]) @triggers = HttpStub::Server::Stub::Triggers.new(args["triggers"]) @description = args.to_s end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/http_stub/server/stub/instance.rb', line 7 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/http_stub/server/stub/instance.rb', line 7 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/http_stub/server/stub/instance.rb', line 7 def method @method end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
7 8 9 |
# File 'lib/http_stub/server/stub/instance.rb', line 7 def parameters @parameters end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/http_stub/server/stub/instance.rb', line 7 def response @response end |
#triggers ⇒ Object (readonly)
Returns the value of attribute triggers.
7 8 9 |
# File 'lib/http_stub/server/stub/instance.rb', line 7 def triggers @triggers end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
7 8 9 |
# File 'lib/http_stub/server/stub/instance.rb', line 7 def uri @uri end |
Instance Method Details
#satisfies?(request) ⇒ Boolean
20 21 22 |
# File 'lib/http_stub/server/stub/instance.rb', line 20 def satisfies?(request) [ @uri, @method, @headers, @parameters, @body ].all? { |matcher| matcher.match?(request) } end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/http_stub/server/stub/instance.rb', line 24 def to_s @description end |