clearbit 0.1.4 → 0.1.5
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/README.md +12 -4
- data/apihub.gemspec +1 -0
- data/examples/person_company.rb +1 -1
- data/examples/version.rb +6 -0
- data/lib/clearbit.rb +3 -6
- data/lib/clearbit/base.rb +9 -0
- data/lib/clearbit/company.rb +1 -1
- data/lib/clearbit/mash.rb +9 -14
- data/lib/clearbit/person.rb +1 -1
- data/lib/clearbit/person_company.rb +1 -1
- data/lib/clearbit/resource.rb +10 -4
- data/lib/clearbit/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94181dcf96160372ef82dd215b4696aba62d39fb
|
4
|
+
data.tar.gz: a8752294bc5b63fe7d3a055c94429467131c9288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7085df982027dc0af97c63e483457c7f9e5287d9f580bee1108a9b2b13d999db394e31941ee0e44ecefb1f8ecdcad00066573db17728a01d645eef95d925d09
|
7
|
+
data.tar.gz: 8b3e2cd83dabd56cf74294cbda5f2c9d46206f0774caecd7606ce048e9c175bc6e1dbc2c90266b4e92ebff27a11bd311462af8edf95ce9f4f4100366a4dba0f4
|
data/README.md
CHANGED
@@ -6,7 +6,9 @@ A Ruby API client to [https://clearbit.com](https://clearbit.com).
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
|
9
|
+
``` ruby
|
10
|
+
gem 'clearbit'
|
11
|
+
```
|
10
12
|
|
11
13
|
And then execute:
|
12
14
|
|
@@ -20,11 +22,15 @@ Or install it yourself as:
|
|
20
22
|
|
21
23
|
First authorize requests by setting the API key found on your [account's settings page](https://clearbit.com/keys).
|
22
24
|
|
23
|
-
|
25
|
+
``` ruby
|
26
|
+
Clearbit.key = ENV['CLEARBIT_KEY']
|
27
|
+
```
|
24
28
|
|
25
29
|
Then you can lookup people by email address:
|
26
30
|
|
27
|
-
|
31
|
+
``` ruby
|
32
|
+
person = Clearbit::Streaming::Person[email: 'alex@alexmaccaw.com']
|
33
|
+
```
|
28
34
|
|
29
35
|
If the person can't be found, then `nil` will be returned.
|
30
36
|
|
@@ -34,7 +40,9 @@ See the [documentation](https://clearbit.com/docs#person-api) for more informati
|
|
34
40
|
|
35
41
|
You can lookup company data by domain name:
|
36
42
|
|
37
|
-
|
43
|
+
``` ruby
|
44
|
+
company = Clearbit::Streaming::Company[domain: 'uber.com']
|
45
|
+
```
|
38
46
|
|
39
47
|
If the company can't be found, then `nil` will be returned.
|
40
48
|
|
data/apihub.gemspec
CHANGED
data/examples/person_company.rb
CHANGED
data/examples/version.rb
ADDED
data/lib/clearbit.rb
CHANGED
@@ -3,14 +3,11 @@ require 'clearbit/version'
|
|
3
3
|
|
4
4
|
module Clearbit
|
5
5
|
def self.api_key=(value)
|
6
|
-
Base.
|
7
|
-
auth_type: :bearer,
|
8
|
-
password: value
|
9
|
-
)
|
6
|
+
Base.key = value
|
10
7
|
end
|
11
8
|
|
12
9
|
def self.key=(value)
|
13
|
-
|
10
|
+
Base.key = value
|
14
11
|
end
|
15
12
|
|
16
13
|
autoload :Base, 'clearbit/base'
|
@@ -25,4 +22,4 @@ module Clearbit
|
|
25
22
|
if clearbit_key = ENV['CLEARBIT_KEY']
|
26
23
|
Clearbit.key = clearbit_key
|
27
24
|
end
|
28
|
-
end
|
25
|
+
end
|
data/lib/clearbit/base.rb
CHANGED
@@ -2,5 +2,14 @@ module Clearbit
|
|
2
2
|
class Base < Resource
|
3
3
|
endpoint 'https://api.clearbit.com'
|
4
4
|
options :format => :json
|
5
|
+
|
6
|
+
def self.version=(value)
|
7
|
+
add_options headers: {'API-Version' => value}
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.key=(value)
|
11
|
+
add_options auth_type: :bearer,
|
12
|
+
password: value
|
13
|
+
end
|
5
14
|
end
|
6
15
|
end
|
data/lib/clearbit/company.rb
CHANGED
data/lib/clearbit/mash.rb
CHANGED
@@ -143,12 +143,10 @@ module Clearbit
|
|
143
143
|
def method_missing(method_name, *args, &blk)
|
144
144
|
return self.[](method_name, &blk) if key?(method_name)
|
145
145
|
|
146
|
-
|
146
|
+
camelized_name = camelize(method_name.to_s)
|
147
147
|
|
148
|
-
if key?(
|
149
|
-
|
150
|
-
Please use underscored properties.'
|
151
|
-
return self.[](underscored_name, &blk)
|
148
|
+
if key?(camelized_name)
|
149
|
+
return self.[](camelized_name, &blk)
|
152
150
|
end
|
153
151
|
|
154
152
|
match = method_name.to_s.match(/(.*?)([?=!_]?)$/)
|
@@ -169,17 +167,14 @@ module Clearbit
|
|
169
167
|
|
170
168
|
protected
|
171
169
|
|
172
|
-
def
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
word.tr!("-", "_")
|
177
|
-
word.downcase!
|
178
|
-
word
|
170
|
+
def camelize(string)
|
171
|
+
string = string.to_s
|
172
|
+
string = string.sub(/^(?:(?=\b|[A-Z_])|\w)/) { $&.downcase }
|
173
|
+
string.gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
|
179
174
|
end
|
180
175
|
|
181
176
|
def convert_key(key) #:nodoc:
|
182
|
-
|
177
|
+
key.to_s
|
183
178
|
end
|
184
179
|
|
185
180
|
def convert_value(val, duping=false) #:nodoc:
|
@@ -196,4 +191,4 @@ module Clearbit
|
|
196
191
|
end
|
197
192
|
end
|
198
193
|
end
|
199
|
-
end
|
194
|
+
end
|
data/lib/clearbit/person.rb
CHANGED
data/lib/clearbit/resource.rb
CHANGED
@@ -15,15 +15,21 @@ module Clearbit
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.options(value = nil)
|
18
|
-
@options
|
19
|
-
|
20
|
-
|
18
|
+
@options ||= {}
|
19
|
+
@options.merge!(value) if value
|
20
|
+
|
21
|
+
if superclass.respond_to?(:options)
|
22
|
+
Nestful::Helpers.deep_merge(superclass.options, @options)
|
23
|
+
else
|
24
|
+
@options
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
28
|
class << self
|
24
29
|
alias_method :endpoint=, :endpoint
|
25
30
|
alias_method :path=, :path
|
26
31
|
alias_method :options=, :options
|
32
|
+
alias_method :add_options, :options
|
27
33
|
end
|
28
34
|
|
29
35
|
def self.url
|
@@ -67,4 +73,4 @@ module Clearbit
|
|
67
73
|
id ? self.class.uri(id, *parts) : self.class.uri(*parts)
|
68
74
|
end
|
69
75
|
end
|
70
|
-
end
|
76
|
+
end
|
data/lib/clearbit/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.5
|
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-
|
11
|
+
date: 2015-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: net-http-spy
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: nestful
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,6 +83,7 @@ files:
|
|
69
83
|
- examples/company.rb
|
70
84
|
- examples/person.rb
|
71
85
|
- examples/person_company.rb
|
86
|
+
- examples/version.rb
|
72
87
|
- examples/watchlist.rb
|
73
88
|
- lib/clearbit.rb
|
74
89
|
- lib/clearbit/base.rb
|