clearbit 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: c1cbcaad8e2ee14c22b25ed8f50604323650f1a1
4
- data.tar.gz: 5ac8cee9d7485cfd251821175008da4da0ec88c1
3
+ metadata.gz: c3a2354c79883906685ecf66b6463ac6f4428a4b
4
+ data.tar.gz: d8d7628bf6af5249ad1c2621ca04ce4013db9b16
5
5
  SHA512:
6
- metadata.gz: e1510ceb002969ef533fe8c0722a0d966f53159e7c6ffd1244b8061973186b7391f1cb55fb2fe2f45111e391febbbc6cdbd0ae0ac91554219f65123f2027e0ba
7
- data.tar.gz: f110fd6a47ede030d80fefedefa9b84627775f3b10154f91ec33ad23f58451a8b41cb3ee120b537de164aa94145082af9e0a5593b53953c43ab2320bc987dead
6
+ metadata.gz: 1cf08a980d1d61f6023f6c2f375a69261a846c76614dd833cdca682fcfb827b251899c1d756ebda4feedc795d8efa4476abceb88638ff4e0758f2d539d790200
7
+ data.tar.gz: cef6937381031235a98a5f8272cfb8625c9399ed2e4eb81b66ca1b0aff7ca1cc6d40149674c244cb535974176362eacbbea982316bb4a1123a17cd6ea3957e95
@@ -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')
@@ -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
 
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Clearbit
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -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.0
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-14 00:00:00.000000000 Z
11
+ date: 2015-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler