clearbit-leadscore 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 927c0b5f1cceb222b03c85dc278dbd426e024359
4
- data.tar.gz: 1acb33a1a8869473fab7c8fc2433e5a9382d8cf1
3
+ metadata.gz: ec42dc2ff6cfa06f91c2e9021115abeb29c4f7a8
4
+ data.tar.gz: eac4f3d36dd26939c467214a8114f23041e5a44c
5
5
  SHA512:
6
- metadata.gz: 8b338a91d8ba71a0bf3a4fce7f83b106aea48ddcf43ec62a0e8c89eab5f70bfb246a12a00a3da24eb16e43c0b4c47c27a54273b41c45aa9cddcd37bfe4a95b73
7
- data.tar.gz: 498a75adaba7b9eb8ac0b3066ae892c2fb522085643a243c8006bbf052d226e5af5798a320d5d33463d964ec3805f8ddee2eb2e7a2d70640c66820b3cca6f859
6
+ metadata.gz: 24323de117a402e9b9efaa5e9a846a457ff96974d415938f8a397a95d87b0669ec7638c80027f8e093892581555eff52929e896c40dc1655cf67c365779a8dae
7
+ data.tar.gz: c5639f214474539d5c08dffb8aacf2249174d020b09be82cda4e31988d6fddab78612ff97fe7747303dd96f7dcfa7c2ff2e924c70420bdd61c8993c22c941143
data/README.md CHANGED
@@ -26,12 +26,12 @@ Then install the gem, `clearbit-leadscore`. A CLI is provided for simple email l
26
26
 
27
27
  There's also a Ruby API.
28
28
 
29
- Clearbit::LeadScore.api_key = ENV['CLEARBIT_KEY']
29
+ Clearbit::LeadScore.key = ENV['CLEARBIT_KEY']
30
30
 
31
31
  result = Clearbit::LeadScore.lookup(email)
32
32
 
33
33
  if result
34
- puts "Name: #{result.name}"
34
+ puts "Name: #{result.person.try(:name)}"
35
35
  puts "Company name: #{result.company.try(:name)}"
36
36
 
37
37
  if result.score > 0.5
@@ -13,15 +13,23 @@ module Clearbit
13
13
  Clearbit.key = value
14
14
  end
15
15
 
16
- def baller?(email, options = {})
17
- threshold = options[:threshold] || 20
16
+ def baller?(email, threshold = 0.7)
17
+ score(email) > threshold
18
+ end
18
19
 
19
- lookup(options).score > threshold
20
+ def score(email)
21
+ result = lookup(email)
22
+ result && result.score || 0
20
23
  end
21
24
 
22
25
  def lookup(email)
23
26
  if email =~ /.+@.+/
24
- person = Streaming::Person[email: email]
27
+ person = Streaming::Person[email: email]
28
+
29
+ if person && person.company && person.company != {}
30
+ company = person.company
31
+ end
32
+
25
33
  suffix, domain = email.split('@', 2)
26
34
 
27
35
  else
@@ -29,7 +37,7 @@ module Clearbit
29
37
  end
30
38
 
31
39
  unless EmailProviders::DOMAINS.include?(domain)
32
- company = Streaming::Company[domain: domain]
40
+ company ||= Streaming::Company[domain: domain]
33
41
  end
34
42
 
35
43
  return unless person || company
@@ -39,9 +47,14 @@ module Clearbit
39
47
  company: company
40
48
  )
41
49
 
42
- result.merge!(
43
- score: Score.calculate(result)
44
- )
50
+ begin
51
+ result.merge!(
52
+ score: Score.calculate(result)
53
+ )
54
+ rescue => e
55
+ p result
56
+ raise e
57
+ end
45
58
 
46
59
  result
47
60
  end
@@ -4,14 +4,14 @@ module Clearbit
4
4
  attr_accessor :defaults
5
5
 
6
6
  self.defaults = Mash.new({
7
- twitter_followers_weight: 0.05,
7
+ twitter_followers_weight: 0.09,
8
8
  angellist_followers_weight: 0.05,
9
9
  klout_score_weight: 0.05,
10
10
  company_twitter_followers_weight: 0.05,
11
11
  company_alexa_rank_weight: 0.000005,
12
12
  company_google_rank_weight: 0.05,
13
13
  company_employees_weight: 0.5,
14
- company_raised_weight: 0.0000005,
14
+ company_raised_weight: 0.00005,
15
15
  company_score: 10,
16
16
  total_score: 1415
17
17
  })
@@ -1,5 +1,5 @@
1
1
  module Clearbit
2
2
  module LeadScore
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearbit-leadscore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-31 00:00:00.000000000 Z
11
+ date: 2014-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler