Class: X::RequestBuilder
- Inherits:
-
Object
- Object
- X::RequestBuilder
- Defined in:
- lib/x/request_builder.rb
Constant Summary collapse
- DEFAULT_HEADERS =
{ "Content-Type" => "application/json; charset=utf-8", "User-Agent" => "X-Client/#{VERSION} #{RUBY_ENGINE}/#{RUBY_VERSION} (#{RUBY_PLATFORM})" }.freeze
- HTTP_METHODS =
{ get: Net::HTTP::Get, post: Net::HTTP::Post, put: Net::HTTP::Put, delete: Net::HTTP::Delete }.freeze
Instance Method Summary collapse
Instance Method Details
#build(http_method:, uri:, body: nil, headers: {}, authenticator: Authenticator.new) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/x/request_builder.rb', line 20 def build(http_method:, uri:, body: nil, headers: {}, authenticator: Authenticator.new) request = create_request(http_method: http_method, uri: uri, body: body) add_headers(request: request, headers: headers) add_authentication(request: request, authenticator: authenticator) request end |