Skip to content
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ Peopledatalabs::Retrieve.person(person_id: 'qEnOZ5Oh0poWnQ1luFBfVw_0000')

# By Fuzzy Enrichment
Peopledatalabs::Identify.person(params: { name: 'sean thorne' })

# By Changelog
Peopledatalabs::Changelog.person(params: { current_version: '31.0', origin_version: '30.2', type: 'updated' })
```

**Using Company APIs**
Expand Down Expand Up @@ -142,6 +145,7 @@ Peopledatalabs.sandbox = true
| [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)` |
| [Person Changelog API](https://docs.peopledatalabs.com/docs/person-changelog-api) | `Peopledatalabs::Changelog.person(...params)` |

**Company Endpoints**
| API Endpoint | peopledatalabs Function |
Expand Down
2 changes: 2 additions & 0 deletions lib/peopledatalabs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require 'peopledatalabs/resources/retrieve'
require 'peopledatalabs/resources/bulk'
require 'peopledatalabs/resources/jobtitle'
require 'peopledatalabs/resources/changelog'


# gem build peopledatalabs.gemspec
Expand Down Expand Up @@ -40,6 +41,7 @@
# Peopledatalabs::Search.company(searchType: 'elastic', size: 10, query: { query: { bool: { must: [{term: {location_country: 'mexico'}}, {term: {job_title_role: 'health'}}, {exists: {field: 'phone_numbers'}}]}}})
# Peopledatalabs::JobTitle.retrieve(job_title: 'data scientist')
# Peopledatalabs::Enrichment.ip(ip: '72.212.42.169')
# Peopledatalabs::Changelog.person(params: { current_version: '31.0', origin_version: '30.2', type: 'updated' })

module Peopledatalabs
class Error < StandardError; end
Expand Down
8 changes: 8 additions & 0 deletions lib/peopledatalabs/api_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ def self.check(params:, path:)
if (!field)
result = { 'status' => 400, 'message' => 'Missing ip' }
end
elsif path.include? '/changelog'
current_version = params['current_version']
origin_version = params['origin_version']
if !current_version || !origin_version
result = { 'status' => 400, 'message' => 'Missing current_version or origin_version' }
elsif !params['ids'] && !params['type']
result = { 'status' => 400, 'message' => 'Missing ids or type' }
end
end
result
end
Expand Down
16 changes: 16 additions & 0 deletions lib/peopledatalabs/resources/changelog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

module Peopledatalabs
class Changelog < APIResource
def self.person(params:)
headers = {
'Accept-Encoding' => 'gzip',
'User-Agent' => 'PDL-RUBY-SDK',
}

stringified_params = params.transform_keys(&:to_s)

post(path: '/v5/person/changelog', headers: headers, body: stringified_params)
end
end
end
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 = "5.1.0"
VERSION = "5.2.0"
end
21 changes: 21 additions & 0 deletions spec/peopledatalabs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,27 @@
end


describe 'person changelog' do
it "should return changelog records" do
result = Peopledatalabs::Changelog.person(params: {
current_version: '31.0',
origin_version: '30.2',
type: 'updated',
})
expect(result).to have_key('data')
expect(result['data']['type']).to eq('updated')
end

it "should error" do
result = Peopledatalabs::Changelog.person(params: {
current_version: '31.0',
origin_version: '30.2'
})
expect(result['status']).to eq(400)
end
end


describe 'company enrichment' do
it "should return company record for a website" do
result = Peopledatalabs::Enrichment.company(params: { website: 'peopledatalabs.com' })
Expand Down