Class: SpecForge::HTTP::Backend
- Inherits:
-
Object
- Object
- SpecForge::HTTP::Backend
- Defined in:
- lib/spec_forge/http/backend.rb
Overview
Low-level HTTP client wrapper around Faraday
Backend provides methods for each HTTP verb and handles the actual communication with the server. It's used internally by HTTP::Client.
Instance Attribute Summary collapse
-
#connection ⇒ Faraday::Connection
readonly
The configured Faraday connection.
Instance Method Summary collapse
-
#delete ⇒ Faraday::Response
Executes a DELETE request to <base_url>/<provided_url>.
-
#get ⇒ Faraday::Response
Executes a GET request to <base_url>/<provided_url>.
-
#initialize ⇒ Backend
constructor
Creates a new HTTP backend with a Faraday connection.
-
#patch ⇒ Faraday::Response
Executes a PATCH request to <base_url>/<provided_url>.
-
#post ⇒ Faraday::Response
Executes a POST request to <base_url>/<provided_url>.
-
#put ⇒ Faraday::Response
Executes a PUT request to <base_url>/<provided_url>.
Constructor Details
#initialize ⇒ Backend
Creates a new HTTP backend with a Faraday connection
24 25 26 |
# File 'lib/spec_forge/http/backend.rb', line 24 def initialize @connection = Faraday.new end |
Instance Attribute Details
#connection ⇒ Faraday::Connection (readonly)
The configured Faraday connection
17 18 19 |
# File 'lib/spec_forge/http/backend.rb', line 17 def connection @connection end |
Instance Method Details
#delete ⇒ Faraday::Response
Executes a DELETE request to <base_url>/<provided_url>
39 40 41 |
# File 'lib/spec_forge/http/backend.rb', line 39 def delete(**) run_http_method(:delete, **) end |
#get ⇒ Faraday::Response
Executes a GET request to <base_url>/<provided_url>
54 55 56 |
# File 'lib/spec_forge/http/backend.rb', line 54 def get(**) run_http_method(:get, **) end |
#patch ⇒ Faraday::Response
Executes a PATCH request to <base_url>/<provided_url>
69 70 71 |
# File 'lib/spec_forge/http/backend.rb', line 69 def patch(**) run_http_method(:patch, **) end |
#post ⇒ Faraday::Response
Executes a POST request to <base_url>/<provided_url>
84 85 86 |
# File 'lib/spec_forge/http/backend.rb', line 84 def post(**) run_http_method(:post, **) end |
#put ⇒ Faraday::Response
Executes a PUT request to <base_url>/<provided_url>
99 100 101 |
# File 'lib/spec_forge/http/backend.rb', line 99 def put(**) run_http_method(:put, **) end |