Module: BrightData::LinkedIn::Endpoint::ClassMethods Private

Defined in:
lib/brightdata/linkedin/endpoint.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Declarative endpoint builder mixed into classes that include BrightData::LinkedIn::Endpoint.

Instance Method Summary collapse

Instance Method Details

#endpoint(dataset_key:, result:, param:, input: nil, input_type: nil, extra_query: {}) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Declare an endpoint mode.

Generates ‘#initialize(http:)`, `#trigger`/`#scrape` (with a real keyword argument named after `param`), input validation, and result parsing. Pass either `input` (each value is a URL string wrapped in that input class) or `input_type` (each value must already be an instance of that type).

Parameters:

  • dataset_key (Symbol)
  • result (#from_api)

    typed result class for parsing responses

  • param (Symbol)

    public keyword argument name, e.g. ‘:urls`

  • input (Class, nil) (defaults to: nil)

    URL-input class wrapping each string value

  • input_type (Class, nil) (defaults to: nil)

    required type for each pre-built value

  • extra_query (Hash) (defaults to: {})

    extra Bright Data query params



42
43
44
45
46
47
48
49
# File 'lib/brightdata/linkedin/endpoint.rb', line 42

def endpoint(dataset_key:, result:, param:, input: nil, input_type: nil, extra_query: {}) # rubocop:disable Metrics/ParameterLists -- each keyword names one facet of the endpoint DSL
  const_set(:DATASET_KEY, dataset_key)
  const_set(:EXTRA_QUERY, extra_query.freeze)
  define_initialize
  define_result_parser(result)
  input ? define_url_inputs(param, input) : define_object_inputs(param, input_type)
  define_actions(param)
end