Class: ApiSim::RecordedRequest
- Inherits:
-
Object
- Object
- ApiSim::RecordedRequest
- Defined in:
- lib/api_sim/recorded_request.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(time: Time.now, body:, request_env:, request_path:) ⇒ RecordedRequest
constructor
A new instance of RecordedRequest.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(time: Time.now, body:, request_env:, request_path:) ⇒ RecordedRequest
Returns a new instance of RecordedRequest.
5 6 7 8 9 10 |
# File 'lib/api_sim/recorded_request.rb', line 5 def initialize(time: Time.now, body:, request_env:, request_path:) @time = time @body = body @headers = parse_headers_from(request_env) @path = request_path end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/api_sim/recorded_request.rb', line 3 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
3 4 5 |
# File 'lib/api_sim/recorded_request.rb', line 3 def headers @headers end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/api_sim/recorded_request.rb', line 3 def path @path end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
3 4 5 |
# File 'lib/api_sim/recorded_request.rb', line 3 def time @time end |
Instance Method Details
#to_json(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/api_sim/recorded_request.rb', line 12 def to_json( = {}) { body: @body, headers: @headers, path: @path, time: @time, }.to_json end |