Class: HttpStub::Models::Response
- Inherits:
-
Object
- Object
- HttpStub::Models::Response
- Defined in:
- lib/http_stub/models/response.rb
Constant Summary collapse
- SUCCESS =
HttpStub::Models::Response.new("status" => 200, "body" => "OK")
- ERROR =
HttpStub::Models::Response.new("status" => 404, "body" => "ERROR")
- EMPTY =
HttpStub::Models::Response.new()
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#delay_in_seconds ⇒ Object
readonly
Returns the value of attribute delay_in_seconds.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(args = {}) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(args = {}) ⇒ Response
Returns a new instance of Response.
23 24 25 26 27 28 29 30 |
# File 'lib/http_stub/models/response.rb', line 23 def initialize(args={}) @original_args = args resolved_args = merge_default_arguments(args) @status = resolved_args["status"] @body = resolved_args["body"] @delay_in_seconds = resolved_args["delay_in_seconds"] @headers = HttpStub::Models::Headers.new(resolved_args["headers"]) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
21 22 23 |
# File 'lib/http_stub/models/response.rb', line 21 def body @body end |
#delay_in_seconds ⇒ Object (readonly)
Returns the value of attribute delay_in_seconds.
21 22 23 |
# File 'lib/http_stub/models/response.rb', line 21 def delay_in_seconds @delay_in_seconds end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
21 22 23 |
# File 'lib/http_stub/models/response.rb', line 21 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
21 22 23 |
# File 'lib/http_stub/models/response.rb', line 21 def status @status end |
Instance Method Details
#empty? ⇒ Boolean
36 37 38 |
# File 'lib/http_stub/models/response.rb', line 36 def empty? @original_args.empty? end |