clearbit 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +71 -0
- data/Rakefile +1 -0
- data/apihub.gemspec +24 -0
- data/bin/clearbit +69 -0
- data/examples/email.rb +6 -0
- data/lib/clearbit.rb +23 -0
- data/lib/clearbit/base.rb +6 -0
- data/lib/clearbit/company.rb +37 -0
- data/lib/clearbit/mash.rb +180 -0
- data/lib/clearbit/person.rb +43 -0
- data/lib/clearbit/resource.rb +66 -0
- data/lib/clearbit/streaming.rb +6 -0
- data/lib/clearbit/streaming/company.rb +7 -0
- data/lib/clearbit/streaming/person.rb +7 -0
- data/lib/clearbit/version.rb +3 -0
- data/lib/clearbit/watchlist.rb +28 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5b0cfa609b6d8cb8a20bcfb8341eb972e1413723
|
4
|
+
data.tar.gz: 4c1389dca0b4b2e69173395dde00ef620e0afdeb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b2053d03b6e1211e0a801bbfa0b58df2ec52ca6dbe72f71e4f4bb83bad352e45d93698c61b9e2768094d84b2a2f53895b2afdc442f5815fad45fb24e8467079a
|
7
|
+
data.tar.gz: e3b24f8fe720f16fc523104f323bef21f60403568427e601d35e3ebdb914df987e010ea45ea3c426d2e537e715354b14c85eac6dd426c5d7d823f0d9e91b458e
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Alex MacCaw
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Clearbit
|
2
|
+
|
3
|
+
A Ruby API client to [https://clearbit.co](https://clearbit.co).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'clearbit'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install clearbit
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
First authorize requests by setting the API key found on your [account's settings page](https://clearbit.co/profile).
|
22
|
+
|
23
|
+
Clearbit.api_key = ENV['APIHUB_KEY']
|
24
|
+
|
25
|
+
Then you can lookup people by email address:
|
26
|
+
|
27
|
+
person = Clearbit::Person[email: 'info@eribium.org']
|
28
|
+
|
29
|
+
If the person can't be found, then `nil` will be returned.
|
30
|
+
|
31
|
+
See the [documentation](https://clearbit.co/docs/person) for more information.
|
32
|
+
|
33
|
+
## Company lookup
|
34
|
+
|
35
|
+
You can lookup company data by domain name:
|
36
|
+
|
37
|
+
company = Clearbit::Company[domain: 'uber.com']
|
38
|
+
|
39
|
+
If the company can't be found, then `nil` will be returned.
|
40
|
+
|
41
|
+
See the [documentation](https://clearbit.co/docs/company) for more information.
|
42
|
+
|
43
|
+
## CLI
|
44
|
+
|
45
|
+
The gem also includes a `clearbit` executable, which you can use like this:
|
46
|
+
|
47
|
+
$ clearbit person --email info@eribium.org
|
48
|
+
|
49
|
+
{
|
50
|
+
"name": {
|
51
|
+
"fullName": "Alex MacCaw",
|
52
|
+
"givenName": "Alex",
|
53
|
+
"familyName": "MacCaw"
|
54
|
+
},
|
55
|
+
...
|
56
|
+
|
57
|
+
Or to look up a company:
|
58
|
+
|
59
|
+
$ clearbit company --domain uber.com
|
60
|
+
|
61
|
+
{
|
62
|
+
"name": "Uber",
|
63
|
+
"legalName": "Uber, Inc.",
|
64
|
+
"categories": [
|
65
|
+
"Transport"
|
66
|
+
],
|
67
|
+
"founders": [
|
68
|
+
"Travis Kalanick",
|
69
|
+
"Garrett Camp"
|
70
|
+
],
|
71
|
+
...
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/apihub.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'clearbit/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "clearbit"
|
8
|
+
spec.version = Clearbit::VERSION
|
9
|
+
spec.authors = ["Alex MacCaw"]
|
10
|
+
spec.email = ["alex@clearbit.co"]
|
11
|
+
spec.description = %q{API client for clearbit.co}
|
12
|
+
spec.summary = %q{API client for clearbit.co}
|
13
|
+
spec.homepage = "https://github.com/maccman/clearbit-ruby"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_dependency 'nestful', '~> 1.0.7'
|
24
|
+
end
|
data/bin/clearbit
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'clearbit'
|
4
|
+
require 'json'
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'awesome_print'
|
9
|
+
rescue LoadError
|
10
|
+
def ap(value)
|
11
|
+
puts JSON.pretty_generate(value)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
options = {}
|
16
|
+
values = {}
|
17
|
+
|
18
|
+
parser = OptionParser.new do |opts|
|
19
|
+
opts.banner = "Usage: clearbit [person|company] [options]"
|
20
|
+
|
21
|
+
opts.on("--email EMAIL", String, "Email") do |v|
|
22
|
+
values[:email] = v
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on("--domain DOMAIN", String, "Domain") do |v|
|
26
|
+
values[:domain] = v
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on("--api-key KEY", String, "Clearbit") do |v|
|
30
|
+
options[:api_key] = v
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
parser.parse!
|
35
|
+
|
36
|
+
case ARGV[0]
|
37
|
+
when 'person'
|
38
|
+
entity = Clearbit::Streaming::Person
|
39
|
+
when 'company'
|
40
|
+
entity = Clearbit::Streaming::Company
|
41
|
+
else
|
42
|
+
puts parser
|
43
|
+
exit
|
44
|
+
end
|
45
|
+
|
46
|
+
if values == {}
|
47
|
+
puts parser
|
48
|
+
exit
|
49
|
+
end
|
50
|
+
|
51
|
+
if key = ENV['APIHUB_KEY']
|
52
|
+
options[:api_key] ||= key
|
53
|
+
end
|
54
|
+
|
55
|
+
if key = options.delete(:api_key)
|
56
|
+
Clearbit.api_key = key
|
57
|
+
else
|
58
|
+
puts 'API Key required'
|
59
|
+
puts parser
|
60
|
+
exit
|
61
|
+
end
|
62
|
+
|
63
|
+
object = entity.find(values, options)
|
64
|
+
|
65
|
+
if object
|
66
|
+
ap object.to_hash
|
67
|
+
else
|
68
|
+
puts 'Not found'
|
69
|
+
end
|
data/examples/email.rb
ADDED
data/lib/clearbit.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'nestful'
|
2
|
+
require 'clearbit/version'
|
3
|
+
|
4
|
+
module Clearbit
|
5
|
+
def self.api_key=(value)
|
6
|
+
Base.options Base.options.merge(
|
7
|
+
auth_type: :bearer,
|
8
|
+
password: value
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.key=(value)
|
13
|
+
self.api_key = value
|
14
|
+
end
|
15
|
+
|
16
|
+
autoload :Base, 'clearbit/base'
|
17
|
+
autoload :Company, 'clearbit/company'
|
18
|
+
autoload :Mash, 'clearbit/mash'
|
19
|
+
autoload :Person, 'clearbit/person'
|
20
|
+
autoload :Resource, 'clearbit/resource'
|
21
|
+
autoload :Streaming, 'clearbit/streaming'
|
22
|
+
autoload :Watchlist, 'clearbit/watchlist'
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Clearbit
|
2
|
+
class Company < Base
|
3
|
+
endpoint 'https://company.clearbit.co'
|
4
|
+
path '/v1/companies'
|
5
|
+
|
6
|
+
def self.find(values, options = {})
|
7
|
+
unless values.is_a?(Hash)
|
8
|
+
values = {:id => values}
|
9
|
+
end
|
10
|
+
|
11
|
+
options = options.dup
|
12
|
+
params = options.delete(:params) || {}
|
13
|
+
|
14
|
+
if domain = values[:domain]
|
15
|
+
response = get(uri(:domain, domain), params, options)
|
16
|
+
|
17
|
+
elsif id = values[:id]
|
18
|
+
response = get(id, params, options)
|
19
|
+
|
20
|
+
else
|
21
|
+
raise ArgumentError, 'Invalid values'
|
22
|
+
end
|
23
|
+
|
24
|
+
if response.status == 202
|
25
|
+
self.new(pending: true)
|
26
|
+
else
|
27
|
+
self.new(response)
|
28
|
+
end
|
29
|
+
|
30
|
+
rescue Nestful::ResourceNotFound
|
31
|
+
end
|
32
|
+
|
33
|
+
class << self
|
34
|
+
alias_method :[], :find
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
module Clearbit
|
2
|
+
class Mash < Hash
|
3
|
+
def self.new(value = nil, *args)
|
4
|
+
if value.respond_to?(:each) &&
|
5
|
+
!value.respond_to?(:each_pair)
|
6
|
+
value.map {|v| super(v) }
|
7
|
+
else
|
8
|
+
super
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
alias_method :to_s, :inspect
|
13
|
+
|
14
|
+
def initialize(source_hash = nil, default = nil, &blk)
|
15
|
+
deep_update(source_hash.to_hash) if source_hash
|
16
|
+
default ? super(default) : super(&blk)
|
17
|
+
end
|
18
|
+
|
19
|
+
class << self; alias [] new; end
|
20
|
+
|
21
|
+
def id #:nodoc:
|
22
|
+
self['id']
|
23
|
+
end
|
24
|
+
|
25
|
+
def type #:nodoc:
|
26
|
+
self['type']
|
27
|
+
end
|
28
|
+
|
29
|
+
alias_method :regular_reader, :[]
|
30
|
+
alias_method :regular_writer, :[]=
|
31
|
+
|
32
|
+
# Retrieves an attribute set in the Mash. Will convert
|
33
|
+
# any key passed in to a string before retrieving.
|
34
|
+
def custom_reader(key)
|
35
|
+
value = regular_reader(convert_key(key))
|
36
|
+
yield value if block_given?
|
37
|
+
value
|
38
|
+
end
|
39
|
+
|
40
|
+
# Sets an attribute in the Mash. Key will be converted to
|
41
|
+
# a string before it is set, and Hashes will be converted
|
42
|
+
# into Mashes for nesting purposes.
|
43
|
+
def custom_writer(key,value) #:nodoc:
|
44
|
+
regular_writer(convert_key(key), convert_value(value))
|
45
|
+
end
|
46
|
+
|
47
|
+
alias_method :[], :custom_reader
|
48
|
+
alias_method :[]=, :custom_writer
|
49
|
+
|
50
|
+
# This is the bang method reader, it will return a new Mash
|
51
|
+
# if there isn't a value already assigned to the key requested.
|
52
|
+
def initializing_reader(key)
|
53
|
+
ck = convert_key(key)
|
54
|
+
regular_writer(ck, self.class.new) unless key?(ck)
|
55
|
+
regular_reader(ck)
|
56
|
+
end
|
57
|
+
|
58
|
+
# This is the under bang method reader, it will return a temporary new Mash
|
59
|
+
# if there isn't a value already assigned to the key requested.
|
60
|
+
def underbang_reader(key)
|
61
|
+
ck = convert_key(key)
|
62
|
+
if key?(ck)
|
63
|
+
regular_reader(ck)
|
64
|
+
else
|
65
|
+
self.class.new
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def fetch(key, *args)
|
70
|
+
super(convert_key(key), *args)
|
71
|
+
end
|
72
|
+
|
73
|
+
def delete(key)
|
74
|
+
super(convert_key(key))
|
75
|
+
end
|
76
|
+
|
77
|
+
alias_method :regular_dup, :dup
|
78
|
+
# Duplicates the current mash as a new mash.
|
79
|
+
def dup
|
80
|
+
self.class.new(self, self.default)
|
81
|
+
end
|
82
|
+
|
83
|
+
def key?(key)
|
84
|
+
super(convert_key(key))
|
85
|
+
end
|
86
|
+
alias_method :has_key?, :key?
|
87
|
+
alias_method :include?, :key?
|
88
|
+
alias_method :member?, :key?
|
89
|
+
|
90
|
+
# Performs a deep_update on a duplicate of the
|
91
|
+
# current mash.
|
92
|
+
def deep_merge(other_hash, &blk)
|
93
|
+
dup.deep_update(other_hash, &blk)
|
94
|
+
end
|
95
|
+
alias_method :merge, :deep_merge
|
96
|
+
|
97
|
+
# Recursively merges this mash with the passed
|
98
|
+
# in hash, merging each hash in the hierarchy.
|
99
|
+
def deep_update(other_hash, &blk)
|
100
|
+
other_hash.each_pair do |k,v|
|
101
|
+
key = convert_key(k)
|
102
|
+
if regular_reader(key).is_a?(Mash) and v.is_a?(::Hash)
|
103
|
+
custom_reader(key).deep_update(v, &blk)
|
104
|
+
else
|
105
|
+
value = convert_value(v, true)
|
106
|
+
value = blk.call(key, self[k], value) if blk
|
107
|
+
custom_writer(key, value)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
self
|
111
|
+
end
|
112
|
+
alias_method :deep_merge!, :deep_update
|
113
|
+
alias_method :update, :deep_update
|
114
|
+
alias_method :merge!, :update
|
115
|
+
|
116
|
+
# Performs a shallow_update on a duplicate of the current mash
|
117
|
+
def shallow_merge(other_hash)
|
118
|
+
dup.shallow_update(other_hash)
|
119
|
+
end
|
120
|
+
|
121
|
+
# Merges (non-recursively) the hash from the argument,
|
122
|
+
# changing the receiving hash
|
123
|
+
def shallow_update(other_hash)
|
124
|
+
other_hash.each_pair do |k,v|
|
125
|
+
regular_writer(convert_key(k), convert_value(v, true))
|
126
|
+
end
|
127
|
+
self
|
128
|
+
end
|
129
|
+
|
130
|
+
def replace(other_hash)
|
131
|
+
(keys - other_hash.keys).each { |key| delete(key) }
|
132
|
+
other_hash.each { |key, value| self[key] = value }
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Will return true if the Mash has had a key
|
137
|
+
# set in addition to normal respond_to? functionality.
|
138
|
+
def respond_to?(method_name, include_private=false)
|
139
|
+
return true if key?(method_name) || method_name.to_s.slice(/[=?!_]\Z/)
|
140
|
+
super
|
141
|
+
end
|
142
|
+
|
143
|
+
def method_missing(method_name, *args, &blk)
|
144
|
+
return self.[](method_name, &blk) if key?(method_name)
|
145
|
+
match = method_name.to_s.match(/(.*?)([?=!_]?)$/)
|
146
|
+
case match[2]
|
147
|
+
when "="
|
148
|
+
self[match[1]] = args.first
|
149
|
+
when "?"
|
150
|
+
!!self[match[1]]
|
151
|
+
when "!"
|
152
|
+
initializing_reader(match[1])
|
153
|
+
when "_"
|
154
|
+
underbang_reader(match[1])
|
155
|
+
else
|
156
|
+
default(method_name, *args, &blk)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
protected
|
161
|
+
|
162
|
+
def convert_key(key) #:nodoc:
|
163
|
+
key.to_s
|
164
|
+
end
|
165
|
+
|
166
|
+
def convert_value(val, duping=false) #:nodoc:
|
167
|
+
case val
|
168
|
+
when self.class
|
169
|
+
val.dup
|
170
|
+
when ::Hash
|
171
|
+
val = val.dup if duping
|
172
|
+
Mash.new(val)
|
173
|
+
when ::Array
|
174
|
+
val.map {|e| convert_value(e) }
|
175
|
+
else
|
176
|
+
val
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Clearbit
|
2
|
+
class Person < Base
|
3
|
+
endpoint 'https://person.clearbit.co'
|
4
|
+
path '/v1/people'
|
5
|
+
|
6
|
+
def self.find(values, options = {})
|
7
|
+
unless values.is_a?(Hash)
|
8
|
+
values = {:id => values}
|
9
|
+
end
|
10
|
+
|
11
|
+
options = options.dup
|
12
|
+
params = options.delete(:params) || {}
|
13
|
+
|
14
|
+
if email = values[:email]
|
15
|
+
response = get(uri(:email, email), params, options)
|
16
|
+
|
17
|
+
elsif twitter = values[:twitter]
|
18
|
+
response = get(uri(:twitter, twitter), params, options)
|
19
|
+
|
20
|
+
elsif github = values[:github]
|
21
|
+
response = get(uri(:github, github), params, options)
|
22
|
+
|
23
|
+
elsif id = values[:id]
|
24
|
+
response = get(id, params, options)
|
25
|
+
|
26
|
+
else
|
27
|
+
raise ArgumentError, 'Invalid values'
|
28
|
+
end
|
29
|
+
|
30
|
+
if response.status == 202
|
31
|
+
self.new(pending: true)
|
32
|
+
else
|
33
|
+
self.new(response)
|
34
|
+
end
|
35
|
+
|
36
|
+
rescue Nestful::ResourceNotFound
|
37
|
+
end
|
38
|
+
|
39
|
+
class << self
|
40
|
+
alias_method :[], :find
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Clearbit
|
4
|
+
class Resource < Mash
|
5
|
+
def self.endpoint(value = nil)
|
6
|
+
@endpoint = value if value
|
7
|
+
return @endpoint if @endpoint
|
8
|
+
superclass.respond_to?(:endpoint) ? superclass.endpoint : nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.path(value = nil)
|
12
|
+
@path = value if value
|
13
|
+
return @path if @path
|
14
|
+
superclass.respond_to?(:path) ? superclass.path : nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.options(value = nil)
|
18
|
+
@options = value if value
|
19
|
+
return @options if @options
|
20
|
+
superclass.respond_to?(:options) ? superclass.options : {}
|
21
|
+
end
|
22
|
+
|
23
|
+
class << self
|
24
|
+
alias_method :endpoint=, :endpoint
|
25
|
+
alias_method :path=, :path
|
26
|
+
alias_method :options=, :options
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.url
|
30
|
+
URI.join(endpoint.to_s, path.to_s).to_s
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.uri(*parts)
|
34
|
+
# If an absolute URI already
|
35
|
+
if (uri = parts.first) && uri.is_a?(URI)
|
36
|
+
return uri if uri.host
|
37
|
+
end
|
38
|
+
|
39
|
+
URI.parse(Nestful::Helpers.to_path(url, *parts))
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.get(action = '', params = {}, options = {})
|
43
|
+
request(uri(action), options.merge(method: :get, params: params))
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.put(action = '', params = {}, options = {})
|
47
|
+
request(uri(action), options.merge(method: :put, params: params))
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.post(action = '', params = {}, options = {})
|
51
|
+
request(uri(action), options.merge(method: :post, params: params))
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.delete(action = '', params = {}, options = {})
|
55
|
+
request(uri(action), options.merge(method: :delete, params: params))
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.request(url, options = {})
|
59
|
+
options = Nestful::Helpers.deep_merge(self.options, options)
|
60
|
+
|
61
|
+
self.new Nestful::Request.new(
|
62
|
+
url, options
|
63
|
+
).execute
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Clearbit
|
2
|
+
class Watchlist < Base
|
3
|
+
endpoint 'https://watchlist.clearbit.co'
|
4
|
+
path '/v1/search/all'
|
5
|
+
|
6
|
+
def self.search(name, options = {})
|
7
|
+
options = options.dup
|
8
|
+
params = options.delete(:params) || {}
|
9
|
+
|
10
|
+
params = {
|
11
|
+
name: name,
|
12
|
+
threshold: options.delete(:threshold) || 1.0
|
13
|
+
}.merge(params)
|
14
|
+
|
15
|
+
response = post('', params, options)
|
16
|
+
|
17
|
+
self.new(response)
|
18
|
+
end
|
19
|
+
|
20
|
+
class Individual < Watchlist
|
21
|
+
path '/v1/search/individuals'
|
22
|
+
end
|
23
|
+
|
24
|
+
class Entity < Watchlist
|
25
|
+
path '/v1/search/entities'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: clearbit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alex MacCaw
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nestful
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.7
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.7
|
55
|
+
description: API client for clearbit.co
|
56
|
+
email:
|
57
|
+
- alex@clearbit.co
|
58
|
+
executables:
|
59
|
+
- clearbit
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- apihub.gemspec
|
69
|
+
- bin/clearbit
|
70
|
+
- examples/email.rb
|
71
|
+
- lib/clearbit.rb
|
72
|
+
- lib/clearbit/base.rb
|
73
|
+
- lib/clearbit/company.rb
|
74
|
+
- lib/clearbit/mash.rb
|
75
|
+
- lib/clearbit/person.rb
|
76
|
+
- lib/clearbit/resource.rb
|
77
|
+
- lib/clearbit/streaming.rb
|
78
|
+
- lib/clearbit/streaming/company.rb
|
79
|
+
- lib/clearbit/streaming/person.rb
|
80
|
+
- lib/clearbit/version.rb
|
81
|
+
- lib/clearbit/watchlist.rb
|
82
|
+
homepage: https://github.com/maccman/clearbit-ruby
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.2.2
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: API client for clearbit.co
|
106
|
+
test_files: []
|