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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e90cb306466c21bc1a3ea7f1b20aa847caa6d35407b5994b9b116693a9ac8c6
4
- data.tar.gz: 2a8d78cd61c7273c56382ca000f56f26ebc7f33701625c58f2236feade30fe3f
3
+ metadata.gz: dcb0f2f6c5fe56216eaddb042b16fc105686ab2be354fe26f04e4bfe5948e69f
4
+ data.tar.gz: a101dbec0783f6fb2c2a3164a768f8acce0a13a8231e659dc647e9f85309f592
5
5
  SHA512:
6
- metadata.gz: c6bf87839450649eb8a335c66a5da21bf7014fb6355a47f578a09faf5d9c98d04d029fda1191c999a50eed808c7b99523414b75b3ad3e6a6e7baba6b244b1bc2
7
- data.tar.gz: 3d3882243f63423c55ab43ee2c240c836777dbf450e0c9cdd07c9be12e5a04246d9504565259a7e093bf8f7689282501432a98c4b9b888ba5d5c6dd47c1bb386
6
+ metadata.gz: b34e354eddf849a0da5734321c551557228066af39d5b7c870cf0f7ac5e4d8a966d1a134c6e8ea59017b2016b69b856c1a80f08f92400bbe2c86d8d9e8f5aa1f
7
+ data.tar.gz: 8239c66f3480b7e1022fd98774f0bfea305c745f06af7e1290baedf193c7e26c6134ae5ab29ffd89ba24642d51832c640874a4bc8e3fa120f4c6d9d8e8b8ed9c
data/.gitignore CHANGED
@@ -14,6 +14,7 @@
14
14
  /test/version_tmp/
15
15
  /tmp/
16
16
  /.idea
17
+ .env
17
18
 
18
19
 
19
20
  # Used by dotenv library to load environment variables.
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
- **Getting Person Data**
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.people(params: {requests: [{params: {profile: ['linkedin.com/in/seanthorne']}}, {params: {profile: ['linkedin.com/in/randrewn']}}]})
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.people(searchType: 'sql', query: "SELECT * FROM person WHERE job_company_name='people data labs'")
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.people(searchType: 'elastic', query: {"query": {"term": {"job_company_name": "people data labs"}}})
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
- **Getting Company Data**
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 Supporting APIs**
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.people(...records)` |
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 :api_base
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Peopledatalabs
4
4
  class Bulk < APIResource
5
- def self.people(params:)
5
+ def self.person(params:)
6
6
  headers = {
7
7
  'Accept-Encoding' => 'gzip',
8
8
  'User-Agent' => 'PDL-RUBY-SDK',
@@ -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.people(searchType:, query: , titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil)
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
+
@@ -1,3 +1,3 @@
1
1
  module Peopledatalabs
2
- VERSION = "1.0.4"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -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-1.0.4.gem
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.people(searchType: 'elastic', query: {"query": {"term": {"job_company_name": "people data labs"}}})
29
- # Peopledatalabs::Search.people(searchType: 'sql', query: "SELECT * FROM person WHERE job_company_name='people data labs'")
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.people(params: {requests: [{params: {profile: ['linkedin.com/in/seanthorne']}}, {params: {profile: ['linkedin.com/in/randrewn']}}]})
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, :api_base, :api_base=
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: 1.0.4
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-07-22 00:00:00.000000000 Z
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