Class: MockServer::HttpForwardWithFallback
- Inherits:
-
Object
- Object
- MockServer::HttpForwardWithFallback
- Defined in:
- lib/mockserver/models.rb
Overview
Forward-with-fallback action (org.mockserver.model.HttpForwardWithFallback):
forwards via http_forward, but returns fallback_response when the
upstream responds with one of fallback_on_status_codes or (when
fallback_on_timeout is true) times out.
Instance Attribute Summary collapse
-
#delay ⇒ Object
Returns the value of attribute delay.
-
#fallback_on_status_codes ⇒ Object
Returns the value of attribute fallback_on_status_codes.
-
#fallback_on_timeout ⇒ Object
Returns the value of attribute fallback_on_timeout.
-
#fallback_response ⇒ Object
Returns the value of attribute fallback_response.
-
#http_forward ⇒ Object
Returns the value of attribute http_forward.
-
#primary ⇒ Object
Returns the value of attribute primary.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(http_forward: nil, fallback_response: nil, fallback_on_status_codes: nil, fallback_on_timeout: nil, delay: nil, primary: nil) ⇒ HttpForwardWithFallback
constructor
A new instance of HttpForwardWithFallback.
- #to_h ⇒ Object
Constructor Details
#initialize(http_forward: nil, fallback_response: nil, fallback_on_status_codes: nil, fallback_on_timeout: nil, delay: nil, primary: nil) ⇒ HttpForwardWithFallback
Returns a new instance of HttpForwardWithFallback.
2334 2335 2336 2337 2338 2339 2340 2341 2342 |
# File 'lib/mockserver/models.rb', line 2334 def initialize(http_forward: nil, fallback_response: nil, fallback_on_status_codes: nil, fallback_on_timeout: nil, delay: nil, primary: nil) @http_forward = http_forward @fallback_response = fallback_response @fallback_on_status_codes = fallback_on_status_codes @fallback_on_timeout = fallback_on_timeout @delay = delay @primary = primary end |
Instance Attribute Details
#delay ⇒ Object
Returns the value of attribute delay.
2331 2332 2333 |
# File 'lib/mockserver/models.rb', line 2331 def delay @delay end |
#fallback_on_status_codes ⇒ Object
Returns the value of attribute fallback_on_status_codes.
2331 2332 2333 |
# File 'lib/mockserver/models.rb', line 2331 def fallback_on_status_codes @fallback_on_status_codes end |
#fallback_on_timeout ⇒ Object
Returns the value of attribute fallback_on_timeout.
2331 2332 2333 |
# File 'lib/mockserver/models.rb', line 2331 def fallback_on_timeout @fallback_on_timeout end |
#fallback_response ⇒ Object
Returns the value of attribute fallback_response.
2331 2332 2333 |
# File 'lib/mockserver/models.rb', line 2331 def fallback_response @fallback_response end |
#http_forward ⇒ Object
Returns the value of attribute http_forward.
2331 2332 2333 |
# File 'lib/mockserver/models.rb', line 2331 def http_forward @http_forward end |
#primary ⇒ Object
Returns the value of attribute primary.
2331 2332 2333 |
# File 'lib/mockserver/models.rb', line 2331 def primary @primary end |
Class Method Details
.from_hash(data) ⇒ Object
2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 |
# File 'lib/mockserver/models.rb', line 2355 def self.from_hash(data) return nil if data.nil? new( http_forward: HttpForward.from_hash(data['httpForward']), fallback_response: HttpResponse.from_hash(data['fallbackResponse']), fallback_on_status_codes: data['fallbackOnStatusCodes'], fallback_on_timeout: data['fallbackOnTimeout'], delay: Delay.from_hash(data['delay']), primary: data['primary'] ) end |
Instance Method Details
#to_h ⇒ Object
2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 |
# File 'lib/mockserver/models.rb', line 2344 def to_h MockServer.strip_none({ 'httpForward' => @http_forward&.to_h, 'fallbackResponse' => @fallback_response&.to_h, 'fallbackOnStatusCodes' => @fallback_on_status_codes, 'fallbackOnTimeout' => @fallback_on_timeout, 'delay' => @delay&.to_h, 'primary' => @primary }) end |