outreach-ruby 0.0.2
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 +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.md +2 -0
- data/Rakefile +1 -0
- data/lib/outreach-ruby.rb +23 -0
- data/lib/outreach-ruby/authorization.rb +50 -0
- data/lib/outreach-ruby/client.rb +27 -0
- data/lib/outreach-ruby/errors.rb +33 -0
- data/lib/outreach-ruby/model.rb +17 -0
- data/lib/outreach-ruby/prospect.rb +41 -0
- data/lib/outreach-ruby/request.rb +77 -0
- data/lib/outreach-ruby/sequence.rb +26 -0
- data/lib/outreach-ruby/sequence_state.rb +26 -0
- data/lib/outreach-ruby/service/prospect.rb +70 -0
- data/lib/outreach-ruby/service/sequence.rb +24 -0
- data/lib/outreach-ruby/service/sequence_state.rb +38 -0
- data/lib/outreach-ruby/service/user.rb +24 -0
- data/lib/outreach-ruby/user.rb +36 -0
- data/lib/outreach-ruby/version.rb +3 -0
- data/outreach-ruby.gemspec +30 -0
- metadata +172 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e1e810766e362fa6195a059c7b0199c55a1511f6caeec5416883e97897a9abaa
|
|
4
|
+
data.tar.gz: 2c37d788ff83ce7ae03e407fe24632429d033ab6475789b8dbb7e64f3d558b62
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5e76826b3e2c190af5d7e28b26320bbc2a089bdd286b9aab0d59b2f9bc1659c410bdb836cf5a3bc40cd0dfaa38e779973231d1718fb014770ea45fde5fc51993
|
|
7
|
+
data.tar.gz: 5b290333d55ee85d8b4ed7187dcb8c5fe97bf6d08c0a3ffb2a228b74d2de0f09d05e5726d16a68aec8e10c25bc56aeed045dd6aa17cb5e0594e375442da157fb
|
data/.DS_Store
ADDED
|
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'outreach-ruby/version'
|
|
2
|
+
require 'outreach-ruby/errors'
|
|
3
|
+
require 'outreach-ruby/request'
|
|
4
|
+
require 'outreach-ruby/authorization'
|
|
5
|
+
require 'outreach-ruby/client'
|
|
6
|
+
require 'outreach-ruby/prospect'
|
|
7
|
+
require 'outreach-ruby/user'
|
|
8
|
+
require 'outreach-ruby/sequence'
|
|
9
|
+
require 'outreach-ruby/sequence_state'
|
|
10
|
+
require 'outreach-ruby/service/prospect'
|
|
11
|
+
require 'outreach-ruby/service/user'
|
|
12
|
+
require 'outreach-ruby/service/sequence'
|
|
13
|
+
require 'outreach-ruby/service/sequence_state'
|
|
14
|
+
|
|
15
|
+
module Outreach
|
|
16
|
+
class << self
|
|
17
|
+
attr_accessor :application_identifier
|
|
18
|
+
attr_accessor :application_secret
|
|
19
|
+
attr_accessor :scopes
|
|
20
|
+
attr_accessor :redirect_uri
|
|
21
|
+
attr_accessor :debug
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'uri'
|
|
2
|
+
|
|
3
|
+
module Outreach
|
|
4
|
+
class Authorization
|
|
5
|
+
API_URL = 'https://api.outreach.io/oauth/token'.freeze
|
|
6
|
+
|
|
7
|
+
attr_reader :token, :refresh_token, :expires_in
|
|
8
|
+
|
|
9
|
+
def initialize(attrs)
|
|
10
|
+
@token = attrs['access_token']
|
|
11
|
+
@refresh_token = attrs['refresh_token']
|
|
12
|
+
@expires_in = attrs['expires_in']
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.authorization_url
|
|
16
|
+
url = 'https://api.outreach.io/oauth/authorize'
|
|
17
|
+
params = {
|
|
18
|
+
client_id: Outreach.application_identifier,
|
|
19
|
+
redirect_uri: Outreach.redirect_uri,
|
|
20
|
+
response_type: 'code',
|
|
21
|
+
scope: Outreach.scopes
|
|
22
|
+
}
|
|
23
|
+
url + '?' + URI.encode_www_form(params)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.create(authorization_code)
|
|
27
|
+
params = {
|
|
28
|
+
client_id: Outreach.application_identifier,
|
|
29
|
+
client_secret: Outreach.application_secret,
|
|
30
|
+
redirect_uri: Outreach.redirect_uri,
|
|
31
|
+
grant_type: 'authorization_code',
|
|
32
|
+
code: authorization_code
|
|
33
|
+
}
|
|
34
|
+
response = Outreach::Request.new.post(API_URL, params)
|
|
35
|
+
new(response)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.refresh(refresh_token)
|
|
39
|
+
params = {
|
|
40
|
+
client_id: Outreach.application_identifier,
|
|
41
|
+
client_secret: Outreach.application_secret,
|
|
42
|
+
redirect_uri: Outreach.redirect_uri,
|
|
43
|
+
grant_type: 'refresh_token',
|
|
44
|
+
refresh_token: refresh_token
|
|
45
|
+
}
|
|
46
|
+
response = Request.new.post(API_URL, params)
|
|
47
|
+
new(response)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Outreach
|
|
2
|
+
class Client
|
|
3
|
+
def initialize(api_token)
|
|
4
|
+
@api_token = api_token
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def prospects
|
|
8
|
+
Outreach::Service::Prospect.new(self)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def users
|
|
12
|
+
Outreach::Service::User.new(self)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def sequences
|
|
16
|
+
Outreach::Service::Sequence.new(self)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def sequence_states
|
|
20
|
+
Outreach::Service::SequenceState.new(self)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def request
|
|
24
|
+
Request.new(@api_token)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Outreach
|
|
2
|
+
module Errors
|
|
3
|
+
UNAUTHORIZED_ID = 'unauthenticatedRequest'.freeze
|
|
4
|
+
class Unauthorized < StandardError; end
|
|
5
|
+
|
|
6
|
+
def check_for_error(_status_code, response_body)
|
|
7
|
+
response_hash = JSON.parse(response_body)
|
|
8
|
+
errors = []
|
|
9
|
+
if !response_hash['errors'].nil? && response_hash['errors'].any?
|
|
10
|
+
errors = response_hash['errors'].map { |error| create_error_hash(error) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
errors.map do |error|
|
|
14
|
+
case error[:id]
|
|
15
|
+
when UNAUTHORIZED_ID
|
|
16
|
+
raise Unauthorized, error[:detail]
|
|
17
|
+
else
|
|
18
|
+
raise StandardError, error[:title] + ': ' + error[:detail]
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def create_error_hash(error)
|
|
26
|
+
{
|
|
27
|
+
id: error['id'],
|
|
28
|
+
title: error['title'],
|
|
29
|
+
detail: error['detail']
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Outreach
|
|
2
|
+
module Model
|
|
3
|
+
private
|
|
4
|
+
|
|
5
|
+
def to_ostruct(hash)
|
|
6
|
+
o = OpenStruct.new(hash)
|
|
7
|
+
hash.each.with_object(o) do |(k, v), o|
|
|
8
|
+
o.send(:"#{k}=", to_ostruct(v)) if v.is_a? Hash
|
|
9
|
+
end
|
|
10
|
+
o
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def nested_hash_value(attrs, keys)
|
|
14
|
+
keys.reduce(attrs) { |m, k| m && m[k] }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'outreach-ruby/model'
|
|
2
|
+
|
|
3
|
+
module Outreach
|
|
4
|
+
class Prospect
|
|
5
|
+
extend Outreach::Model
|
|
6
|
+
|
|
7
|
+
attr_accessor :id, :first_name, :last_name, :emails, :owner_id, :response
|
|
8
|
+
|
|
9
|
+
def initialize(attrs)
|
|
10
|
+
@id = attrs['id']
|
|
11
|
+
@first_name = attrs['first_name']
|
|
12
|
+
@last_name = attrs['last_name']
|
|
13
|
+
@emails = attrs['emails']
|
|
14
|
+
@owner_id = attrs['owner_id']
|
|
15
|
+
@response = attrs['response']
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.build_from_attributes_hash(data)
|
|
19
|
+
result = {}
|
|
20
|
+
result['first_name'] = nested_hash_value(
|
|
21
|
+
data,
|
|
22
|
+
%w[attributes firstName]
|
|
23
|
+
)
|
|
24
|
+
result['last_name'] = nested_hash_value(
|
|
25
|
+
data,
|
|
26
|
+
%w[attributes lastName]
|
|
27
|
+
)
|
|
28
|
+
result['emails'] = nested_hash_value(
|
|
29
|
+
data,
|
|
30
|
+
%w[attributes emails]
|
|
31
|
+
)
|
|
32
|
+
result['id'] = data['id']
|
|
33
|
+
result['owner_id'] = nested_hash_value(
|
|
34
|
+
data,
|
|
35
|
+
%w[relationships owner data id]
|
|
36
|
+
)
|
|
37
|
+
result['response'] = data
|
|
38
|
+
new(result)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
require 'json'
|
|
3
|
+
|
|
4
|
+
module Outreach
|
|
5
|
+
class Request
|
|
6
|
+
include HTTParty
|
|
7
|
+
include Errors
|
|
8
|
+
|
|
9
|
+
def initialize(access_token = nil)
|
|
10
|
+
@access_token = access_token
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get(url, query = {})
|
|
14
|
+
attrs = {
|
|
15
|
+
query: query, headers: auth_header
|
|
16
|
+
}
|
|
17
|
+
attrs[:debug_output] = $stdout if Outreach.debug
|
|
18
|
+
response = HTTParty.get(url, attrs)
|
|
19
|
+
parse_response(response)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def post(url, params)
|
|
23
|
+
response_format = params.delete(:response_format) || :json
|
|
24
|
+
attrs = {
|
|
25
|
+
body: params.to_json, headers: auth_header
|
|
26
|
+
}
|
|
27
|
+
attrs[:debug_output] = $stdout if Outreach.debug
|
|
28
|
+
response = HTTParty.post(url, attrs)
|
|
29
|
+
parse_response(response, response_format)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def patch(url, params)
|
|
33
|
+
response_format = params.delete(:response_format) || :json
|
|
34
|
+
attrs = {
|
|
35
|
+
body: params.to_json, headers: auth_header
|
|
36
|
+
}
|
|
37
|
+
attrs[:debug_output] = $stdout if Outreach.debug
|
|
38
|
+
response = HTTParty.patch(url, attrs)
|
|
39
|
+
parse_response(response, response_format)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def delete(url)
|
|
43
|
+
attrs = {
|
|
44
|
+
headers: auth_header
|
|
45
|
+
}
|
|
46
|
+
attrs[:debug_output] = $stdout if Outreach.debug
|
|
47
|
+
response = HTTParty.delete(url, attrs)
|
|
48
|
+
parse_response(response)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def parse_response(response, response_format = :json)
|
|
54
|
+
check_for_error(response.response.code, response.body)
|
|
55
|
+
display_debug(response.body)
|
|
56
|
+
if response_format == :json
|
|
57
|
+
JSON.parse(response.body.to_s)
|
|
58
|
+
else
|
|
59
|
+
response.body.to_s
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def display_debug(response)
|
|
64
|
+
if Outreach.debug
|
|
65
|
+
puts '-' * 20 + ' DEBUG ' + '-' * 20
|
|
66
|
+
puts response
|
|
67
|
+
puts '-' * 18 + ' END DEBUG ' + '-' * 18
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def auth_header
|
|
72
|
+
headers = { 'Content-Type' => 'application/json' }
|
|
73
|
+
headers['Authorization'] = "Bearer #{@access_token}" if @access_token
|
|
74
|
+
headers
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'outreach-ruby/model'
|
|
2
|
+
|
|
3
|
+
module Outreach
|
|
4
|
+
class Sequence
|
|
5
|
+
extend Outreach::Model
|
|
6
|
+
|
|
7
|
+
attr_accessor :id, :name, :response
|
|
8
|
+
|
|
9
|
+
def initialize(attrs)
|
|
10
|
+
@id = attrs['id']
|
|
11
|
+
@name = attrs['name']
|
|
12
|
+
@response = attrs['response']
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.build_from_attributes_hash(data)
|
|
16
|
+
result = {}
|
|
17
|
+
result['id'] = data['id']
|
|
18
|
+
result['name'] = nested_hash_value(
|
|
19
|
+
data,
|
|
20
|
+
%w[attributes name]
|
|
21
|
+
)
|
|
22
|
+
result['response'] = data
|
|
23
|
+
new(result)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'outreach-ruby/model'
|
|
2
|
+
|
|
3
|
+
module Outreach
|
|
4
|
+
class SequenceState
|
|
5
|
+
extend Outreach::Model
|
|
6
|
+
|
|
7
|
+
attr_accessor :id, :sequence_id, :response
|
|
8
|
+
|
|
9
|
+
def initialize(attrs)
|
|
10
|
+
@id = attrs['id']
|
|
11
|
+
@sequence_id = attrs['sequence_id']
|
|
12
|
+
@response = attrs['response']
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.build_from_attributes_hash(data)
|
|
16
|
+
result = {}
|
|
17
|
+
result['id'] = data['id']
|
|
18
|
+
result['sequence_id'] = nested_hash_value(
|
|
19
|
+
data,
|
|
20
|
+
%w[relationships sequence data id]
|
|
21
|
+
)
|
|
22
|
+
result['response'] = data
|
|
23
|
+
new(result)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
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.build_from_attributes_hash(response['data'])
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def find_all(attrs = {})
|
|
14
|
+
response = @request.get(api_url, filter_attribute_mapping(attrs))
|
|
15
|
+
response['data'].map do |attrs|
|
|
16
|
+
collection_class.build_from_attributes_hash(attrs)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def update(id, attrs)
|
|
21
|
+
mapped_attrs = update_attribute_mapping(attrs)
|
|
22
|
+
@request.patch(api_url + '/' + id.to_s, mapped_attrs)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
protected
|
|
26
|
+
|
|
27
|
+
def api_url
|
|
28
|
+
'https://api.outreach.io/api/v2/prospects?include=account,stage,sequenceStates&'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def collection_class
|
|
32
|
+
Outreach::Prospect
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def filter_attribute_mapping(attrs)
|
|
36
|
+
if attrs[:first_name]
|
|
37
|
+
attrs['filter[lastName]'] = attrs.delete(:first_name)
|
|
38
|
+
end
|
|
39
|
+
if attrs[:last_name]
|
|
40
|
+
attrs['filter[firstName]'] = attrs.delete(:last_name)
|
|
41
|
+
end
|
|
42
|
+
attrs['filter[emails]'] = attrs.delete(:email) if attrs[:email]
|
|
43
|
+
attrs['filter[id]'] = attrs.delete(:id) if attrs[:id]
|
|
44
|
+
attrs
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def update_attribute_mapping(attrs)
|
|
48
|
+
result = {
|
|
49
|
+
'data' => {
|
|
50
|
+
'attributes' => {
|
|
51
|
+
'personal' => {},
|
|
52
|
+
'contact' => {}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if attrs['first_name']
|
|
58
|
+
result['data']['attributes']['personal']['name']['first'] = attrs['first_name']
|
|
59
|
+
end
|
|
60
|
+
if attrs['last_name']
|
|
61
|
+
result['data']['attributes']['personal']['name']['last'] = attrs['last_name']
|
|
62
|
+
end
|
|
63
|
+
if attrs['email']
|
|
64
|
+
result['data']['attributes']['contact']['email'] = attrs['email']
|
|
65
|
+
end
|
|
66
|
+
result
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Outreach
|
|
2
|
+
module Service
|
|
3
|
+
class Sequence
|
|
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.build_from_attributes_hash(response['data'])
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def api_url
|
|
16
|
+
'https://api.outreach.io/api/v2/sequences'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def collection_class
|
|
20
|
+
Outreach::Sequence
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Outreach
|
|
2
|
+
module Service
|
|
3
|
+
class SequenceState
|
|
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.build_from_attributes_hash(response['data'])
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def find_all(attrs = {})
|
|
14
|
+
response = @request.get(api_url, filter_attribute_mapping(attrs))
|
|
15
|
+
response['data'].map do |attrs|
|
|
16
|
+
collection_class.build_from_attributes_hash(attrs)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def filter_attribute_mapping(attrs)
|
|
23
|
+
if attrs[:prospect_id]
|
|
24
|
+
attrs['filter[prospect][id]'] = attrs.delete(:prospect_id)
|
|
25
|
+
end
|
|
26
|
+
attrs
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def api_url
|
|
30
|
+
'https://api.outreach.io/api/v2/sequenceStates'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def collection_class
|
|
34
|
+
Outreach::SequenceState
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Outreach
|
|
2
|
+
module Service
|
|
3
|
+
class User
|
|
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.build_from_attributes_hash(response['data'])
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def api_url
|
|
16
|
+
'https://api.outreach.io/api/v2/users'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def collection_class
|
|
20
|
+
Outreach::User
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'outreach-ruby/model'
|
|
2
|
+
|
|
3
|
+
module Outreach
|
|
4
|
+
class User
|
|
5
|
+
extend Outreach::Model
|
|
6
|
+
|
|
7
|
+
attr_accessor :id, :first_name, :last_name, :email, :response
|
|
8
|
+
|
|
9
|
+
def initialize(attrs)
|
|
10
|
+
@id = attrs['id']
|
|
11
|
+
@first_name = attrs['first_name']
|
|
12
|
+
@last_name = attrs['last_name']
|
|
13
|
+
@email = attrs['email']
|
|
14
|
+
@response = attrs['response']
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.build_from_attributes_hash(data)
|
|
18
|
+
result = {}
|
|
19
|
+
result['id'] = data['id']
|
|
20
|
+
result['first_name'] = nested_hash_value(
|
|
21
|
+
data,
|
|
22
|
+
%w[attributes firstName]
|
|
23
|
+
)
|
|
24
|
+
result['last_name'] = nested_hash_value(
|
|
25
|
+
data,
|
|
26
|
+
%w[attributes lastName]
|
|
27
|
+
)
|
|
28
|
+
result['email'] = nested_hash_value(
|
|
29
|
+
data,
|
|
30
|
+
%w[attributes email]
|
|
31
|
+
)
|
|
32
|
+
result['response'] = data
|
|
33
|
+
new(result)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'outreach-ruby/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'outreach-ruby'
|
|
8
|
+
spec.version = Outreach::VERSION
|
|
9
|
+
spec.authors = ['Macgill Davis']
|
|
10
|
+
spec.email = ['macgill@humbledot.com']
|
|
11
|
+
|
|
12
|
+
spec.summary = 'outreach-ruby is a wrapper for the outreachruby.io REST API. This was modified off of https://github.com/thechrisoshow/outreach'
|
|
13
|
+
spec.license = 'MIT'
|
|
14
|
+
spec.homepage = 'http://github.com/humbledot/outreach-ruby'
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
17
|
+
spec.bindir = 'exe'
|
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
19
|
+
spec.require_paths = ['lib']
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
23
|
+
|
|
24
|
+
spec.add_development_dependency 'byebug', '~> 10.0'
|
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.8'
|
|
26
|
+
spec.add_development_dependency 'webmock', '~> 3.5'
|
|
27
|
+
|
|
28
|
+
spec.add_dependency 'httparty', '~> 0.16'
|
|
29
|
+
spec.add_dependency 'json', '>= 1.8', '< 3'
|
|
30
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: outreach-ruby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Macgill Davis
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-03-10 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: '2.0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: byebug
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '10.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '10.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.8'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.8'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: webmock
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '3.5'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.5'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: httparty
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0.16'
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0.16'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: json
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '1.8'
|
|
104
|
+
- - "<"
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '3'
|
|
107
|
+
type: :runtime
|
|
108
|
+
prerelease: false
|
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
110
|
+
requirements:
|
|
111
|
+
- - ">="
|
|
112
|
+
- !ruby/object:Gem::Version
|
|
113
|
+
version: '1.8'
|
|
114
|
+
- - "<"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '3'
|
|
117
|
+
description:
|
|
118
|
+
email:
|
|
119
|
+
- macgill@humbledot.com
|
|
120
|
+
executables: []
|
|
121
|
+
extensions: []
|
|
122
|
+
extra_rdoc_files: []
|
|
123
|
+
files:
|
|
124
|
+
- ".DS_Store"
|
|
125
|
+
- ".gitignore"
|
|
126
|
+
- ".rspec"
|
|
127
|
+
- ".travis.yml"
|
|
128
|
+
- Gemfile
|
|
129
|
+
- README.md
|
|
130
|
+
- Rakefile
|
|
131
|
+
- lib/outreach-ruby.rb
|
|
132
|
+
- lib/outreach-ruby/authorization.rb
|
|
133
|
+
- lib/outreach-ruby/client.rb
|
|
134
|
+
- lib/outreach-ruby/errors.rb
|
|
135
|
+
- lib/outreach-ruby/model.rb
|
|
136
|
+
- lib/outreach-ruby/prospect.rb
|
|
137
|
+
- lib/outreach-ruby/request.rb
|
|
138
|
+
- lib/outreach-ruby/sequence.rb
|
|
139
|
+
- lib/outreach-ruby/sequence_state.rb
|
|
140
|
+
- lib/outreach-ruby/service/prospect.rb
|
|
141
|
+
- lib/outreach-ruby/service/sequence.rb
|
|
142
|
+
- lib/outreach-ruby/service/sequence_state.rb
|
|
143
|
+
- lib/outreach-ruby/service/user.rb
|
|
144
|
+
- lib/outreach-ruby/user.rb
|
|
145
|
+
- lib/outreach-ruby/version.rb
|
|
146
|
+
- outreach-ruby.gemspec
|
|
147
|
+
homepage: http://github.com/humbledot/outreach-ruby
|
|
148
|
+
licenses:
|
|
149
|
+
- MIT
|
|
150
|
+
metadata: {}
|
|
151
|
+
post_install_message:
|
|
152
|
+
rdoc_options: []
|
|
153
|
+
require_paths:
|
|
154
|
+
- lib
|
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - ">="
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0'
|
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
|
+
requirements:
|
|
162
|
+
- - ">="
|
|
163
|
+
- !ruby/object:Gem::Version
|
|
164
|
+
version: '0'
|
|
165
|
+
requirements: []
|
|
166
|
+
rubyforge_project:
|
|
167
|
+
rubygems_version: 2.7.8
|
|
168
|
+
signing_key:
|
|
169
|
+
specification_version: 4
|
|
170
|
+
summary: outreach-ruby is a wrapper for the outreachruby.io REST API. This was modified
|
|
171
|
+
off of https://github.com/thechrisoshow/outreach
|
|
172
|
+
test_files: []
|