peopledatalabs 1.0.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +39 -8
- data/lib/peopledatalabs/api_resource.rb +10 -0
- data/lib/peopledatalabs/configuration.rb +5 -2
- data/lib/peopledatalabs/resources/bulk.rb +1 -1
- data/lib/peopledatalabs/resources/jobtitle.rb +20 -0
- data/lib/peopledatalabs/resources/search.rb +1 -1
- data/lib/peopledatalabs/resources/skill.rb +20 -0
- data/lib/peopledatalabs/version.rb +1 -1
- data/lib/peopledatalabs.rb +12 -5
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcb0f2f6c5fe56216eaddb042b16fc105686ab2be354fe26f04e4bfe5948e69f
|
4
|
+
data.tar.gz: a101dbec0783f6fb2c2a3164a768f8acce0a13a8231e659dc647e9f85309f592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b34e354eddf849a0da5734321c551557228066af39d5b7c870cf0f7ac5e4d8a966d1a134c6e8ea59017b2016b69b856c1a80f08f92400bbe2c86d8d9e8f5aa1f
|
7
|
+
data.tar.gz: 8239c66f3480b7e1022fd98774f0bfea305c745f06af7e1290baedf193c7e26c6134ae5ab29ffd89ba24642d51832c640874a4bc8e3fa120f4c6d9d8e8b8ed9c
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -24,8 +24,10 @@ This library bundles up PDL API requests into simple function calls, making it e
|
|
24
24
|
## Table of Contents
|
25
25
|
- [🔧 Installation](#installation)
|
26
26
|
- [🚀 Usage](#usage)
|
27
|
+
- [🏝 Sandbox Usage](#sandbox)
|
27
28
|
- [🌐 Endpoints](#endpoints)
|
28
29
|
- [📘 Documentation](#documentation)
|
30
|
+
- [⚠️ Upgrading from v1.X.X to v2.0.0](#upgrading)
|
29
31
|
|
30
32
|
## Installation <a name="installation"></a>
|
31
33
|
|
@@ -58,19 +60,19 @@ Peopledatalabs.api_key = 'api_key'
|
|
58
60
|
|
59
61
|
Then, send requests to any PDL API Endpoint:
|
60
62
|
|
61
|
-
**
|
63
|
+
**Using Person APIs**
|
62
64
|
```ruby
|
63
65
|
# By Enrichment
|
64
66
|
Peopledatalabs::Enrichment.person(params: { phone: '4155688415' })
|
65
67
|
|
66
68
|
# By Bulk Enrichment
|
67
|
-
Peopledatalabs::Bulk.
|
69
|
+
Peopledatalabs::Bulk.person(params: {requests: [{params: {profile: ['linkedin.com/in/seanthorne']}}, {params: {profile: ['linkedin.com/in/randrewn']}}]})
|
68
70
|
|
69
71
|
# By Search (SQL)
|
70
|
-
Peopledatalabs::Search.
|
72
|
+
Peopledatalabs::Search.person(searchType: 'sql', query: "SELECT * FROM person WHERE job_company_name='people data labs'")
|
71
73
|
|
72
74
|
# By Search (Elasticsearch)
|
73
|
-
Peopledatalabs::Search.
|
75
|
+
Peopledatalabs::Search.person(searchType: 'elastic', query: {"query": {"term": {"job_company_name": "people data labs"}}})
|
74
76
|
|
75
77
|
# By PDL_ID
|
76
78
|
Peopledatalabs::Retrieve.person(person_id: 'qEnOZ5Oh0poWnQ1luFBfVw_0000')
|
@@ -79,7 +81,7 @@ Peopledatalabs::Retrieve.person(person_id: 'qEnOZ5Oh0poWnQ1luFBfVw_0000')
|
|
79
81
|
Peopledatalabs::Identify.person(params: { name: 'sean thorne' })
|
80
82
|
```
|
81
83
|
|
82
|
-
**
|
84
|
+
**Using Company APIs**
|
83
85
|
```ruby
|
84
86
|
# By Enrichment
|
85
87
|
Peopledatalabs::Enrichment.company(params: { website: 'peopledatalabs.com' })
|
@@ -91,11 +93,14 @@ Peopledatalabs::Search.company(searchType: 'sql', query: "SELECT * FROM company
|
|
91
93
|
Peopledatalabs::Search.company(searchType: 'elastic', query: {"query": "must": [{"term": {"tags": "big data"}}, {"term": {"industry": "financial services"}}, {"term": {"location_country": "united states"}}]})
|
92
94
|
```
|
93
95
|
|
94
|
-
**Using
|
96
|
+
**Using Autocomplete API**
|
95
97
|
```ruby
|
96
98
|
# Get Autocomplete Suggestions
|
97
99
|
Peopledatalabs::Autocomplete.retrieve(field: 'title', text: 'full', size: 10)
|
100
|
+
```
|
98
101
|
|
102
|
+
**Using Cleaner APIs**
|
103
|
+
```ruby
|
99
104
|
# Clean Raw Company Strings
|
100
105
|
Peopledatalabs::Cleaner.company(kind: 'name', value: 'peOple DaTa LabS')
|
101
106
|
|
@@ -106,13 +111,31 @@ Peopledatalabs::Cleaner.location(value: '455 Market Street, San Francisco, Calif
|
|
106
111
|
Peopledatalabs::Cleaner.school(kind: 'name', value: 'university of oregon')
|
107
112
|
```
|
108
113
|
|
114
|
+
**Using Job Title Enrichment API**
|
115
|
+
```ruby
|
116
|
+
# Get Job Title Enrichment
|
117
|
+
Peopledatalabs::JobTitle.retrieve(job_title: 'data scientist')
|
118
|
+
```
|
119
|
+
|
120
|
+
**Using Skill Enrichment API**
|
121
|
+
```ruby
|
122
|
+
# Get Skill Enrichment
|
123
|
+
Peopledatalabs::Skill.retrieve(skill: 'c++')
|
124
|
+
```
|
125
|
+
|
126
|
+
## 🏝 Sandbox Usage <a name="sandbox"></a>
|
127
|
+
```ruby
|
128
|
+
# To enable sandbox usage, use the following flag
|
129
|
+
Peopledatalabs.sandbox = true
|
130
|
+
```
|
131
|
+
|
109
132
|
## 🌐 Endpoints <a name="endpoints"></a>
|
110
133
|
|
111
134
|
**Person Endpoints**
|
112
135
|
| API Endpoint | peopledatalabs Function |
|
113
136
|
|-|-|
|
114
137
|
| [Person Enrichment API](https://docs.peopledatalabs.com/docs/enrichment-api) | `Peopledatalabs::Enrichment.person(...params)` |
|
115
|
-
| [Person Bulk Person Enrichment API](https://docs.peopledatalabs.com/docs/bulk-enrichment-api) | `Peopledatalabs::Bulk.
|
138
|
+
| [Person Bulk Person Enrichment API](https://docs.peopledatalabs.com/docs/bulk-enrichment-api) | `Peopledatalabs::Bulk.person(...records)` |
|
116
139
|
| [Person Search API](https://docs.peopledatalabs.com/docs/search-api) | `Peopledatalabs::Search.person(...params)` |
|
117
140
|
| [Person Retrieve API](https://docs.peopledatalabs.com/docs/person-retrieve-api) | `Peopledatalabs::Autocomplete.retrieve(...params)` |
|
118
141
|
| [Person Identify API](https://docs.peopledatalabs.com/docs/identify-api) | `Peopledatalabs::Identify.person(...params)` |
|
@@ -130,7 +153,8 @@ Peopledatalabs::Cleaner.school(kind: 'name', value: 'university of oregon')
|
|
130
153
|
| [Company Cleaner API](https://docs.peopledatalabs.com/docs/cleaner-apis#companyclean) | `Peopledatalabs::Cleaner.company(...params)` |
|
131
154
|
| [Location Cleaner API](https://docs.peopledatalabs.com/docs/cleaner-apis#locationclean) | `Peopledatalabs::Cleaner.location(...params)` |
|
132
155
|
| [School Cleaner API](https://docs.peopledatalabs.com/docs/cleaner-apis#schoolclean) | `Peopledatalabs::Cleaner.school(...params)` |
|
133
|
-
|
156
|
+
| [Job Title Enrichment API](https://docs.peopledatalabs.com/docs/job-title-enrichment-api) | `Peopledatalabs::JobTitle.retrieve(...params)` |
|
157
|
+
| [Skill Enrichment API](https://docs.peopledatalabs.com/docs/skill-enrichment-api) | `Peopledatalabs::Skill.retrieve(...params)` |
|
134
158
|
|
135
159
|
## 📘 Documentation <a name="documentation"></a>
|
136
160
|
|
@@ -151,3 +175,10 @@ Conversely, this would be **invalid** because `fake_parameter` is not an input p
|
|
151
175
|
```ruby
|
152
176
|
Peopledatalabs::Identify.person(params: { fake_parameter: 'anything' })
|
153
177
|
```
|
178
|
+
|
179
|
+
## ⚠️ Upgrading from v1.X.X to v2.0.0 <a name="upgrading"></a>
|
180
|
+
|
181
|
+
Bulk Person and Person Search now use .person instead of .people
|
182
|
+
|
183
|
+
i.e. Peopledatalabs::Bulk.people(...records) is now Peopledatalabs::Bulk.person(...records)
|
184
|
+
<br />i.e. Peopledatalabs::Search.people(...params) is now Peopledatalabs::Search.person(...params)
|
@@ -81,6 +81,16 @@ module Peopledatalabs
|
|
81
81
|
elsif (!VALID_AUTOCOMPLETE_FIELDS.include?(field))
|
82
82
|
result = { 'status' => 400, 'message' => "Field should be one of: #{VALID_AUTOCOMPLETE_FIELDS.join(', ')}" }
|
83
83
|
end
|
84
|
+
elsif path.include? '/job_title'
|
85
|
+
field = params['job_title']
|
86
|
+
if (!field)
|
87
|
+
result = { 'status' => 400, 'message' => 'Missing job_title' }
|
88
|
+
end
|
89
|
+
elsif path.include? '/skill'
|
90
|
+
field = params['skill']
|
91
|
+
if (!field)
|
92
|
+
result = { 'status' => 400, 'message' => 'Missing skill' }
|
93
|
+
end
|
84
94
|
end
|
85
95
|
result
|
86
96
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Peopledatalabs
|
4
4
|
class Configuration
|
5
5
|
attr_accessor :api_key
|
6
|
-
attr_accessor :
|
6
|
+
attr_accessor :sandbox
|
7
7
|
attr_accessor :read_timeout
|
8
8
|
|
9
9
|
def self.setup
|
@@ -13,10 +13,13 @@ module Peopledatalabs
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize
|
16
|
-
@api_base = "https://api.peopledatalabs.com"
|
17
16
|
@read_timeout = 10
|
18
17
|
@api_key ||= ENV['PDL_API_KEY']
|
18
|
+
@sanbox = false
|
19
19
|
end
|
20
20
|
|
21
|
+
def api_base
|
22
|
+
sandbox ? 'https://sandbox.api.peopledatalabs.com' : 'https://api.peopledatalabs.com'
|
23
|
+
end
|
21
24
|
end
|
22
25
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Peopledatalabs
|
4
|
+
class JobTitle < APIResource
|
5
|
+
def self.retrieve(job_title:, pretty: false)
|
6
|
+
|
7
|
+
params = {
|
8
|
+
'job_title' => job_title,
|
9
|
+
'pretty' => pretty,
|
10
|
+
};
|
11
|
+
|
12
|
+
headers = {
|
13
|
+
'Accept-Encoding' => 'gzip',
|
14
|
+
'User-Agent' => 'PDL-RUBY-SDK',
|
15
|
+
}
|
16
|
+
get(path: '/v5/job_title/enrich', headers: headers, params: params)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Peopledatalabs
|
4
4
|
class Search < APIResource
|
5
|
-
def self.
|
5
|
+
def self.person(searchType:, query: , titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil)
|
6
6
|
search(searchType: searchType,
|
7
7
|
query: query,
|
8
8
|
titlecase: titlecase,
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Peopledatalabs
|
4
|
+
class Skill < APIResource
|
5
|
+
def self.retrieve(skill:, pretty: false)
|
6
|
+
|
7
|
+
params = {
|
8
|
+
'skill' => skill,
|
9
|
+
'pretty' => pretty,
|
10
|
+
};
|
11
|
+
|
12
|
+
headers = {
|
13
|
+
'Accept-Encoding' => 'gzip',
|
14
|
+
'User-Agent' => 'PDL-RUBY-SDK',
|
15
|
+
}
|
16
|
+
get(path: '/v5/skill/enrich', headers: headers, params: params)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
data/lib/peopledatalabs.rb
CHANGED
@@ -10,10 +10,12 @@ require 'peopledatalabs/resources/enrichment'
|
|
10
10
|
require 'peopledatalabs/resources/identify'
|
11
11
|
require 'peopledatalabs/resources/retrieve'
|
12
12
|
require 'peopledatalabs/resources/bulk'
|
13
|
+
require 'peopledatalabs/resources/jobtitle'
|
14
|
+
require 'peopledatalabs/resources/skill'
|
13
15
|
|
14
16
|
|
15
17
|
# gem build peopledatalabs.gemspec
|
16
|
-
# gem install ./peopledatalabs-
|
18
|
+
# gem install ./peopledatalabs-2.0.0.gem
|
17
19
|
# irb
|
18
20
|
# require 'peopledatalabs'
|
19
21
|
# rake spec PDL_API_KEY=API_KEY
|
@@ -21,20 +23,24 @@ require 'peopledatalabs/resources/bulk'
|
|
21
23
|
# Usage
|
22
24
|
# First set api key
|
23
25
|
# Peopledatalabs.api_key = 'api_key'
|
26
|
+
# # Can set sandbox to true. Defaults to false
|
27
|
+
# # Peopledatalabs.sandbox = false
|
24
28
|
# Examples Calls:
|
25
29
|
# Peopledatalabs::Cleaner.company(kind: 'website', value: 'peopledatalabs.com')
|
26
30
|
# Peopledatalabs::Cleaner.school(kind: 'profile', value: 'linkedin.com/school/ucla')
|
27
31
|
# Peopledatalabs::Cleaner.location(value: '239 NW 13th Ave, Portland, Oregon 97209, US')
|
28
|
-
# Peopledatalabs::Search.
|
29
|
-
# Peopledatalabs::Search.
|
32
|
+
# Peopledatalabs::Search.person(searchType: 'elastic', query: {"query": {"term": {"job_company_name": "people data labs"}}})
|
33
|
+
# Peopledatalabs::Search.person(searchType: 'sql', query: "SELECT * FROM person WHERE job_company_name='people data labs'")
|
30
34
|
# Peopledatalabs::Autocomplete.retrieve(field: 'school', text: 'university of michigan')
|
31
35
|
# Peopledatalabs::Enrichment.person(params: { name: 'Jennifer C. Jackson', locality: 'Boise' })
|
32
|
-
# Peopledatalabs::Bulk.
|
36
|
+
# Peopledatalabs::Bulk.person(params: {requests: [{params: {profile: ['linkedin.com/in/seanthorne']}}, {params: {profile: ['linkedin.com/in/randrewn']}}]})
|
33
37
|
# Peopledatalabs::Enrichment.company(params: { name: 'Google, Inc.', ticker: 'GOOGL'})
|
34
38
|
# Peopledatalabs::Identify.person(params: { name: 'Jennifer C. Jackson', location: 'Medford, OR USA' })
|
35
39
|
# Peopledatalabs::Retrieve.person(person_id: 'qEnOZ5Oh0poWnQ1luFBfVw_0000')
|
36
40
|
# Peopledatalabs::Search.company(searchType: 'sql', size: 10, query: "SELECT * FROM company WHERE tags='big data' AND industry='financial services' AND location.country='united states';")
|
37
41
|
# Peopledatalabs::Search.company(searchType: 'elastic', size: 10, query: { query: { bool: { must: [{term: {location_country: 'mexico'}}, {term: {job_title_role: 'health'}}, {exists: {field: 'phone_numbers'}}]}}})
|
42
|
+
# Peopledatalabs::JobTitle.retrieve(job_title: 'data scientist')
|
43
|
+
# Peopledatalabs::Skill.retrieve(skill: 'c++')
|
38
44
|
|
39
45
|
module Peopledatalabs
|
40
46
|
class Error < StandardError; end
|
@@ -47,8 +53,9 @@ module Peopledatalabs
|
|
47
53
|
attr_reader :config
|
48
54
|
|
49
55
|
def_delegators :@config, :api_key, :api_key=
|
50
|
-
def_delegators :@config, :
|
56
|
+
def_delegators :@config, :sandbox, :sandbox=
|
51
57
|
def_delegators :@config, :read_timeout, :read_timeout=
|
58
|
+
def_delegators :@config, :api_base
|
52
59
|
end
|
53
60
|
end
|
54
61
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peopledatalabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- People Data Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -111,8 +111,10 @@ files:
|
|
111
111
|
- lib/peopledatalabs/resources/cleaner.rb
|
112
112
|
- lib/peopledatalabs/resources/enrichment.rb
|
113
113
|
- lib/peopledatalabs/resources/identify.rb
|
114
|
+
- lib/peopledatalabs/resources/jobtitle.rb
|
114
115
|
- lib/peopledatalabs/resources/retrieve.rb
|
115
116
|
- lib/peopledatalabs/resources/search.rb
|
117
|
+
- lib/peopledatalabs/resources/skill.rb
|
116
118
|
- lib/peopledatalabs/version.rb
|
117
119
|
- peopledatalabs.gemspec
|
118
120
|
homepage: https://www.peopledatalabs.com
|