peopledatalabs 1.0.1 → 1.0.4

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: 00bee237df859992458f8e1e420294d97a071272a0640b9e62dc7fe65dfefdb0
4
- data.tar.gz: 11488fb8d2d2646f83e0d3b28e43f6d225dfcc0296310b1f0b337fe84a5b25d2
3
+ metadata.gz: 1e90cb306466c21bc1a3ea7f1b20aa847caa6d35407b5994b9b116693a9ac8c6
4
+ data.tar.gz: 2a8d78cd61c7273c56382ca000f56f26ebc7f33701625c58f2236feade30fe3f
5
5
  SHA512:
6
- metadata.gz: cb2e9f36ddb22894e7e8d618e02fd51f901488f4ff9c32a980446d0c8d905039fa76ea50f4c651dad146576263596a9b259ccb3f4dd6b766c3b7ef34d9abe4bc
7
- data.tar.gz: 664d7043864a6425fedfdbb592b7bca097ef39effd1d3691a38e98aaa07426c9d1ce418303945cb503e663f45542a741e0a7cb332266ae4c2454793724915b02
6
+ metadata.gz: c6bf87839450649eb8a335c66a5da21bf7014fb6355a47f578a09faf5d9c98d04d029fda1191c999a50eed808c7b99523414b75b3ad3e6a6e7baba6b244b1bc2
7
+ data.tar.gz: 3d3882243f63423c55ab43ee2c240c836777dbf450e0c9cdd07c9be12e5a04246d9504565259a7e093bf8f7689282501432a98c4b9b888ba5d5c6dd47c1bb386
@@ -10,9 +10,10 @@ module Peopledatalabs
10
10
  return request unless request['status'] == 200
11
11
 
12
12
  response = HTTP
13
- .timeout(Peopledatalabs.read_timeout)
14
- .headers(headers)
15
- .get(url(path), params: query_authentication(params))
13
+ .use(:auto_inflate)
14
+ .timeout(Peopledatalabs.read_timeout)
15
+ .headers(headers)
16
+ .get(url(path), params: query_authentication(params))
16
17
  handle_response(response)
17
18
  end
18
19
 
@@ -21,9 +22,10 @@ module Peopledatalabs
21
22
  return request unless request['status'] == 200
22
23
 
23
24
  response = HTTP
24
- .timeout(Peopledatalabs.read_timeout)
25
- .headers(header_authentication(headers))
26
- .post(url(path), json: body)
25
+ .use(:auto_inflate)
26
+ .timeout(Peopledatalabs.read_timeout)
27
+ .headers(header_authentication(headers))
28
+ .post(url(path), json: body)
27
29
  handle_response(response)
28
30
  end
29
31
 
@@ -97,15 +99,27 @@ module Peopledatalabs
97
99
  # 'data' => response.parse
98
100
  # }
99
101
 
