Class: Minfraud::HTTPService::Request
- Inherits:
-
Object
- Object
- Minfraud::HTTPService::Request
- Defined in:
- lib/minfraud/http_service/request.rb
Overview
Request performs HTTP requests.
Instance Attribute Summary collapse
-
#middleware ⇒ Proc?
readonly
A proc containing Faraday configuration.
-
#server ⇒ String?
readonly
The API endpoint.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Request
constructor
A new instance of Request.
-
#perform(params) ⇒ Farday::Response
Perform an HTTP request to the specified endpoint with given body.
Constructor Details
#initialize(params = {}) ⇒ Request
Returns a new instance of Request.
21 22 23 24 |
# File 'lib/minfraud/http_service/request.rb', line 21 def initialize(params = {}) @middleware = params[:middleware] @server = params[:server] end |
Instance Attribute Details
#middleware ⇒ Proc? (readonly)
A proc containing Faraday configuration.
12 13 14 |
# File 'lib/minfraud/http_service/request.rb', line 12 def middleware @middleware end |
#server ⇒ String? (readonly)
The API endpoint.
17 18 19 |
# File 'lib/minfraud/http_service/request.rb', line 17 def server @server end |
Instance Method Details
#perform(params) ⇒ Farday::Response
Perform an HTTP request to the specified endpoint with given body.
32 33 34 35 |
# File 'lib/minfraud/http_service/request.rb', line 32 def perform(params) connection = Minfraud.connection connection.send(*params.values_at(:verb, :endpoint, :body)) end |