Class: ContextDev::Resources::Brand

Inherits:
Object
  • Object
show all
Defined in:
lib/context_dev/resources/brand.rb,
sig/context_dev/resources/brand.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Brand

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 Brand.

Parameters:



65
66
67
# File 'lib/context_dev/resources/brand.rb', line 65

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(body:, request_options: {}) ⇒ ContextDev::Models::BrandRetrieveResponse

Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, or transaction descriptor.



19
20
21
22
23
24
25
26
27
28
# File 'lib/context_dev/resources/brand.rb', line 19

def retrieve(params)
  parsed, options = ContextDev::BrandRetrieveParams.dump_request(params)
  @client.request(
    method: :post,
    path: "brand/retrieve",
    body: parsed[:body],
    model: ContextDev::Models::BrandRetrieveResponse,
    options: options
  )
end

#retrieve_simplified(domain:, max_age_ms: nil, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::BrandRetrieveSimplifiedResponse

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

Returns a simplified version of brand data containing only essential information: domain, title, colors, logos, and backdrops. Optimized for faster responses and reduced data transfer.

Parameters:

  • domain (String)

    Domain name to retrieve simplified brand data for

  • max_age_ms (Integer)

    Maximum age in milliseconds for cached brand data before the API performs a hard

  • 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:



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/context_dev/resources/brand.rb', line 50

def retrieve_simplified(params)
  parsed, options = ContextDev::BrandRetrieveSimplifiedParams.dump_request(params)
  query = ContextDev::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "brand/retrieve-simplified",
    query: query.transform_keys(max_age_ms: "maxAgeMs", timeout_ms: "timeoutMS"),
    model: ContextDev::Models::BrandRetrieveSimplifiedResponse,
    options: options
  )
end