Skip to content

Commit 4e4d677

Browse files
authored
Support for Updated Title Roles (#23)
* api updates * add tests * fixes
1 parent a4602d2 commit 4e4d677

File tree

6 files changed

+33
-16
lines changed

6 files changed

+33
-16
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 People Data Labs
3+
Copyright (c) 2024 People Data Labs
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

lib/peopledatalabs/resources/enrichment.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ def self.company(params:)
1818
get(path: '/v5/company/enrich', headers: headers, params: params)
1919
end
2020

21-
def self.ip(ip:, return_ip_location: false, return_ip_metadata: false, return_person: false, return_if_unmatched: false)
21+
def self.ip(ip:, return_ip_location: false, return_ip_metadata: false, return_person: false, return_if_unmatched: false, updated_title_roles: false, min_confidence: 'very low')
2222
params = {
2323
'ip' => ip,
2424
'return_ip_location' => return_ip_location,
2525
'return_ip_metadata' => return_ip_metadata,
2626
'return_person' => return_person,
2727
'return_if_unmatched' => return_if_unmatched,
28+
'min_confidence' => min_confidence,
29+
'updated_title_roles' => updated_title_roles,
2830
}
2931
headers = {
3032
'Accept-Encoding' => 'gzip',

lib/peopledatalabs/resources/retrieve.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
module Peopledatalabs
44
class Retrieve < APIResource
5-
def self.person(person_id:, pretty: false)
5+
def self.person(person_id:, pretty: false, updated_title_roles: false)
66
headers = {
77
'Accept-Encoding' => 'gzip',
88
'User-Agent' => 'PDL-RUBY-SDK',
99
}
10-
get(path: "/v5/person/retrieve/#{person_id}", headers: headers, params: { 'pretty' => pretty })
10+
get(path: "/v5/person/retrieve/#{person_id}", headers: headers, params: { 'pretty' => pretty, 'updated_title_roles' => updated_title_roles })
1111
end
1212
end
1313
end

lib/peopledatalabs/resources/search.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,38 @@
22

33
module Peopledatalabs
44
class Search < APIResource
5-
def self.person(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, updated_title_roles: false)
66
search(searchType: searchType,
77
query: query,
88
titlecase: titlecase,
99
dataset: dataset, size: size,
1010
pretty: pretty,
1111
scroll_token: scroll_token,
12+
updated_title_roles: updated_title_roles,
1213
kind: 'person')
1314
end
1415

15-
def self.company(searchType:, query: , titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil)
16+
def self.company(searchType:, query: , titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil, updated_title_roles: false)
1617
search(searchType: searchType,
1718
query: query,
1819
titlecase: titlecase,
1920
dataset: dataset, size: size,
2021
pretty: pretty,
2122
scroll_token: scroll_token,
23+
updated_title_roles: updated_title_roles,
2224
kind: 'company')
2325
end
2426

25-
def self.search(searchType:, query:, kind:, titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil)
27+
def self.search(searchType:, query:, kind:, titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil, updated_title_roles: false)
2628

2729
body = {
2830
searchType === 'sql' ? 'sql' : 'query' => query,
2931
'dataset' => dataset,
3032
'size' => size,
3133
'pretty' => pretty,
3234
'titlecase' => titlecase,
33-
'scroll_token' => scroll_token
35+
'scroll_token' => scroll_token,
36+
'updated_title_roles' => updated_title_roles
3437
}
3538

3639
headers = {

lib/peopledatalabs/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Peopledatalabs
2-
VERSION = "3.0.1"
2+
VERSION = "3.1.0"
33
end

spec/peopledatalabs_spec.rb

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
RSpec.describe Peopledatalabs do
22

3-
let(:phone) { '4155688415' }
3+
let(:email) { '[email protected]' }
44

55
it "has a version number" do
66
expect(Peopledatalabs::VERSION).not_to be nil
@@ -11,8 +11,14 @@
1111
end
1212

1313
describe 'person enrichment' do
14-
it "should return person record for a phone" do
15-
result = Peopledatalabs::Enrichment.person(params: { phone: phone })
14+
it "should return person record for a email" do
15+
result = Peopledatalabs::Enrichment.person(params: { email: email })
16+
expect(result['status']).to eq(200)
17+
expect(result).to be_an_instance_of(Hash)
18+
end
19+
20+
it "should return person record for a email with updated title roles" do
21+
result = Peopledatalabs::Enrichment.person(params: { email: email, updated_title_roles: true })
1622
expect(result['status']).to eq(200)
1723
expect(result).to be_an_instance_of(Hash)
1824
end
@@ -25,8 +31,8 @@
2531
end
2632

2733
describe 'person identity' do
28-
it "should return person record for a phone" do
29-
result = Peopledatalabs::Identify.person(params: { phone: phone })
34+
it "should return person record for a email" do
35+
result = Peopledatalabs::Identify.person(params: { email: email })
3036
expect(result['status']).to eq(200)
3137
expect(result).to be_an_instance_of(Hash)
3238
end
@@ -284,6 +290,13 @@
284290
expect(result['data']['ip']['location']).to be_an_instance_of(Hash)
285291
end
286292

293+
it "should return ip record with very high confidence" do
294+
result = Peopledatalabs::Enrichment.ip(ip: '72.212.42.168', return_if_unmatched: true, return_ip_location: true, min_confidence: 'very high')
295+
expect(result['status']).to eq(200)
296+
expect(result).to be_an_instance_of(Hash)
297+
expect(result['data']['ip']['location']).to be_an_instance_of(Hash)
298+
end
299+
287300
it "should error" do
288301
result = Peopledatalabs::Enrichment.ip(ip: nil)
289302
expect(result['status']).to eq(400)
@@ -344,7 +357,7 @@
344357
expect(result).to be_an_instance_of(Hash)
345358
end
346359

347-
it "should return sandbox person record for a phone" do
360+
it "should return sandbox person record for a company name" do
348361
Peopledatalabs.sandbox = true
349362
result = Peopledatalabs::Identify.person(params: { company: 'adams group' })
350363
expect(result['status']).to eq(200)
@@ -388,7 +401,6 @@
388401
expect(result).to be_an_instance_of(Hash)
389402
end
390403

391-
392404
it "should error" do
393405
Peopledatalabs.sandbox = true
394406
result = Peopledatalabs::Search.person(searchType: nil, size: 10, query: nil)

0 commit comments

Comments
 (0)