Class: HttpStub::Configurer::Request::StubResponse
- Inherits:
-
Object
- Object
- HttpStub::Configurer::Request::StubResponse
- Defined in:
- lib/http_stub/configurer/request/stub_response.rb
Instance Method Summary collapse
- #file ⇒ Object
-
#initialize(id, args) ⇒ StubResponse
constructor
A new instance of StubResponse.
- #payload ⇒ Object
Constructor Details
#initialize(id, args) ⇒ StubResponse
Returns a new instance of StubResponse.
7 8 9 10 11 12 13 |
# File 'lib/http_stub/configurer/request/stub_response.rb', line 7 def initialize(id, args) @id = id @status = args[:status] || "" @headers = (args[:headers] || {}).with_indifferent_and_insensitive_access @body = args[:json].try(:to_json) || args[:body] @delay_in_seconds = args[:delay_in_seconds] || "" end |
Instance Method Details
#file ⇒ Object
19 20 21 |
# File 'lib/http_stub/configurer/request/stub_response.rb', line 19 def file contains_file? ? create_response_file : nil end |
#payload ⇒ Object
15 16 17 |
# File 'lib/http_stub/configurer/request/stub_response.rb', line 15 def payload { status: @status, headers: @headers, body: @body, delay_in_seconds: @delay_in_seconds } end |