Class: LogoDev::Client
- Inherits:
-
Object
- Object
- LogoDev::Client
- Defined in:
- lib/logo_dev/client.rb
Constant Summary collapse
- API_BASE =
"https://api.logo.dev"- IMG_BASE =
"https://img.logo.dev"
Instance Method Summary collapse
-
#brand(domain) ⇒ Object
Brand API Retrieves a full brand profile for a given domain.
-
#describe(domain) ⇒ Object
Describe API Enriches a domain into structured company data.
-
#initialize(secret_key: nil, publishable_key: nil) ⇒ Client
constructor
A new instance of Client.
-
#logo_url(identifier, **options) ⇒ Object
Logo API Generates a URL for a logo image.
-
#search(query) ⇒ Object
Search API Resolves a human-typed company name to its canonical domain.
-
#transaction(transaction, country_code: nil) ⇒ Object
Transaction API Identifies and cleans raw card-transaction descriptors.
Constructor Details
#initialize(secret_key: nil, publishable_key: nil) ⇒ Client
Returns a new instance of Client.
12 13 14 15 |
# File 'lib/logo_dev/client.rb', line 12 def initialize(secret_key: nil, publishable_key: nil) @secret_key = secret_key @publishable_key = publishable_key end |
Instance Method Details
#brand(domain) ⇒ Object
Brand API Retrieves a full brand profile for a given domain.
48 49 50 |
# File 'lib/logo_dev/client.rb', line 48 def brand(domain) get("/brand/#{domain}") end |
#describe(domain) ⇒ Object
Describe API Enriches a domain into structured company data.
41 42 43 |
# File 'lib/logo_dev/client.rb', line 41 def describe(domain) get("/describe/#{domain}") end |
#logo_url(identifier, **options) ⇒ Object
Logo API Generates a URL for a logo image.
21 22 23 24 25 26 27 28 29 |
# File 'lib/logo_dev/client.rb', line 21 def logo_url(identifier, **) token = .delete(:token) || @publishable_key params = .dup params[:token] = token if token query = URI.encode_www_form(params) "#{IMG_BASE}/#{identifier}#{query.empty? ? "" : "?#{query}"}" end |
#search(query) ⇒ Object
Search API Resolves a human-typed company name to its canonical domain.
34 35 36 |
# File 'lib/logo_dev/client.rb', line 34 def search(query) get("/search", q: query) end |
#transaction(transaction, country_code: nil) ⇒ Object
Transaction API Identifies and cleans raw card-transaction descriptors.
56 57 58 59 60 |
# File 'lib/logo_dev/client.rb', line 56 def transaction(transaction, country_code: nil) body = { transaction: transaction } body[:country_code] = country_code if country_code post("/transaction", body) end |