Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Updated Title Roles #23

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 People Data Labs
Copyright (c) 2024 People Data Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion lib/peopledatalabs/resources/enrichment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ def self.company(params:)
get(path: '/v5/company/enrich', headers: headers, params: params)
end

def self.ip(ip:, return_ip_location: false, return_ip_metadata: false, return_person: false, return_if_unmatched: false)
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')
params = {
'ip' => ip,
'return_ip_location' => return_ip_location,
'return_ip_metadata' => return_ip_metadata,
'return_person' => return_person,
'return_if_unmatched' => return_if_unmatched,
'min_confidence' => min_confidence,
'updated_title_roles' => updated_title_roles,
}
headers = {
'Accept-Encoding' => 'gzip',
Expand Down
4 changes: 2 additions & 2 deletions lib/peopledatalabs/resources/retrieve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

module Peopledatalabs
class Retrieve < APIResource
def self.person(person_id:, pretty: false)
def self.person(person_id:, pretty: false, updated_title_roles: false)
headers = {
'Accept-Encoding' => 'gzip',
'User-Agent' => 'PDL-RUBY-SDK',
}
get(path: "/v5/person/retrieve/#{person_id}", headers: headers, params: { 'pretty' => pretty })
get(path: "/v5/person/retrieve/#{person_id}", headers: headers, params: { 'pretty' => pretty, 'updated_title_roles' => updated_title_roles })
end
end
end
11 changes: 7 additions & 4 deletions lib/peopledatalabs/resources/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,38 @@

module Peopledatalabs
class Search < APIResource
def self.person(searchType:, query: , titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil)
def self.person(searchType:, query: , titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil, updated_title_roles: false)
search(searchType: searchType,
query: query,
titlecase: titlecase,
dataset: dataset, size: size,
pretty: pretty,
scroll_token: scroll_token,
updated_title_roles: updated_title_roles,
kind: 'person')
end

def self.company(searchType:, query: , titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil)
def self.company(searchType:, query: , titlecase: false, dataset: 'all', size: 10, pretty: false, scroll_token: nil, updated_title_roles: false)
search(searchType: searchType,
query: query,
titlecase: titlecase,
dataset: dataset, size: size,
pretty: pretty,
scroll_token: scroll_token,
updated_title_roles: updated_title_roles,
kind: 'company')
end

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

body = {
searchType === 'sql' ? 'sql' : 'query' => query,
'dataset' => dataset,
'size' => size,
'pretty' => pretty,
'titlecase' => titlecase,
'scroll_token' => scroll_token
'scroll_token' => scroll_token,
'updated_title_roles' => updated_title_roles
}

headers = {
Expand Down
2 changes: 1 addition & 1 deletion lib/peopledatalabs/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Peopledatalabs
VERSION = "3.0.1"
VERSION = "3.1.0"
end
26 changes: 19 additions & 7 deletions spec/peopledatalabs_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RSpec.describe Peopledatalabs do

let(:phone) { '4155688415' }
let(:email) { 'varun@peopledatalabs.com' }

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

describe 'person enrichment' do
it "should return person record for a phone" do
result = Peopledatalabs::Enrichment.person(params: { phone: phone })
it "should return person record for a email" do
result = Peopledatalabs::Enrichment.person(params: { email: email })
expect(result['status']).to eq(200)
expect(result).to be_an_instance_of(Hash)
end

it "should return person record for a email with updated title roles" do
result = Peopledatalabs::Enrichment.person(params: { email: email, updated_title_roles: true })
expect(result['status']).to eq(200)
expect(result).to be_an_instance_of(Hash)
end
Expand All @@ -25,8 +31,8 @@
end

describe 'person identity' do
it "should return person record for a phone" do
result = Peopledatalabs::Identify.person(params: { phone: phone })
it "should return person record for a email" do
result = Peopledatalabs::Identify.person(params: { email: email })
expect(result['status']).to eq(200)
expect(result).to be_an_instance_of(Hash)
end
Expand Down Expand Up @@ -284,6 +290,13 @@
expect(result['data']['ip']['location']).to be_an_instance_of(Hash)
end

it "should return ip record with very high confidence" do
result = Peopledatalabs::Enrichment.ip(ip: '72.212.42.168', return_if_unmatched: true, return_ip_location: true, min_confidence: 'very high')
expect(result['status']).to eq(200)
expect(result).to be_an_instance_of(Hash)
expect(result['data']['ip']['location']).to be_an_instance_of(Hash)
end

it "should error" do
result = Peopledatalabs::Enrichment.ip(ip: nil)
expect(result['status']).to eq(400)
Expand Down Expand Up @@ -344,7 +357,7 @@
expect(result).to be_an_instance_of(Hash)
end

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


it "should error" do
Peopledatalabs.sandbox = true
result = Peopledatalabs::Search.person(searchType: nil, size: 10, query: nil)
Expand Down