Class: FindAI::Client
- Inherits:
-
BaseClient
- Object
- BaseClient
- FindAI::Client
- Defined in:
- lib/find-ai/client.rb
Constant Summary collapse
- DEFAULT_MAX_RETRIES =
Default max number of retries to attempt after a failed retryable request.
2
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Client options.
- #company_enrichment ⇒ FindAI::Resources::CompanyEnrichment readonly
- #people_enrichment ⇒ FindAI::Resources::PeopleEnrichment readonly
- #searches ⇒ FindAI::Resources::Searches readonly
Instance Method Summary collapse
-
#initialize(base_url: nil, api_key: nil, max_retries: nil) ⇒ Client
constructor
Creates and returns a new client for interacting with the API.
Constructor Details
#initialize(base_url: nil, api_key: nil, max_retries: nil) ⇒ Client
Creates and returns a new client for interacting with the API.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/find-ai/client.rb', line 26 def initialize(base_url: nil, api_key: nil, max_retries: nil) base_url ||= "https://usefind.ai/found" max_retries ||= DEFAULT_MAX_RETRIES @api_key = [api_key, ENV["FIND_AI_API_KEY"]].find { |v| !v.nil? } if @api_key.nil? raise ArgumentError, "api_key is required" end super(base_url: base_url, max_retries: max_retries) @company_enrichment = FindAI::Resources::CompanyEnrichment.new(client: self) @people_enrichment = FindAI::Resources::PeopleEnrichment.new(client: self) @searches = FindAI::Resources::Searches.new(client: self) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Client options.
9 10 11 |
# File 'lib/find-ai/client.rb', line 9 def api_key @api_key end |
#company_enrichment ⇒ FindAI::Resources::CompanyEnrichment (readonly)
12 13 14 |
# File 'lib/find-ai/client.rb', line 12 def company_enrichment @company_enrichment end |
#people_enrichment ⇒ FindAI::Resources::PeopleEnrichment (readonly)
15 16 17 |
# File 'lib/find-ai/client.rb', line 15 def people_enrichment @people_enrichment end |
#searches ⇒ FindAI::Resources::Searches (readonly)
18 19 20 |
# File 'lib/find-ai/client.rb', line 18 def searches @searches end |