Code Monkey home page Code Monkey logo

clearbit-ruby's Introduction

Clearbit

A Ruby API client to https://clearbit.com.

Installation

Add this line to your application's Gemfile:

gem 'clearbit'

And then execute:

$ bundle

Or install it yourself as:

$ gem install clearbit

Usage

First authorize requests by setting the API key found on your account's settings page.

Clearbit.key = ENV['CLEARBIT_KEY']

Then you can lookup people by email address:

person = Clearbit::Streaming::Person[email: '[email protected]']

If the person can't be found, then nil will be returned.

See the documentation for more information.

Company lookup

You can lookup company data by domain name:

company = Clearbit::Streaming::Company[domain: 'uber.com']

If the company can't be found, then nil will be returned.

See the documentation for more information.

CLI

The gem also includes a clearbit executable, which you can use like this:

$ clearbit person --email [email protected]

    {
      "name": {
        "fullName": "Alex MacCaw",
        "givenName": "Alex",
        "familyName": "MacCaw"
      },
      ...

Or to look up a company:

$ clearbit company --domain uber.com

    {
      "name": "Uber",
      "legalName": "Uber, Inc.",
      "categories": [
        "Transport"
      ],
      "founders": [
        "Travis Kalanick",
        "Garrett Camp"
      ],
      ...

Webhooks

For rack apps use the Clearbit::Webhook module to wrap deserialization and verify the webhook is from trusted party:

post '/v1/webhooks/clearbit' do
  begin
    webhook = Clearbit::Webhook.new(env)
    webhook.type #=> 'person'
    webhook.body.name.given_name #=> 'Alex'

    # ...
  rescue Clearbit::Errors::InvalidWebhookSignature => e
    # ...
  end
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.