Class: Exa::Client

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

Constant Summary collapse

DEFAULT_BASE_URL =
"https://api.exa.ai"

Constants inherited from Internal::Transport::BaseClient

Internal::Transport::BaseClient::DEFAULT_INITIAL_RETRY_DELAY, Internal::Transport::BaseClient::DEFAULT_MAX_RETRIES, Internal::Transport::BaseClient::DEFAULT_MAX_RETRY_DELAY, Internal::Transport::BaseClient::DEFAULT_TIMEOUT, Internal::Transport::BaseClient::PLATFORM_HEADERS

Instance Attribute Summary collapse

Attributes inherited from Internal::Transport::BaseClient

#base_url, #headers, #initial_retry_delay, #max_retries, #max_retry_delay, #requester, #timeout

Instance Method Summary collapse

Methods inherited from Internal::Transport::BaseClient

#request

Constructor Details

#initialize(api_key: ENV["EXA_API_KEY"], base_url: ENV["EXA_BASE_URL"] || DEFAULT_BASE_URL, **opts) ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/exa/client.rb', line 9

def initialize(
  api_key: ENV["EXA_API_KEY"],
  base_url: ENV["EXA_BASE_URL"] || DEFAULT_BASE_URL,
  **opts
)
  raise Exa::Errors::ConfigurationError, "api_key is required" if api_key.nil? || api_key.empty?

  @api_key = api_key
  super(base_url: base_url, **opts)

  @search = Exa::Resources::Search.new(client: self)
  @research = Exa::Resources::Research.new(client: self)
  @websets = Exa::Resources::Websets.new(client: self)
  @events = Exa::Resources::Events.new(client: self)
  @webhooks = Exa::Resources::Webhooks.new(client: self)
  @imports = Exa::Resources::Imports.new(client: self)
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



7
8
9
# File 'lib/exa/client.rb', line 7

def api_key
  @api_key
end

#eventsObject (readonly)

Returns the value of attribute events.



7
8
9
# File 'lib/exa/client.rb', line 7

def events
  @events
end

#importsObject (readonly)

Returns the value of attribute imports.



7
8
9
# File 'lib/exa/client.rb', line 7

def imports
  @imports
end

#researchObject (readonly)

Returns the value of attribute research.



7
8
9
# File 'lib/exa/client.rb', line 7

def research
  @research
end

#searchObject (readonly)

Returns the value of attribute search.



7
8
9
# File 'lib/exa/client.rb', line 7

def search
  @search
end

#webhooksObject (readonly)

Returns the value of attribute webhooks.



7
8
9
# File 'lib/exa/client.rb', line 7

def webhooks
  @webhooks
end

#websetsObject (readonly)

Returns the value of attribute websets.



7
8
9
# File 'lib/exa/client.rb', line 7

def websets
  @websets
end