Class: VitableConnect::Internal::Http::BaseRequest Private

Inherits:
Object
  • Object
show all
Defined in:
lib/VitableConnect/internal/http/base_request.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

JSON::Request, Multipart::Request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_url:, path:, method:, headers: {}, query: {}, request_options: {}) ⇒ BaseRequest

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of BaseRequest.



16
17
18
19
20
21
22
23
# File 'lib/VitableConnect/internal/http/base_request.rb', line 16

def initialize(base_url:, path:, method:, headers: {}, query: {}, request_options: {})
  @base_url = base_url
  @path = path
  @method = method
  @headers = headers
  @query = query
  @request_options = request_options
end

Instance Attribute Details

#base_url ⇒ Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/VitableConnect/internal/http/base_request.rb', line 8

def base_url
  @base_url
end

#headers ⇒ Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/VitableConnect/internal/http/base_request.rb', line 8

def headers
  @headers
end

#method ⇒ Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/VitableConnect/internal/http/base_request.rb', line 8

def method
  @method
end

#path ⇒ Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/VitableConnect/internal/http/base_request.rb', line 8

def path
  @path
end

#query ⇒ Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/VitableConnect/internal/http/base_request.rb', line 8

def query
  @query
end

#request_options ⇒ Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/VitableConnect/internal/http/base_request.rb', line 8

def request_options
  @request_options
end

Instance Method Details

#encode_query ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The query parameters merged with additional query parameters from request options.



26
27
28
29
# File 'lib/VitableConnect/internal/http/base_request.rb', line 26

def encode_query
  additional_query = @request_options&.dig(:additional_query_parameters) || @request_options&.dig("additional_query_parameters") || {}
  @query.merge(additional_query)
end