Class: BrightData::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/brightdata/client.rb

Overview

Top-level Bright Data API client.

Examples:

client = BrightData::Client.new(api_token: ENV.fetch("BRIGHTDATA_API_TOKEN"))
client.linkedin

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_token:, base_url: BrightData::HTTP::BASE_URL, logger: nil) ⇒ Client

Returns a new instance of Client.

Parameters:

  • api_token (String)

    Bright Data API token

  • base_url (String) (defaults to: BrightData::HTTP::BASE_URL)

    override Bright Data API base URL

  • logger (Logger, nil) (defaults to: nil)

    optional logger for request tracing

Raises:



20
21
22
23
# File 'lib/brightdata/client.rb', line 20

def initialize(api_token:, base_url: BrightData::HTTP::BASE_URL, logger: nil)
  @http = HTTP.new(api_token:, base_url:, logger:)
  @linkedin = LinkedIn::Namespace.new(http: @http)
end

Instance Attribute Details

#httpBrightData::HTTP (readonly)

Returns underlying HTTP wrapper.

Returns:



11
12
13
# File 'lib/brightdata/client.rb', line 11

def http
  @http
end

#linkedinBrightData::LinkedIn::Namespace (readonly)

Returns LinkedIn endpoint namespace.

Returns:



14
15
16
# File 'lib/brightdata/client.rb', line 14

def linkedin
  @linkedin
end