Class: ApiWrapper::HttpClient::BaseClient

Inherits:
Object
  • Object
show all
Defined in:
lib/api_wrapper/http_client/base_client.rb

Overview

Base class for HTTP clients

Direct Known Subclasses

FaradayClient

Instance Method Summary collapse

Constructor Details

#initialize(base_url, cache_policy) ⇒ BaseClient

Initializes a new instance of the BaseClient class.

Parameters:

  • base_url (String)

    The base URL for the HTTP client.



10
11
12
13
# File 'lib/api_wrapper/http_client/base_client.rb', line 10

def initialize(base_url, cache_policy)
  @base_url = base_url
  @cache_policy = cache_policy
end

Instance Method Details

#get(endpoint) ⇒ Object

Sends a GET request to the specified endpoint.

Parameters:

  • endpoint (String)

    The endpoint to send the GET request to.

Raises:

  • (NotImplementedError)

    If the method is not implemented by subclasses.



19
20
21
# File 'lib/api_wrapper/http_client/base_client.rb', line 19

def get(endpoint)
  raise NotImplementedError, 'Subclasses must implement the get method'
end