apihub-baller 0.0.3 → 0.0.4

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: e9cec884f74416e8cf29a5af40494cfa1e0da330
4
- data.tar.gz: c6d8822460ffd0f6242e8e9be9052d303e9ab060
3
+ metadata.gz: b80fb7cfa6a464a65def7aa0e278b337cda6d5df
4
+ data.tar.gz: 13becedcd35f4409ba0a233f71a435713bd6898c
5
5
  SHA512:
6
- metadata.gz: 0ac19a439cfdfae485368ce4be27ee11f86b558ea5e9f68a63acf857e3a3fd8c8bf7b6875e97583fc3c193af1e3518f56dd8656df873a086b6de2bd05d696655
7
- data.tar.gz: 3a8da8efbf931b40bde5f17f14a9fff1680e2960ad98e5b55474dc5c1b96d3683b379f16ec002e9fd53861e6e7921d9f64f8e8284baa72d99e36604bf5ca85b8
6
+ metadata.gz: 2231469c2e92f8b15e455bbb2f879e3e53ce1ee100bca4f31fbeac843909730484c561859f6d0a7fae4e8d7229e2178869f7de5bd867b10116e8275748a79d12
7
+ data.tar.gz: b0e3e193824178138f715f50ae5343bde21096155e43c58751b1091bf585b807c2c6434366d9d604237f23d7c54c4183de7117e1b3f8b74699ee17b0525276d7
data/README.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Baller
2
2
 
3
+ This library calculates a 'baller' score, a simple score which gives you some indication that an email address is either associated with an influential individual, or a high profile company.
4
+
5
+ This score is especially useful for sales and marketing. For example, you could calculate scores for all your inbound sales inquires and also for existing customers, providing a good signal for valuable leads.
6
+
7
+ Behind the scenes, this library uses [APIHub](https://apihub.co), a data API which returns information on email addresses and company domain names. That information is then [used to calculate](https://github.com/maccman/apihub-baller/blob/master/lib/apihub/baller.rb#L53) a (fairly rudimentary) score taking into account such things as how many Twitter followers the person has, or if how much the company has raised, how many employees it has, etc.
8
+
9
+ Scores are out of `1.0`, where `1.0` is the highest and `0.0` the lowest (we didn't find any information).
10
+
11
+ ## Getting started
12
+
13
+ Firstly you'll need an [APIHub](https://apihub.co) API key - register there and save your key. APIHub provides 50 free lookups a month.
14
+
15
+ Then install the gem, `apihub-baller`. A CLI is provided for simple email lookups.
16
+
3
17
  gem install apihub-baller
4
18
 
5
19
  $ apihub-baller
@@ -8,4 +22,42 @@
8
22
  -h, --help Display this screen
9
23
 
10
24
 
11
- apihub-baller --api-key APIHUB_KEY alex@alexmaccaw.com
25
+ apihub-baller --api-key APIHUB_KEY alex@alexmaccaw.com
26
+
27
+ There's also a Ruby API.
28
+
29
+ APIHub::Baller.api_key = ENV['APIHUB_KEY']
30
+
31
+ result = APIHub::Baller.lookup(email)
32
+
33
+ if result
34
+ puts "Name: #{result.name}"
35
+ puts "Company name: #{result.company.try(:name)}"
36
+
37
+ if result.score > 0.5
38
+ puts "Baller"
39
+ end
40
+
41
+ else
42
+ puts "Person or company not found"
43
+ end
44
+
45
+
46
+ ## Method: `lookup(email, options)`
47
+
48
+ As well as just passing an email, there are a number of additional options you can send to `APIHub::Baller.lookup`, such as the weights that are used internally. You could also just use the information returned to calculate your own score.
49
+
50
+ The default options are:
51
+
52
+ {
53
+ twitter_followers_weight: 0.05,
54
+ angellist_followers_weight: 0.05,
55
+ klout_score_weight: 0.05,
56
+ company_twitter_followers_weight: 0.05,
57
+ company_alexa_rank_weight: 0.000005,
58
+ company_google_rank_weight: 0.05,
59
+ company_employees_weight: 0.5,
60
+ company_raised_weight: 0.0000005,
61
+ company_score: 10,
62
+ total_score: 1415
63
+ }
@@ -17,7 +17,8 @@ module APIHub
17
17
  company_google_rank_weight: 0.05,
18
18
  company_employees_weight: 0.5,
19
19
  company_raised_weight: 0.0000005,
20
- company_score: 10
20
+ company_score: 10,
21
+ total_score: 1415
21
22
  })
22
23
 
23
24
  def api_key=(value)
@@ -31,9 +32,13 @@ module APIHub
31
32
  end
32
33
 
33
34
  def lookup(email)
34
- suffix, domain = email.split('@', 2)
35
+ if email =~ /.+@.+/
36
+ person = Streaming::Person[email: email]
37
+ suffix, domain = email.split('@', 2)
35
38
 
36
- person = Streaming::Person[email: email]
39
+ else
40
+ domain = email
41
+ end
37
42
 
38
43
  unless EmailProviders::DOMAINS.include?(domain)
39
44
  company = Streaming::Company[domain: domain]
@@ -66,7 +71,7 @@ module APIHub
66
71
  score += result.angellist.followers * options.angellist_followers_weight
67
72
  end
68
73
 
69
- if result.klout
74
+ if result.klout && result.klout.score
70
75
  score += result.klout.score * options.klout_score_weight
71
76
  end
72
77
 
@@ -90,7 +95,7 @@ module APIHub
90
95
  options.company_alexa_rank_weight)
91
96
  end
92
97
 
93
- if company.google && company.google.rank
98
+ if company.google && company.google.rank && company.google.rank > 0
94
99
  score += 1 / (company.google.rank *
95
100
  options.company_google_rank_weight)
96
101
  end
@@ -101,7 +106,9 @@ module APIHub
101
106
  end
102
107
  end
103
108
 
104
- score.round
109
+ score /= options.total_score
110
+
111
+ [score.round(1), 1.0].min
105
112
  end
106
113
  end
107
114
  end
@@ -1,5 +1,5 @@
1
1
  module APIHub
2
2
  module Baller
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: apihub-baller
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-07-16 00:00:00.000000000 Z
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler