Class: ContextDev::Resources::Brand
- Inherits:
-
Object
- Object
- ContextDev::Resources::Brand
- Defined in:
- lib/context_dev/resources/brand.rb,
sig/context_dev/resources/brand.rbs
Instance Method Summary collapse
-
#initialize(client:) ⇒ Brand
constructor
private
A new instance of Brand.
-
#retrieve(body:, request_options: {}) ⇒ ContextDev::Models::BrandRetrieveResponse
Retrieve logos, backdrops, colors, industry, description, and more.
-
#retrieve_simplified(domain:, max_age_ms: nil, tags: nil, theme: nil, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::BrandRetrieveSimplifiedResponse
Some parameter documentations has been truncated, see Models::BrandRetrieveSimplifiedParams for more details.
-
#search(query:, tags: nil, request_options: {}) ⇒ ContextDev::Models::BrandSearchResponse
Some parameter documentations has been truncated, see Models::BrandSearchParams for more details.
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.
105 106 107 |
# File 'lib/context_dev/resources/brand.rb', line 105 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, transaction descriptor, or direct URL. Note:
by_direct_url fetches brand data only from the provided URL — not from the
entire internet.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/context_dev/resources/brand.rb', line 21 def retrieve(params) parsed, = ContextDev::BrandRetrieveParams.dump_request(params) @client.request( method: :post, path: "brand/retrieve", body: parsed[:body], model: ContextDev::Models::BrandRetrieveResponse, options: ) end |
#retrieve_simplified(domain:, max_age_ms: nil, tags: nil, theme: 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.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/context_dev/resources/brand.rb', line 56 def retrieve_simplified(params) parsed, = 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: ) end |
#search(query:, tags: nil, request_options: {}) ⇒ ContextDev::Models::BrandSearchResponse
Some parameter documentations has been truncated, see Models::BrandSearchParams for more details.
Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo), most popular first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/context_dev/resources/brand.rb', line 90 def search(params) parsed, = ContextDev::BrandSearchParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "brand/search", query: query, model: ContextDev::Models::BrandSearchResponse, options: ) end |