LogoDev
A lightweight, zero-dependency Ruby client for Logo.dev.
Features
- Zero Dependencies: Uses only Ruby standard library (
net/http,json). - Complete Coverage: Supports Logo, Brand, Search, Transactions, and Describe APIs.
- Easy to Use: Clean and intuitive API.
- Secure: Handles authentication via secret and publishable keys.
Installation
Add this line to your application's Gemfile:
gem 'logo_dev'
And then execute:
bundle install
Or install it yourself as:
gem install logo_dev
Usage
Configuration
You can configure the client globally (e.g., in a Rails initializer):
require 'logo_dev'
LogoDev.configure do |config|
config.secret_key = ENV["LOGODEV_SECRET_KEY"]
config.publishable_key = ENV["LOGODEV_PUBLISHABLE_KEY"]
end
# Then you can initialize a client without arguments
client = LogoDev.new
Alternatively, you can pass keys directly when initializing a client:
client = LogoDev.new(
secret_key: 'sk_...', # Required for REST APIs
publishable_key: 'pk_...' # Optional, used for Logo URL generation
)
Logo API
Generate a URL for a company logo. This doesn't make an API call; it simply constructs a signed URL.
# By domain
client.logo_url('google.com')
# => "https://img.logo.dev/google.com?token=pk_..."
# With options
client.logo_url('stripe.com', size: 128, format: 'png')
# => "https://img.logo.dev/stripe.com?size=128&format=png&token=pk_..."
# By ticker, ISIN, or crypto symbol
client.logo_url('AAPL')
client.logo_url('US0378331005')
client.logo_url('BTC')
Search API
Resolve a human-typed company name to its canonical domain.
client.search('Apple')
# => [{"name"=>"Apple", "domain"=>"apple.com", ...}, ...]
Describe API
Enrich a domain into structured company data (name, description, brand colors, social profiles).
client.describe('apple.com')
# => {"name"=>"Apple Inc.", "description"=>"...", "colors"=>[...], "social"=>[...]}
Brand API
Retrieve a full brand profile for a given domain, including banners and brandmarks.
client.brand('airbnb.com')
Transaction API
Normalize and clean raw card-transaction descriptors.
client.transaction('SQ *BLUE BOTTLE 1523 OAKLAND CA', country_code: 'US')
# => {"name"=>"Blue Bottle Coffee", "domain"=>"bluebottlecoffee.com", ...}
Error Handling
The gem defines the following error classes:
LogoDev::AuthenticationError: Raised when the API key is missing or invalid.LogoDev::ResponseError: Raised when the API returns an error status code.LogoDev::RequestError: Raised when a network error occurs.
begin
client.describe('invalid.com')
rescue LogoDev::ResponseError => e
puts "API Error: #{e.}"
puts "Response Code: #{e.response.code}"
end
Development
After checking out the repo, run bundle install to install dependencies. Then, run rake test to run the tests.
License
The gem is available as open source under the terms of the MIT License.