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
19 20 21 22 23 24 |
# File 'lib/x/request_builder.rb', line 19 def build(http_method:, uri:, body: nil, headers: {}, authenticator: Authenticator.new) request = create_request(http_method:, uri:, body:) add_headers(request:, headers:) add_authentication(request:, authenticator:) request end |