Class: Reynard::Http::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/reynard/http/request.rb

Overview

Configures and performs an HTTP request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_context:) ⇒ Request

Returns a new instance of Request.



12
13
14
15
# File 'lib/reynard/http/request.rb', line 12

def initialize(request_context:)
  @request_context = request_context
  @uri = URI(@request_context.url)
end

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



10
11
12
# File 'lib/reynard/http/request.rb', line 10

def uri
  @uri
end

Instance Method Details

#performObject



17
18
19
20
# File 'lib/reynard/http/request.rb', line 17

def perform
  @request_context.logger&.info { "#{@request_context.verb.upcase} #{uri}" }
  Reynard.http.request(uri, build_request)
end