Class: Alchemrest::HttpRequest
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Alchemrest::HttpRequest
- Extended by:
- Memosa
- Defined in:
- lib/alchemrest/http_request.rb
Instance Method Summary collapse
- #execute! ⇒ Object
- #headers ⇒ Object
-
#initialize(request, client) ⇒ HttpRequest
constructor
A new instance of HttpRequest.
-
#url ⇒ Object
Have to disable this because mutant wans to push towards ‘to_str` which is not available in 7.1.
Constructor Details
#initialize(request, client) ⇒ HttpRequest
Returns a new instance of HttpRequest.
9 10 11 12 |
# File 'lib/alchemrest/http_request.rb', line 9 def initialize(request, client) @client = client super(request) end |
Instance Method Details
#execute! ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/alchemrest/http_request.rb', line 26 def execute! result = Result.for do |try| raw_response = try.unwrap make_request! transform_response(build_response(raw_response)) end circuit_breaker.monitor!(result:) result end |
#headers ⇒ Object
22 23 24 |
# File 'lib/alchemrest/http_request.rb', line 22 def headers { **default_headers, **super() } end |
#url ⇒ Object
Have to disable this because mutant wans to push towards ‘to_str` which is not available in 7.1. Once we drop 7.1 support we can remove mutant:disable
18 19 20 |
# File 'lib/alchemrest/http_request.rb', line 18 def url @client.connection.url_prefix.to_s.chop + path end |