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

Add Company Bulk Enrichment #17

Merged
merged 3 commits into from
Jan 9, 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
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Ruby 2.6
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 3.0

- name: Publish to RubyGems
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Setup Ruby
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 3.0

- name: Build and run test
env:
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ Peopledatalabs::Identify.person(params: { name: 'sean thorne' })
# By Enrichment
Peopledatalabs::Enrichment.company(params: { website: 'peopledatalabs.com' })

# By Bulk Enrichment
Peopledatalabs::Bulk.company(params: {requests: [{params: {profile: ['linkedin.com/company/peopledatalabs']}}, {params: {profile: ['linkedin.com/company/apple']}}]})

# By Search (SQL)
Peopledatalabs::Search.company(searchType: 'sql', query: "SELECT * FROM company WHERE tags='big data' AND industry='financial services' AND location.country='united states'")

Expand Down Expand Up @@ -150,6 +153,7 @@ Peopledatalabs.sandbox = true
| API Endpoint | peopledatalabs Function |
|-|-|
| [Company Enrichment API](https://docs.peopledatalabs.com/docs/company-enrichment-api) | `Peopledatalabs::Enrichment.company(...params)` |
| [Company Bulk Enrichment API](https://docs.peopledatalabs.com/docs/bulk-company-enrichment-api) | `Peopledatalabs::Bulk.company(...params)` |
| [Company Search API](https://docs.peopledatalabs.com/docs/company-search-api) | `Peopledatalabs::Search.company(...params)` |

**IP Endpoints**
Expand Down
2 changes: 1 addition & 1 deletion lib/peopledatalabs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


# gem build peopledatalabs.gemspec
# gem install ./peopledatalabs-2.2.0.gem
# gem install ./peopledatalabs-2.3.0.gem
# irb
# require 'peopledatalabs'
# rake spec PDL_API_KEY=API_KEY
Expand Down
8 changes: 8 additions & 0 deletions lib/peopledatalabs/resources/bulk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@ def self.person(params:)
}
post(path: '/v5/person/bulk', headers: headers, body: params)
end

def self.company(params:)
headers = {
'Accept-Encoding' => 'gzip',
'User-Agent' => 'PDL-RUBY-SDK',
}
post(path: '/v5/company/enrich/bulk', headers: headers, body: 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 = "2.2.0"
VERSION = "2.3.0"
end
30 changes: 30 additions & 0 deletions spec/peopledatalabs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,36 @@
end
end

describe 'company bulk' do
let(:records) {
{
requests: [
{
params: {
profile: ['linkedin.com/company/peopledatalabs'],
},
},
{
params: {
profile: ['linkedin.com/company/apple'],
},
},
],
}
}

it "should return company records" do
result = Peopledatalabs::Bulk.company(params: records)
expect(result['items'].length).to eq(2)
expect(result['items']).to be_an_instance_of(Array)
end

it "should error" do
result = Peopledatalabs::Bulk.company(params: {})
expect(result['status']).to eq(400)
end
end

describe 'company search' do

let(:elastic){
Expand Down