Class: ContextDev::Resources::Utility

Inherits:
Object
  • Object
show all
Defined in:
lib/context_dev/resources/utility.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Utility

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.

Returns a new instance of Utility.

Parameters:



71
72
73
# File 'lib/context_dev/resources/utility.rb', line 71

def initialize(client:)
  @client = client
end

Instance Method Details

#prefetch(domain:, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::UtilityPrefetchResponse

Some parameter documentations has been truncated, see Models::UtilityPrefetchParams for more details.

Signal that you may fetch brand data for a particular domain soon to improve latency. This endpoint does not charge credits and is available for paid customers to optimize future requests. [You must be on a paid plan to use this endpoint]

Parameters:

  • domain (String)

    Domain name to prefetch brand data for

  • timeout_ms (Integer)

    Optional timeout in milliseconds for the request. If the request takes longer th

  • request_options (ContextDev::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/context_dev/resources/utility.rb', line 25

def prefetch(params)
  parsed, options = ContextDev::UtilityPrefetchParams.dump_request(params)
  @client.request(
    method: :post,
    path: "brand/prefetch",
    body: parsed,
    model: ContextDev::Models::UtilityPrefetchResponse,
    options: options
  )
end

#prefetch_by_email(email:, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::UtilityPrefetchByEmailResponse

Some parameter documentations has been truncated, see Models::UtilityPrefetchByEmailParams for more details.

Signal that you may fetch brand data for a particular domain soon to improve latency. This endpoint accepts an email address, extracts the domain from it, validates that it’s not a disposable or free email provider, and queues the domain for prefetching. This endpoint does not charge credits and is available for paid customers to optimize future requests. [You must be on a paid plan to use this endpoint]

Parameters:

  • email (String)

    Email address to prefetch brand data for. The domain will be extracted from the

  • timeout_ms (Integer)

    Optional timeout in milliseconds for the request. If the request takes longer th

  • request_options (ContextDev::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



57
58
59
60
61
62
63
64
65
66
# File 'lib/context_dev/resources/utility.rb', line 57

def prefetch_by_email(params)
  parsed, options = ContextDev::UtilityPrefetchByEmailParams.dump_request(params)
  @client.request(
    method: :post,
    path: "brand/prefetch-by-email",
    body: parsed,
    model: ContextDev::Models::UtilityPrefetchByEmailResponse,
    options: options
  )
end