-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(ApiSdk): set up endpoints * feat(Git): modify ignore file * feat(SDK): add check function before making request * update readme, license and gemspec * update readme * more readme updates * fix readme * fix readme comments * add TOC * add bash * update version and gemspec * add workflow, PR template and Issue Templates * feat(ApiKey): read from env * add action * tests(Enrichment): test person api * rename tests to test * add to tests * add tests to PRs and pushes to main * updates file for publish * tests(Endpoints): add tests for all endpoints Co-authored-by: vvillait88 <[email protected]>
- Loading branch information
1 parent
622a780
commit 70dfafc
Showing
27 changed files
with
946 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
- peopledatalabs Library Version | ||
- Node Version | ||
- NPM Version | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Description of the change | ||
|
||
> Description here | ||
## Type of change | ||
|
||
- [ ] Bug fix (non-breaking change that fixes an issue) | ||
- [ ] Chore (cleanup or minor QOL tweak that has little to no impact on functionality) | ||
- [ ] New feature (non-breaking change that adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Publish Ruby Gem | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
name: Build + Publish | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Ruby 2.6 | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6.x | ||
|
||
- name: Publish to RubyGems | ||
run: | | ||
mkdir -p $HOME/.gem | ||
touch $HOME/.gem/credentials | ||
chmod 0600 $HOME/.gem/credentials | ||
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | ||
gem install bundler | ||
bundle install | ||
gem build *.gemspec | ||
gem push *.gem | ||
env: | ||
GEM_HOST_API_KEY: "${{secrets.RUBY_TOKEN}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Test Package | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Ruby | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6.x | ||
|
||
- name: Build and run test | ||
env: | ||
PDL_API_KEY: ${{secrets.PDL_API_KEY}} | ||
run: | | ||
gem install bundler | ||
bundle install | ||
gem build peopledatalabs.gemspec | ||
gem install ./peopledatalabs-1.0.0.gem | ||
rake spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--format documentation | ||
--color | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
sudo: false | ||
language: ruby | ||
cache: bundler | ||
rvm: | ||
- 2.6.8 | ||
before_install: gem install bundler -v 1.17.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "https://rubygems.org" | ||
|
||
# Specify your gem's dependencies in peopledatalabs.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,153 @@ | ||
# peopledatalabs-ruby | ||
<p align="center"> | ||
<img src="https://i.imgur.com/S7DkZtr.png" width="250" alt="People Data Labs Logo"> | ||
</p> | ||
<h1 align="center">People Data Labs Ruby Library</h1> | ||
<p align="center">Official Ruby client for the People Data Labs API.</p> | ||
|
||
<p align="center"> | ||
<a href=""> | ||
<img src="https://img.shields.io/badge/repo%20status-Active-limegreen" alt="Repo Status"> | ||
</a> | ||
<a href="https://rubygems.org/gems/peopledatalabs"> | ||
<img src="https://img.shields.io/gem/v/twilio-ruby.svg" alt="People Data Labs on RubyGems" /> | ||
</a> | ||
<a href=""> | ||
<img src="https://github.com/peopledatalabs/peopledatalabs-ruby/actions/workflows/test.yaml/badge.svg" alt="Tests Status" /> | ||
</a> | ||
</p> | ||
|
||
# | ||
This is a simple Ruby client library to access the various API endpoints provided by [People Data Labs](https://www.peopledatalabs.com/). | ||
|
||
This library bundles up PDL API requests into simple function calls, making it easy to integrate into your projects. You can use the various [API endpoints](#endpoints) to access up-to-date, real-world data from our massive [Person](https://docs.peopledatalabs.com/docs/stats) and [Company](https://docs.peopledatalabs.com/docs/company-stats) Datasets. | ||
|
||
## Table of Contents | ||
- [🔧 Installation](#installation) | ||
- [🚀 Usage](#usage) | ||
- [🌐 Endpoints](#endpoints) | ||
- [📘 Documentation](#documentation) | ||
|
||
## Installation <a name="installation"></a> | ||
|
||
1. Add this line to your application's Gemfile: | ||
|
||
```ruby | ||
gem 'peopledatalabs' | ||
``` | ||
|
||
2. And then execute: | ||
|
||
```bash | ||
$ bundle | ||
``` | ||
|
||
Or install it yourself as: | ||
|
||
```bash | ||
$ gem install peopledatalabs | ||
``` | ||
|
||
3. Sign up for a [free PDL API key](https://www.peopledatalabs.com/signup) | ||
|
||
## 🚀 Usage <a name="usage"></a> | ||
|
||
First, add your API Key: | ||
```ruby | ||
Peopledatalabs.api_key = 'api_key' | ||
``` | ||
|
||
Then, send requests to any PDL API Endpoint: | ||
|
||
**Getting Person Data** | ||
```ruby | ||
# By Enrichment | ||
Peopledatalabs::Enrichment.person(params: { phone: '4155688415' }) | ||
|
||
# By Bulk Enrichment | ||
Peopledatalabs::Bulk.people(params: {requests: [{params: {profile: ['linkedin.com/in/seanthorne']}}, {params: {profile: ['linkedin.com/in/randrewn']}}]}) | ||
|
||
# By Search (SQL) | ||
Peopledatalabs::Search.people(searchType: 'sql', query: "SELECT * FROM person WHERE job_company_name='people data labs'") | ||
|
||
# By Search (Elasticsearch) | ||
Peopledatalabs::Search.people(searchType: 'elastic', query: {"query": {"term": {"job_company_name": "people data labs"}}}) | ||
|
||
# By PDL_ID | ||
Peopledatalabs::Retrieve.person(person_id: 'qEnOZ5Oh0poWnQ1luFBfVw_0000') | ||
|
||
# By Fuzzy Enrichment | ||
Peopledatalabs::Identify.person(params: { name: 'sean thorne' }) | ||
``` | ||
|
||
**Getting Company Data** | ||
```ruby | ||
# By Enrichment | ||
Peopledatalabs::Enrichment.company(params: { website: 'peopledatalabs.com' }) | ||
|
||
# By Search (SQL) | ||
Peopledatalabs::Search.company(searchType: 'sql', query: "SELECT * FROM company WHERE tags='big data' AND industry='financial services' AND location.country='united states'") | ||
|
||
# By Search (Elasticsearch) | ||
Peopledatalabs::Search.company(searchType: 'elastic', query: {"query": "must": [{"term": {"tags": "big data"}}, {"term": {"industry": "financial services"}}, {"term": {"location_country": "united states"}}]}) | ||
``` | ||
|
||
**Using Supporting APIs** | ||
```ruby | ||
# Get Autocomplete Suggestions | ||
Peopledatalabs::Autocomplete.retrieve(field: 'title', text: 'full', size: 10) | ||
|
||
# Clean Raw Company Strings | ||
Peopledatalabs::Cleaner.company(kind: 'name', value: 'peOple DaTa LabS') | ||
|
||
# Clean Raw Location Strings | ||
Peopledatalabs::Cleaner.location(value: '455 Market Street, San Francisco, California 94105, US') | ||
|
||
# Clean Raw School Strings | ||
Peopledatalabs::Cleaner.school(kind: 'name', value: 'university of oregon') | ||
``` | ||
|
||
## 🌐 Endpoints <a name="endpoints"></a> | ||
|
||
**Person Endpoints** | ||
| API Endpoint | peopledatalabs Function | | ||
|-|-| | ||
| [Person Enrichment API](https://docs.peopledatalabs.com/docs/enrichment-api) | `Peopledatalabs::Enrichment.person(...params)` | | ||
| [Person Bulk Person Enrichment API](https://docs.peopledatalabs.com/docs/bulk-enrichment-api) | `Peopledatalabs::Bulk.people(...records)` | | ||
| [Person Search API](https://docs.peopledatalabs.com/docs/search-api) | `Peopledatalabs::Search.person(...params)` | | ||
| [Person Retrieve API](https://docs.peopledatalabs.com/docs/person-retrieve-api) | `Peopledatalabs::Autocomplete.retrieve(...params)` | | ||
| [Person Identify API](https://docs.peopledatalabs.com/docs/identify-api) | `Peopledatalabs::Identify.person(...params)` | | ||
|
||
**Company Endpoints** | ||
| API Endpoint | peopledatalabs Function | | ||
|-|-| | ||
| [Company Enrichment API](https://docs.peopledatalabs.com/docs/company-enrichment-api) | `Peopledatalabs::Enrichment.company(...params)` | | ||
| [Company Search API](https://docs.peopledatalabs.com/docs/company-search-api) | `Peopledatalabs::Search.company(...params)` | | ||
|
||
**Supporting Endpoints** | ||
| API Endpoint | peopledatalabs Function | | ||
|-|-| | ||
| [Autocomplete API](https://docs.peopledatalabs.com/docs/autocomplete-api) | `Peopledatalabs::Autocomplete.retrieve(...params)` | | ||
| [Company Cleaner API](https://docs.peopledatalabs.com/docs/cleaner-apis#companyclean) | `Peopledatalabs::Cleaner.company(...params)` | | ||
| [Location Cleaner API](https://docs.peopledatalabs.com/docs/cleaner-apis#locationclean) | `Peopledatalabs::Cleaner.location(...params)` | | ||
| [School Cleaner API](https://docs.peopledatalabs.com/docs/cleaner-apis#schoolclean) | `Peopledatalabs::Cleaner.school(...params)` | | ||
|
||
|
||
## 📘 Documentation <a name="documentation"></a> | ||
|
||
All of our API endpoints are documented at: https://docs.peopledatalabs.com/ | ||
|
||
These docs describe the supported input parameters, output responses and also provide additional technical context. | ||
|
||
As illustrated in the [Endpoints](#endpoints) section above, each of our API endpoints is mapped to a specific method in the peopledatalabs class. For each of these class methods, **all function inputs are mapped as input parameters to the respective API endpoint**, meaning that you can use the API documentation linked above to determine the input parameters for each endpoint. | ||
|
||
As an example: | ||
|
||
The following is **valid** because `name` is a [supported input parameter to the Person Identify API](https://docs.peopledatalabs.com/docs/identify-api-reference#input-parameters): | ||
```ruby | ||
Peopledatalabs::Identify.person(params: { name: 'sean thorne' }) | ||
``` | ||
|
||
Conversely, this would be **invalid** because `fake_parameter` is not an input parameter to the Person Identify API: | ||
```ruby | ||
Peopledatalabs::Identify.person(params: { fake_parameter: 'anything' }) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require "bundler/gem_tasks" | ||
require "rspec/core/rake_task" | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "bundler/setup" | ||
require "peopledatalabs" | ||
|
||
# You can add fixtures and/or initialization code here to make experimenting | ||
# with your gem easier. You can also use a different console, if you like. | ||
|
||
# (If you use this, don't forget to add pry to your Gemfile!) | ||
# require "pry" | ||
# Pry.start | ||
|
||
require "irb" | ||
IRB.start(__FILE__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
set -vx | ||
|
||
bundle install | ||
|
||
# Do any other automated setup that you need to do here |
Oops, something went wrong.