Class: LontaraUtilities::HTTPClient::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/lontara_utilities/http_client/request.rb

Overview

Request class responsible for handling HTTP request.

Instance Method Summary collapse

Constructor Details

#initialize(method, url:, headers: {}, body: nil, params: nil, timeout: 20) ⇒ Request

rubocop:disable Metrics/ParameterLists



7
8
9
10
11
12
13
14
15
16
# File 'lib/lontara_utilities/http_client/request.rb', line 7

def initialize(method, url:, headers: {}, body: nil, params: nil, timeout: 20) # rubocop:disable Metrics/ParameterLists
  @method = method
  @url = url
  @headers = headers
  @body = body
  @params = params
  @timeout = timeout

  headers.merge!(user_agent:) unless headers.key?(:user_agent)
end

Instance Method Details

#performObject

Perform HTTP request.



19
20
21
# File 'lib/lontara_utilities/http_client/request.rb', line 19

def perform
  call
end