clearbit 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/version.rb +2 -2
- data/lib/clearbit.rb +0 -1
- data/lib/clearbit/resource.rb +12 -2
- data/lib/clearbit/version.rb +1 -1
- data/spec/lib/clearbit/enrichment_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3a2354c79883906685ecf66b6463ac6f4428a4b
|
4
|
+
data.tar.gz: d8d7628bf6af5249ad1c2621ca04ce4013db9b16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cf08a980d1d61f6023f6c2f375a69261a846c76614dd833cdca682fcfb827b251899c1d756ebda4feedc795d8efa4476abceb88638ff4e0758f2d539d790200
|
7
|
+
data.tar.gz: cef6937381031235a98a5f8272cfb8625c9399ed2e4eb81b66ca1b0aff7ca1cc6d40149674c244cb535974176362eacbbea982316bb4a1123a17cd6ea3957e95
|
data/examples/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'clearbit'
|
2
2
|
require 'pp'
|
3
3
|
|
4
|
-
Clearbit::PersonCompany.version = '2015-05-30'
|
4
|
+
Clearbit::Enrichment::PersonCompany.version = '2015-05-30'
|
5
5
|
|
6
|
-
Clearbit::PersonCompany.find(email: 'alex@clearbit.com', webhook_url: 'http://requestb.in/18owk611')
|
6
|
+
p Clearbit::Enrichment::PersonCompany.find(email: 'alex@clearbit.com', webhook_url: 'http://requestb.in/18owk611')
|
data/lib/clearbit.rb
CHANGED
@@ -26,7 +26,6 @@ module Clearbit
|
|
26
26
|
autoload :Pending, 'clearbit/pending'
|
27
27
|
autoload :Prospector, 'clearbit/prospector'
|
28
28
|
autoload :Resource, 'clearbit/resource'
|
29
|
-
autoload :Streaming, 'clearbit/streaming'
|
30
29
|
autoload :Watchlist, 'clearbit/watchlist'
|
31
30
|
autoload :Webhook, 'clearbit/webhook'
|
32
31
|
|
data/lib/clearbit/resource.rb
CHANGED
@@ -50,13 +50,17 @@ module Clearbit
|
|
50
50
|
OPTION_KEYS = %i{
|
51
51
|
params key headers stream
|
52
52
|
proxy user password auth_type
|
53
|
-
timeout ssl_options
|
53
|
+
timeout ssl_options request
|
54
54
|
}
|
55
55
|
|
56
56
|
def self.parse_values(values)
|
57
57
|
params = values.reject {|k,_| OPTION_KEYS.include?(k) }
|
58
58
|
options = values.select {|k,_| OPTION_KEYS.include?(k) }
|
59
59
|
|
60
|
+
if request_options = options.delete(:request)
|
61
|
+
options.merge!(request_options)
|
62
|
+
end
|
63
|
+
|
60
64
|
[params, options]
|
61
65
|
end
|
62
66
|
|
@@ -99,9 +103,15 @@ module Clearbit
|
|
99
103
|
uri.host = uri.host.gsub('.clearbit.com', '-stream.clearbit.com')
|
100
104
|
end
|
101
105
|
|
102
|
-
Nestful::Request.new(
|
106
|
+
response = Nestful::Request.new(
|
103
107
|
uri, options
|
104
108
|
).execute
|
109
|
+
|
110
|
+
if notice = response.headers['X-API-Warn']
|
111
|
+
Kernel.warn notice
|
112
|
+
end
|
113
|
+
|
114
|
+
response
|
105
115
|
end
|
106
116
|
|
107
117
|
def uri(*parts)
|
data/lib/clearbit/version.rb
CHANGED
@@ -32,6 +32,19 @@ describe Clearbit::Enrichment do
|
|
32
32
|
Clearbit::Enrichment.find(email: 'test@example.com', stream: true)
|
33
33
|
end
|
34
34
|
|
35
|
+
it 'accepts request option' do
|
36
|
+
body = {
|
37
|
+
person: nil,
|
38
|
+
company: nil
|
39
|
+
}
|
40
|
+
|
41
|
+
stub_request(:get, "https://person.clearbit.com/v1/combined/email/test@example.com").
|
42
|
+
with(:headers => {'Authorization'=>'Bearer clearbit_key', 'X-Rated' => 'true'}).
|
43
|
+
to_return(:status => 200, :body => body.to_json, headers: {'Content-Type' => 'application/json'})
|
44
|
+
|
45
|
+
Clearbit::Enrichment.find(email: 'test@example.com', request: {headers: {'X-Rated' => 'true'}})
|
46
|
+
end
|
47
|
+
|
35
48
|
it 'returns pending? if 202 response' do
|
36
49
|
body = {
|
37
50
|
person: nil,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clearbit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex MacCaw
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|