Class: Pangea::Client

Inherits:
Internal::Transport::BaseClient show all
Defined in:
lib/pangea/client.rb

Constant Summary collapse

DEFAULT_TIMEOUT_IN_SECONDS =

Default per-request timeout.

600.0
DEFAULT_MAX_RETRIES =

Default max number of retries to attempt after a failed retryable request.

2
DEFAULT_INITIAL_RETRY_DELAY =

Default initial retry delay in seconds. Overall delay is calculated using exponential backoff + jitter.

0.5

Constants inherited from Internal::Transport::BaseClient

Internal::Transport::BaseClient::PLATFORM_HEADERS

Instance Attribute Summary collapse

Attributes inherited from Internal::Transport::BaseClient

#requester

Instance Method Summary collapse

Methods inherited from Internal::Transport::BaseClient

reap_connection!, #request, validate!

Constructor Details

#initialize(api_token:, base_url:, initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY, max_retries: DEFAULT_MAX_RETRIES, timeout: DEFAULT_TIMEOUT_IN_SECONDS) ⇒ Client

Creates and returns a new client for interacting with the Pangea API.

Parameters:

  • api_token (String)
  • base_url (String)
  • max_retries (Integer) (defaults to: DEFAULT_MAX_RETRIES)

    Max number of retries to attempt after a failed retryable request.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/pangea/client.rb', line 33

def initialize(
  api_token:,
  base_url:,
  initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,
  max_retries: DEFAULT_MAX_RETRIES,
  timeout: DEFAULT_TIMEOUT_IN_SECONDS
)
  @api_token = api_token&.to_s

  super(
    base_url: base_url,
    initial_retry_delay: initial_retry_delay,
    max_retries: max_retries,
    headers: {},
    timeout: timeout
  )
end

Instance Attribute Details

#api_tokenString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/pangea/client.rb', line 16

def api_token
  @api_token
end