102
+ rate_limit_remaining = response.headers['X-RateLimit-Remaining'] ? JSON.parse(response.headers['X-RateLimit-Remaining'].gsub("'",'"')) : {}
103
+ rate_limit_limit = response.headers['X-RateLimit-Limit'] ? JSON.parse(response.headers['X-RateLimit-Limit'].gsub("'",'"')) : {}
104
+
100
105
  rate_limit = {
101
- 'retry_after' => to_number(response.headers['Retry-After']),
102
- 'rate_limit' => to_number(response.headers['X-RateLimit-Limit']),
103
- 'rateLimit_reset' => to_number(response.headers['X-RateLimit-Reset']),
104
- 'total_limit' => to_number(response.headers['X-TotalLimit-Limit']),
105
- 'total_limit_remaining' => to_number(response.headers['X-RateLimit-Remaining']),
106
- 'search_limit_remaining' => to_number(response.headers['X-SearchLimit-Remaining']),
107
- 'enrich_company_limit_remaining' => to_number(response.headers['X-EnrichCompanyLimit-Remaining']),
108
- 'person_identify_limit_remaining' => to_number(response.headers['X-PersonIdentifyLimit-Remaining'])
106
+ 'call_credits_spent' => to_number(response.headers['X-Call-Credits-Spent']),
107
+ 'call_credits_type' => response.headers['X-Call-Credits-Type'],
108
+ 'rate_limit_reset' => response.headers['X-RateLimit-Reset'],
109
+ 'rate_limit_remaining' => {
110
+ 'minute' => to_number(rate_limit_remaining['minute']),
111
+ 'day' => to_number(rate_limit_remaining['day']),
112
+ 'month' => to_number(rate_limit_remaining['month'])
113
+ },
114
+ 'rate_limit_limit' => {
115
+ 'minute' => to_number(rate_limit_limit['minute']),
116
+ 'day' => to_number(rate_limit_limit['day']),
117
+ 'month' => to_number(rate_limit_limit['month'])
118
+ },
119
+ 'lifetime_used' => to_number(response.headers['X-Lifetime-Used']),
120
+ 'total_limit_remaining' => to_number(response.headers['X-TotalLimit-Remaining']),
121
+ 'total_limit_purchased_remaining' => to_number(response.headers['X-TotalLimit-Purchased-Remaining']),
122
+ 'total_limit_overages_remaining' => to_number(response.headers['X-TotalLimit-Overages-Remaining'])
109
123
  }
110
124
 
111
125
  parsed_response = response.parse
@@ -11,8 +11,11 @@ module Peopledatalabs
11
11
  'pretty' => pretty,
12
12
  };
13
13
 
14
- # headers = { 'Accept-Encoding' => 'gzip' }
15
- get(path: '/v5/autocomplete', params: params)
14
+ headers = {
15
+ 'Accept-Encoding' => 'gzip',
16
+ 'User-Agent' => 'PDL-RUBY-SDK',
17
+ }
18
+ get(path: '/v5/autocomplete', headers: headers, params: params)
16
19
  end
17
20
  end
18
21
  end
@@ -3,9 +3,11 @@
3
3
  module Peopledatalabs
4
4
  class Bulk < APIResource
5
5
  def self.people(params:)
6
- # TODO: possibly add gzip encoding
7
- # headers = { 'Accept-Encoding' => 'gzip' }
8
- post(path: '/v5/person/bulk', body: params)
6
+ headers = {
7
+ 'Accept-Encoding' => 'gzip',
8
+ 'User-Agent' => 'PDL-RUBY-SDK',
9
+ }
10
+ post(path: '/v5/person/bulk', headers: headers, body: params)
9
11
  end
10
12
  end
11
13
  end
@@ -3,21 +3,27 @@
3
3
  module Peopledatalabs
4
4
  class Cleaner < APIResource
5
5
  def self.company(kind:, value:)
6
- # TODO: possibly add gzip encoding
7
- # headers = { 'Accept-Encoding' => 'gzip' }
8
- get(path: '/v5/company/clean', params: { kind => value })
6
+ headers = {
7
+ 'Accept-Encoding' => 'gzip',
8
+ 'User-Agent' => 'PDL-RUBY-SDK',
9
+ }
10
+ get(path: '/v5/company/clean', headers: headers, params: { kind => value })
9
11
  end
10
12
 
11
13
  def self.school(kind:, value:)
12
- # TODO: possibly add gzip encoding
13
- # headers = { 'Accept-Encoding' => 'gzip' }
14
- get(path: '/v5/school/clean', params: { kind => value })
14
+ headers = {
15
+ 'Accept-Encoding' => 'gzip',
16
+ 'User-Agent' => 'PDL-RUBY-SDK',
17
+ }
18
+ get(path: '/v5/school/clean', headers: headers, params: { kind => value })
15
19
  end
16
20
 
17
21
  def self.location(value:)
18
- # TODO: possibly add gzip encoding
19
- # headers = { 'Accept-Encoding' => 'gzip' }
20
- get(path: '/v5/location/clean', params: { 'location' => value })
22
+ headers = {
23
+ 'Accept-Encoding' => 'gzip',
24
+ 'User-Agent' => 'PDL-RUBY-SDK',
25
+ }
26
+ get(path: '/v5/location/clean', headers: headers, params: { 'location' => value })
21
27
  end
22
28
 
23
29
 
@@ -3,15 +3,19 @@
3
3
  module Peopledatalabs
4
4
  class Enrichment < APIResource
5
5
  def self.person(params:)
6
- # TODO: possibly add gzip encoding
7
- # headers = { 'Accept-Encoding' => 'gzip' }
8
- get(path: '/v5/person/enrich', params: params)
6
+ headers = {
7
+ 'Accept-Encoding' => 'gzip',
8
+ 'User-Agent' => 'PDL-RUBY-SDK',
9
+ }
10
+ get(path: '/v5/person/enrich', headers: headers, params: params)
9
11
  end
10
12
 
11
13
  def self.company(params:)
12
- # TODO: possibly add gzip encoding
13
- # headers = { 'Accept-Encoding' => 'gzip' }
14
- get(path: '/v5/company/enrich', params: params)
14
+ headers = {
15
+ 'Accept-Encoding' => 'gzip',
16
+ 'User-Agent' => 'PDL-RUBY-SDK',
17
+ }
18
+ get(path: '/v5/company/enrich', headers: headers, params: params)
15
19
  end
16
20
 
17
21
  end
@@ -3,9 +3,11 @@
3
3
  module Peopledatalabs
4
4
  class Identify < APIResource
5
5
  def self.person(params:)
6
- # TODO: possibly add gzip encoding
7
- # headers = { 'Accept-Encoding' => 'gzip' }
8
- get(path: '/v5/person/identify', params: params)
6
+ headers = {
7
+ 'Accept-Encoding' => 'gzip',
8
+ 'User-Agent' => 'PDL-RUBY-SDK',
9
+ }
10
+ get(path: '/v5/person/identify', headers: headers, params: params)
9
11
  end
10
12
  end
11
13
  end
@@ -3,9 +3,11 @@
3
3
  module Peopledatalabs
4
4
  class Retrieve < APIResource
5
5
  def self.person(person_id:, pretty: false)
6
- # TODO: possibly add gzip encoding
7
- # headers = { 'Accept-Encoding' => 'gzip' }
8
- get(path: "/v5/person/retrieve/#{person_id}", params: { 'pretty' => pretty })
6
+ headers = {
7
+ 'Accept-Encoding' => 'gzip',
8
+ 'User-Agent' => 'PDL-RUBY-SDK',
9
+ }
10
+ get(path: "/v5/person/retrieve/#{person_id}", headers: headers, params: { 'pretty' => pretty })
9
11
  end
10
12
  end
11
13
  end
@@ -33,9 +33,11 @@ module Peopledatalabs
33
33
  'scroll_token' => scroll_token
34
34
  }
35
35
 
36
- # TODO: possibly add gzip encoding
37
- # headers = { 'Accept-Encoding' => 'gzip' }
38
- post(path: "/v5/#{kind}/search", body: body)
36
+ headers = {
37
+ 'Accept-Encoding' => 'gzip',
38
+ 'User-Agent' => 'PDL-RUBY-SDK',
39
+ }
40
+ post(path: "/v5/#{kind}/search", headers: headers, body: body)
39
41
  end
40
42
  end
41
43
  end
@@ -1,3 +1,3 @@
1
1
  module Peopledatalabs
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -13,9 +13,10 @@ require 'peopledatalabs/resources/bulk'
13
13
 
14
14
 
15
15
  # gem build peopledatalabs.gemspec
16
- # gem install ./peopledatalabs-1.0.0.gem
16
+ # gem install ./peopledatalabs-1.0.4.gem
17
17
  # irb
18
18
  # require 'peopledatalabs'
19
+ # rake spec PDL_API_KEY=API_KEY
19
20
 
20
21
  # Usage
21
22
  # First set api key
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.1
4
+ version: 1.0.4
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-05-14 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler