outreach 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/outreach/client.rb +2 -4
- data/lib/outreach/prospect.rb +2 -35
- data/lib/outreach/service/prospect.rb +43 -0
- data/lib/outreach/version.rb +1 -1
- data/lib/outreach.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe1c9b5714bb38174c441cb266cd46381aa3110d
|
4
|
+
data.tar.gz: b818c9939969cb205bcb7e86b76c7e7aa76817cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e6766d6f9a6095003e293b30605dc68087c61a47014130aae05aba290f5c949c3c54d39ec00df5771c1cae6dc452046a6f1a627439b8037b36c6cd8f8bdf0d7
|
7
|
+
data.tar.gz: ffae74024011ff42c117d485811f663c31a75f7e8f05041f18b0353dc5f46c8fb782855bbbb97f7ce8d96f690edf1d26de40565b506223ca59ee5b6caefedae6
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ First off you need to grab the authorization key for your user. You do this by g
|
|
39
39
|
|
40
40
|
For example, if using Rails this could be in a view
|
41
41
|
```
|
42
|
-
<%= link_to("Connect to Outreach", Outreach::Authorization.authorization_url)
|
42
|
+
<%= link_to("Connect to Outreach", Outreach::Authorization.authorization_url) %>
|
43
43
|
```
|
44
44
|
|
45
45
|
This will take the user through the oauth process - afterwards they will be redirected back to your site to whatever the url you have setup in Outreach.redirect_uri. This will also provide the authorization key so you can get access for that user using the Outreach::Authorization.create method.
|
@@ -77,13 +77,13 @@ user.save
|
|
77
77
|
## API Client
|
78
78
|
Once you have the access code for a user you can then create an api client for that user.
|
79
79
|
```ruby
|
80
|
-
|
80
|
+
outreach = Outreach::Client.new(user.access_code)
|
81
81
|
```
|
82
82
|
|
83
83
|
## Prospects
|
84
84
|
To find all prospects:
|
85
85
|
```ruby
|
86
|
-
|
86
|
+
outreach.prospects.find_all
|
87
87
|
# returns an array of prospects
|
88
88
|
```
|
89
89
|
|
@@ -94,17 +94,17 @@ Filtering is possible by using the following conditions:
|
|
94
94
|
# email
|
95
95
|
# company_name
|
96
96
|
# e.g.
|
97
|
-
|
97
|
+
outreach.prospects.find_all({ first_name: "Chris", last_name: "O'Sullivan" })
|
98
98
|
```
|
99
99
|
|
100
|
-
The results of
|
100
|
+
The results of outreach.prospects.find_all is paginated. You can control pagination by passing in which page you want to see:
|
101
101
|
```ruby
|
102
|
-
|
102
|
+
outreach.prospects.find_all({ page: 2 })
|
103
103
|
```
|
104
104
|
|
105
105
|
You can find a specific prospect given the prospect id:
|
106
106
|
```ruby
|
107
|
-
|
107
|
+
outreach.prospects.find(2345)
|
108
108
|
```
|
109
109
|
|
110
110
|
## Contributing
|
data/lib/outreach/client.rb
CHANGED
data/lib/outreach/prospect.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Outreach
|
2
2
|
class Prospect
|
3
|
-
attr_accessor :first_name, :last_name, :company, :contact, :tags
|
3
|
+
attr_accessor :first_name, :last_name, :company, :contact, :tags, :id
|
4
4
|
|
5
5
|
def initialize(attrs)
|
6
6
|
@first_name = attrs['attributes']['personal']['name']['first']
|
@@ -8,6 +8,7 @@ module Outreach
|
|
8
8
|
@company = to_ostruct(attrs['attributes']['company'])
|
9
9
|
@contact = to_ostruct(attrs['attributes']['contact'])
|
10
10
|
@tags = attrs['attributes']['metadata']['tags']
|
11
|
+
@id = attrs['id']
|
11
12
|
end
|
12
13
|
|
13
14
|
private
|
@@ -20,39 +21,5 @@ module Outreach
|
|
20
21
|
o
|
21
22
|
end
|
22
23
|
end
|
23
|
-
|
24
|
-
class ProspectFinder
|
25
|
-
API_URL = "https://api.outreach.io/1.0/prospects"
|
26
|
-
|
27
|
-
def initialize(request)
|
28
|
-
@request = request
|
29
|
-
end
|
30
|
-
|
31
|
-
def find(id)
|
32
|
-
response = @request.get("#{API_URL}/#{id}")
|
33
|
-
Prospect.new(response)
|
34
|
-
end
|
35
|
-
|
36
|
-
def all(attrs={})
|
37
|
-
response = @request.get(API_URL, attribute_mapping(attrs))
|
38
|
-
response['data'].map {|attrs| Prospect.new(attrs)}
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def attribute_mapping(attrs)
|
44
|
-
if attrs[:first_name]
|
45
|
-
attrs["filter[personal/name/first]"] = attrs.delete(:first_name)
|
46
|
-
end
|
47
|
-
if attrs[:last_name]
|
48
|
-
attrs["filter[personal/name/last]"] = attrs.delete(:last_name)
|
49
|
-
end
|
50
|
-
attrs["filter[contact/email]"] = attrs.delete(:email) if attrs[:email]
|
51
|
-
if attrs[:company_name]
|
52
|
-
attrs["filter[company/name]"] = attrs.delete(company_name)
|
53
|
-
end
|
54
|
-
attrs
|
55
|
-
end
|
56
|
-
end
|
57
24
|
end
|
58
25
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Outreach
|
2
|
+
module Service
|
3
|
+
class Prospect
|
4
|
+
def initialize(client)
|
5
|
+
@request = client.request
|
6
|
+
end
|
7
|
+
|
8
|
+
def find(id)
|
9
|
+
response = @request.get("#{api_url}/#{id}")
|
10
|
+
collection_class.new(response['data'])
|
11
|
+
end
|
12
|
+
|
13
|
+
def find_all(attrs={})
|
14
|
+
response = @request.get(api_url, attribute_mapping(attrs))
|
15
|
+
response['data'].map {|attrs| collection_class.new(attrs)}
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def api_url
|
21
|
+
"https://api.outreach.io/1.0/prospects"
|
22
|
+
end
|
23
|
+
|
24
|
+
def collection_class
|
25
|
+
Outreach::Prospect
|
26
|
+
end
|
27
|
+
|
28
|
+
def attribute_mapping(attrs)
|
29
|
+
if attrs[:first_name]
|
30
|
+
attrs["filter[personal/name/first]"] = attrs.delete(:first_name)
|
31
|
+
end
|
32
|
+
if attrs[:last_name]
|
33
|
+
attrs["filter[personal/name/last]"] = attrs.delete(:last_name)
|
34
|
+
end
|
35
|
+
attrs["filter[contact/email]"] = attrs.delete(:email) if attrs[:email]
|
36
|
+
if attrs[:company_name]
|
37
|
+
attrs["filter[company/name]"] = attrs.delete(company_name)
|
38
|
+
end
|
39
|
+
attrs
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/outreach/version.rb
CHANGED
data/lib/outreach.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: outreach
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris O'Sullivan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/outreach/errors.rb
|
115
115
|
- lib/outreach/prospect.rb
|
116
116
|
- lib/outreach/request.rb
|
117
|
+
- lib/outreach/service/prospect.rb
|
117
118
|
- lib/outreach/version.rb
|
118
119
|
- outreach.gemspec
|
119
120
|
homepage:
|