velocify 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/velocify.rb +3 -2
- data/lib/velocify/add_leads_payload.rb +34 -0
- data/lib/velocify/agent.rb +24 -0
- data/lib/velocify/campaign.rb +2 -2
- data/lib/velocify/field.rb +2 -2
- data/lib/velocify/field_type.rb +2 -2
- data/lib/velocify/lead.rb +22 -21
- data/lib/velocify/message_payload.rb +15 -0
- data/lib/velocify/model.rb +71 -76
- data/lib/velocify/response_reader.rb +27 -17
- data/lib/velocify/status.rb +2 -2
- data/lib/velocify/version.rb +1 -1
- data/templates/add_leads.xml.erb +31 -21
- metadata +5 -3
- data/lib/velocify/lead_list.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d7d3962780f0757bf6fecac5b63a2eb439f5193
|
4
|
+
data.tar.gz: 404519cd5a282183841b133a47c013b6cd2cb3f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58e5fe96161f78a37d785fbda604aa756facd93334c7abd9c2f545472d23bdc3e2c5b3d986e6bf49816781370d0173cef2430acef66fc317b7539c930703de8d
|
7
|
+
data.tar.gz: 3b7eedb6aca41a7df0593728f4ad4bfe727727eb6fd4b844b504f9ade20939a401a3d2a0e7c4ac1a480c38ecde45b907cd01a943d54bb57609b656d6baaeb237
|
data/lib/velocify.rb
CHANGED
@@ -6,14 +6,15 @@ Dotenv.load
|
|
6
6
|
require "velocify/version"
|
7
7
|
require "velocify/model"
|
8
8
|
require "velocify/campaign"
|
9
|
+
require "velocify/agent"
|
9
10
|
require "velocify/field"
|
10
11
|
require "velocify/field_type"
|
11
12
|
require "velocify/lead"
|
12
13
|
require "velocify/status"
|
13
14
|
|
14
15
|
require "velocify/response_reader"
|
15
|
-
require "velocify/
|
16
|
-
|
16
|
+
require "velocify/message_payload"
|
17
|
+
require "velocify/add_leads_payload"
|
17
18
|
|
18
19
|
module Velocify
|
19
20
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module Velocify
|
4
|
+
class AddLeadsPayload
|
5
|
+
include ERB::Util
|
6
|
+
|
7
|
+
# Creates a new request to add leads
|
8
|
+
#
|
9
|
+
# @param leads [Array<Lead>] A list of leads to be added
|
10
|
+
def initialize leads
|
11
|
+
@leads = leads
|
12
|
+
@credentials = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
# Stores credentials for making an authenticated request
|
16
|
+
#
|
17
|
+
# @param username [String]
|
18
|
+
# @param password [String]
|
19
|
+
# @return [Hash]
|
20
|
+
def authenticate username:, password:
|
21
|
+
@credentials = Hash[:username, username, :password, password]
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [String] The XML payload to send to Velocify's AddLeads operation
|
25
|
+
def render
|
26
|
+
relative_path = File.join '..', '..', 'templates', 'add_leads.xml.erb'
|
27
|
+
current_dir = File.dirname(__FILE__)
|
28
|
+
path = File.expand_path relative_path, current_dir
|
29
|
+
template = File.read(path)
|
30
|
+
xml_str = ERB.new(template).result binding
|
31
|
+
{ xml: xml_str.gsub(/[\n\t]*/, '').gsub(/[ ]{2,}/, '') }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Velocify
|
2
|
+
class Agent
|
3
|
+
include Model
|
4
|
+
|
5
|
+
# Retrieve the entire list of agents
|
6
|
+
#
|
7
|
+
def self.find_all destruct: false, return_array: false
|
8
|
+
verify_credentials!
|
9
|
+
|
10
|
+
request do
|
11
|
+
destruct_response? destruct
|
12
|
+
operation :get_agents
|
13
|
+
authenticate? true
|
14
|
+
transform do |resp|
|
15
|
+
if return_array
|
16
|
+
arrayify resp[:agents][:agent]
|
17
|
+
else
|
18
|
+
resp
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/velocify/campaign.rb
CHANGED
@@ -6,9 +6,9 @@ module Velocify
|
|
6
6
|
verify_credentials!
|
7
7
|
|
8
8
|
request do
|
9
|
-
|
9
|
+
destruct_response? destruct
|
10
10
|
operation :get_campaigns
|
11
|
-
authenticate true
|
11
|
+
authenticate? true
|
12
12
|
transform do |resp|
|
13
13
|
if return_array
|
14
14
|
arrayify resp[:campaigns][:campaign]
|
data/lib/velocify/field.rb
CHANGED
@@ -8,9 +8,9 @@ module Velocify
|
|
8
8
|
verify_credentials!
|
9
9
|
|
10
10
|
request do
|
11
|
-
|
11
|
+
destruct_response? destruct
|
12
12
|
operation :get_fields
|
13
|
-
authenticate true
|
13
|
+
authenticate? true
|
14
14
|
transform do |resp|
|
15
15
|
if return_array
|
16
16
|
arrayify resp[:fields][:field]
|
data/lib/velocify/field_type.rb
CHANGED
@@ -7,9 +7,9 @@ module Velocify
|
|
7
7
|
verify_credentials!
|
8
8
|
|
9
9
|
request do
|
10
|
-
|
10
|
+
destruct_response? destruct
|
11
11
|
operation :get_field_types
|
12
|
-
authenticate true
|
12
|
+
authenticate? true
|
13
13
|
transform do |resp|
|
14
14
|
if return_array
|
15
15
|
arrayify resp[:field_types][:field_type]
|
data/lib/velocify/lead.rb
CHANGED
@@ -30,9 +30,10 @@ module Velocify
|
|
30
30
|
verify_credentials!
|
31
31
|
|
32
32
|
request do
|
33
|
-
|
34
|
-
operation :
|
35
|
-
|
33
|
+
destruct_response? destruct
|
34
|
+
operation :add_leads
|
35
|
+
authenticate? true
|
36
|
+
xml AddLeadsPayload.new(leads)
|
36
37
|
transform do |resp|
|
37
38
|
if return_array
|
38
39
|
arrayify resp[:leads][:lead]
|
@@ -53,10 +54,10 @@ module Velocify
|
|
53
54
|
verify_credentials!
|
54
55
|
|
55
56
|
request do
|
56
|
-
|
57
|
+
destruct_response? destruct
|
57
58
|
operation :get_leads
|
58
59
|
message from: from, to: to
|
59
|
-
authenticate true
|
60
|
+
authenticate? true
|
60
61
|
transform do |resp|
|
61
62
|
if return_array
|
62
63
|
arrayify resp[:leads][:lead]
|
@@ -76,9 +77,9 @@ module Velocify
|
|
76
77
|
verify_credentials!
|
77
78
|
|
78
79
|
request do
|
79
|
-
|
80
|
+
destruct_response? destruct
|
80
81
|
operation :get_leads_by_email
|
81
|
-
authenticate true
|
82
|
+
authenticate? true
|
82
83
|
message email: email
|
83
84
|
transform do |resp|
|
84
85
|
if return_array
|
@@ -99,10 +100,10 @@ module Velocify
|
|
99
100
|
verify_credentials!
|
100
101
|
|
101
102
|
request do
|
102
|
-
|
103
|
+
destruct_response? destruct
|
103
104
|
operation :get_leads_by_phone
|
104
105
|
message phone: phone.gsub(/[()\- ]/, '')
|
105
|
-
authenticate true
|
106
|
+
authenticate? true
|
106
107
|
transform do |resp|
|
107
108
|
if return_array
|
108
109
|
arrayify resp[:leads][:lead]
|
@@ -122,9 +123,9 @@ module Velocify
|
|
122
123
|
verify_credentials!
|
123
124
|
|
124
125
|
request do
|
125
|
-
|
126
|
+
destruct_response? destruct
|
126
127
|
operation :get_lead
|
127
|
-
authenticate true
|
128
|
+
authenticate? true
|
128
129
|
message lead_id: id
|
129
130
|
transform do |resp|
|
130
131
|
if return_array
|
@@ -140,9 +141,9 @@ module Velocify
|
|
140
141
|
verify_credentials!
|
141
142
|
|
142
143
|
request do
|
143
|
-
|
144
|
+
destruct_response? destruct
|
144
145
|
operation :get_last_created_lead
|
145
|
-
authenticate true
|
146
|
+
authenticate? true
|
146
147
|
transform do |resp|
|
147
148
|
if return_array
|
148
149
|
arrayify resp[:leads][:lead]
|
@@ -157,9 +158,9 @@ module Velocify
|
|
157
158
|
verify_credentials!
|
158
159
|
|
159
160
|
request do
|
160
|
-
|
161
|
+
destruct_response? destruct
|
161
162
|
operation :get_last_modified_lead
|
162
|
-
authenticate true
|
163
|
+
authenticate? true
|
163
164
|
transform do |resp|
|
164
165
|
if return_array
|
165
166
|
arrayify resp[:leads][:lead]
|
@@ -174,9 +175,9 @@ module Velocify
|
|
174
175
|
verify_credentials!
|
175
176
|
|
176
177
|
request do
|
177
|
-
|
178
|
+
destruct_response? destruct
|
178
179
|
operation :remove_lead
|
179
|
-
authenticate true
|
180
|
+
authenticate? true
|
180
181
|
message lead_id: id
|
181
182
|
transform do |resp|
|
182
183
|
if return_array
|
@@ -202,9 +203,9 @@ module Velocify
|
|
202
203
|
verify_credentials!
|
203
204
|
|
204
205
|
request do
|
205
|
-
|
206
|
+
destruct_response? destruct
|
206
207
|
operation :modify_lead_status
|
207
|
-
authenticate true
|
208
|
+
authenticate? true
|
208
209
|
message lead_id: lead_id, status_id: status_id
|
209
210
|
transform do |resp|
|
210
211
|
if return_array
|
@@ -227,9 +228,9 @@ module Velocify
|
|
227
228
|
verify_credentials!
|
228
229
|
|
229
230
|
request do
|
230
|
-
|
231
|
+
destruct_response? destruct
|
231
232
|
operation :modify_lead_field
|
232
|
-
authenticate true
|
233
|
+
authenticate? true
|
233
234
|
message field_id: field_id, lead_id: lead_id, new_value: new_value
|
234
235
|
transform do |resp|
|
235
236
|
if return_array
|
data/lib/velocify/model.rb
CHANGED
@@ -3,42 +3,32 @@ module Velocify
|
|
3
3
|
class Client
|
4
4
|
WSDL = 'http://service.leads360.com/ClientService.asmx?WSDL'
|
5
5
|
|
6
|
-
attr :
|
6
|
+
attr :request, :soap_client, :username, :password
|
7
7
|
|
8
|
-
def initialize
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@
|
8
|
+
def initialize request, username: nil, password: nil
|
9
|
+
@request = request
|
10
|
+
@username = username
|
11
|
+
@password = password
|
12
|
+
@soap_client = Savon.client wsdl: WSDL
|
12
13
|
end
|
13
14
|
|
14
15
|
def call
|
15
|
-
|
16
|
-
|
17
|
-
if spec.has_message?
|
18
|
-
payload = spec.__message
|
19
|
-
end
|
20
|
-
|
21
|
-
if spec.requires_auth?
|
22
|
-
payload.merge! credentials
|
16
|
+
if request.requires_auth?
|
17
|
+
request.authenticate username: @username, password: @password
|
23
18
|
end
|
24
19
|
|
25
|
-
raw_response =
|
26
|
-
response_tag = "#{
|
27
|
-
result_tag = "#{
|
20
|
+
raw_response = soap_client.call(request.operation, request.payload).body
|
21
|
+
response_tag = "#{request.operation.to_s}_response".to_sym
|
22
|
+
result_tag = "#{request.operation.to_s}_result".to_sym
|
28
23
|
response = raw_response[response_tag][result_tag]
|
29
|
-
|
30
|
-
if spec.has_transform?
|
31
|
-
spec.__transform.call response
|
32
|
-
else
|
33
|
-
response
|
34
|
-
end
|
24
|
+
request.transform.call response
|
35
25
|
end
|
36
26
|
|
37
27
|
private
|
38
28
|
|
39
|
-
def
|
40
|
-
|
41
|
-
def
|
29
|
+
def soap_client; @soap_client ; end
|
30
|
+
def credentials; @credentials ; end
|
31
|
+
def request ; @request ; end
|
42
32
|
end
|
43
33
|
|
44
34
|
module RequestHelpers
|
@@ -51,72 +41,80 @@ module Velocify
|
|
51
41
|
end
|
52
42
|
end
|
53
43
|
|
54
|
-
class
|
55
|
-
|
56
|
-
|
57
|
-
|
44
|
+
class Request
|
45
|
+
attr_writer :payload, :requires_auth, :destruct_response
|
46
|
+
attr_accessor :transform
|
47
|
+
attr_accessor :operation
|
58
48
|
|
59
49
|
def initialize
|
60
|
-
@
|
50
|
+
@destruct_response = false
|
51
|
+
@requires_auth = false
|
61
52
|
end
|
62
53
|
|
63
|
-
def
|
64
|
-
@
|
54
|
+
def authenticate username:, password:
|
55
|
+
@payload.authenticate username: username, password: password
|
65
56
|
end
|
66
57
|
|
67
|
-
def
|
68
|
-
@
|
58
|
+
def transform= transform
|
59
|
+
@transform = transform
|
69
60
|
end
|
70
|
-
|
71
|
-
def
|
72
|
-
@
|
73
|
-
end
|
74
|
-
|
75
|
-
def message *msg
|
76
|
-
@message = Hash[ *msg ]
|
61
|
+
|
62
|
+
def payload
|
63
|
+
@payload.render
|
77
64
|
end
|
65
|
+
|
66
|
+
def destruct_response? ; @destruct_response ; end
|
67
|
+
def requires_auth? ; @requires_auth ; end
|
68
|
+
end
|
69
|
+
|
70
|
+
class RequestBuilder
|
71
|
+
include RequestHelpers
|
78
72
|
|
79
|
-
def
|
80
|
-
@
|
73
|
+
def initialize
|
74
|
+
@destruct = false
|
81
75
|
end
|
82
76
|
|
83
|
-
def
|
84
|
-
@
|
77
|
+
def destruct_response? is_on
|
78
|
+
@destruct = is_on
|
85
79
|
end
|
86
80
|
|
87
|
-
def
|
88
|
-
|
81
|
+
def authenticate? is_on
|
82
|
+
@authenticate = is_on
|
89
83
|
end
|
90
84
|
|
91
|
-
def
|
92
|
-
|
85
|
+
def transform &block
|
86
|
+
@transform = block
|
93
87
|
end
|
94
88
|
|
95
|
-
def
|
96
|
-
|
89
|
+
def operation op
|
90
|
+
@operation = op.to_sym
|
97
91
|
end
|
98
92
|
|
99
|
-
def
|
100
|
-
@
|
93
|
+
def xml xml
|
94
|
+
@xml = xml
|
101
95
|
end
|
102
96
|
|
103
|
-
def
|
104
|
-
@
|
97
|
+
def message msg
|
98
|
+
@message = msg
|
105
99
|
end
|
106
100
|
|
107
|
-
def
|
108
|
-
|
101
|
+
def build
|
102
|
+
Request.new.tap do |req|
|
103
|
+
req.payload = @xml || MessagePayload.new(@message)
|
104
|
+
req.requires_auth = @authenticate
|
105
|
+
req.transform = @transform || -> (resp) { resp }
|
106
|
+
req.operation = @operation
|
107
|
+
req.destruct_response = @destruct
|
108
|
+
end
|
109
109
|
end
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
module ModelHelpers
|
113
|
-
attr :
|
113
|
+
attr :username, :password
|
114
114
|
|
115
115
|
def authenticate!
|
116
|
-
@
|
117
|
-
|
118
|
-
password: ENV['VELOCIFY_PASSWORD']
|
119
|
-
}
|
116
|
+
@username = ENV['VELOCIFY_USERNAME']
|
117
|
+
@password = ENV['VELOCIFY_PASSWORD']
|
120
118
|
valid_credentials?
|
121
119
|
end
|
122
120
|
|
@@ -127,40 +125,37 @@ module Velocify
|
|
127
125
|
private
|
128
126
|
|
129
127
|
def verify_credentials!
|
130
|
-
if @
|
128
|
+
if @username.nil? || @password.nil?
|
131
129
|
raise Velocify::AuthenticationException, "You must export your credentials to the environment"
|
132
130
|
end
|
133
131
|
end
|
134
132
|
|
135
|
-
def authenticated_message msg
|
136
|
-
@credentials.merge(msg) unless @credentials.nil?
|
137
|
-
end
|
138
|
-
|
139
133
|
def valid_credentials?
|
140
|
-
return false if @
|
141
|
-
!@
|
134
|
+
return false if @username.nil? || @password.nil?
|
135
|
+
!@username.empty? && !@password.empty?
|
142
136
|
end
|
143
137
|
|
144
138
|
def request destruct: false, &block
|
145
139
|
begin
|
146
|
-
|
147
|
-
|
148
|
-
|
140
|
+
request_builder = RequestBuilder.new
|
141
|
+
request_builder.instance_eval(&block)
|
142
|
+
request = request_builder.build
|
143
|
+
client = Client.new request, username: @username, password: @password
|
149
144
|
|
150
|
-
if destruct ||
|
145
|
+
if destruct || request.destruct_response?
|
151
146
|
result = client.call
|
152
147
|
[true, result]
|
153
148
|
else
|
154
149
|
client.call
|
155
150
|
end
|
156
151
|
rescue Savon::SOAPFault => ex
|
157
|
-
if destruct ||
|
152
|
+
if destruct || request.destruct_response?
|
158
153
|
[false, { message: ex.message }]
|
159
154
|
else
|
160
155
|
{ message: ex.message }
|
161
156
|
end
|
162
157
|
rescue Net::ReadTimeout => ex
|
163
|
-
if destruct ||
|
158
|
+
if destruct || request.destruct_response?
|
164
159
|
[false, { message: ex.message }]
|
165
160
|
else
|
166
161
|
{ message: ex.message }
|
@@ -12,8 +12,13 @@ module Velocify
|
|
12
12
|
def read kind:, response:
|
13
13
|
singular_key = kind.to_s
|
14
14
|
plural_key = singular_key.pluralize
|
15
|
-
fields = response
|
16
|
-
|
15
|
+
fields = response
|
16
|
+
|
17
|
+
if response.instance_of? Hash
|
18
|
+
fields = response[plural_key.to_sym][singular_key.to_sym]
|
19
|
+
end
|
20
|
+
|
21
|
+
ResponseReader.new kind: kind, elements: fields
|
17
22
|
end
|
18
23
|
end
|
19
24
|
|
@@ -23,40 +28,45 @@ module Velocify
|
|
23
28
|
# @return [String] the id of the `kind` that matches the title you searched for
|
24
29
|
#
|
25
30
|
def find_id_by_title title
|
26
|
-
|
27
|
-
|
28
|
-
|
31
|
+
element = select_one_by_title title
|
32
|
+
element["@#{kind}_id".to_sym] if element
|
33
|
+
end
|
29
34
|
|
30
|
-
|
35
|
+
def find_value_by_title title
|
36
|
+
element = select_one_by_title title
|
37
|
+
element["@value".to_sym] if element
|
31
38
|
end
|
32
39
|
|
33
40
|
def search_by_title title
|
34
|
-
|
35
|
-
|
41
|
+
element = @elements.select { |el|
|
42
|
+
el["@#{kind}_title".to_sym] =~ /#{title}/
|
36
43
|
}
|
37
44
|
|
38
|
-
|
45
|
+
element if element
|
39
46
|
end
|
40
47
|
|
41
48
|
def find_by_title title
|
42
|
-
|
43
|
-
|
44
|
-
}.pop
|
45
|
-
|
46
|
-
key if key
|
49
|
+
element = select_one_by_title title
|
50
|
+
element if element
|
47
51
|
end
|
48
52
|
|
49
53
|
# @return [String] a list of all the titles
|
50
54
|
def all_titles
|
51
|
-
@
|
55
|
+
@elements.map { |el| el["@#{kind}_title".to_sym] }
|
52
56
|
end
|
53
57
|
|
54
58
|
private
|
55
59
|
|
56
60
|
attr :kind, :hash
|
57
61
|
|
58
|
-
def initialize kind:,
|
59
|
-
@kind, @
|
62
|
+
def initialize kind:, elements:
|
63
|
+
@kind, @elements = kind.to_s, elements
|
64
|
+
end
|
65
|
+
|
66
|
+
def select_one_by_title title
|
67
|
+
@elements.select { |el|
|
68
|
+
el["@#{kind}_title".to_sym] == title
|
69
|
+
}.pop
|
60
70
|
end
|
61
71
|
end
|
62
72
|
end
|
data/lib/velocify/status.rb
CHANGED
@@ -6,9 +6,9 @@ module Velocify
|
|
6
6
|
verify_credentials!
|
7
7
|
|
8
8
|
request do
|
9
|
-
|
9
|
+
destruct_response? destruct
|
10
10
|
operation :get_statuses
|
11
|
-
authenticate true
|
11
|
+
authenticate? true
|
12
12
|
transform do |resp|
|
13
13
|
if return_array
|
14
14
|
arrayify resp[:statuses][:status]
|
data/lib/velocify/version.rb
CHANGED
data/templates/add_leads.xml.erb
CHANGED
@@ -1,22 +1,32 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="https://service.leads360.com">
|
2
|
+
<env:Body>
|
3
|
+
<ser:AddLeads>
|
4
|
+
<ser:username><%= @credentials[:username] %></ser:username>
|
5
|
+
<ser:password><%= @credentials[:password] %></ser:password>
|
6
|
+
<ser:leads>
|
7
|
+
<Leads>
|
8
|
+
<% @leads.each do |lead| %>
|
9
|
+
<Lead>
|
10
|
+
<% if lead.status_id? %>
|
11
|
+
<Status StatusId="<%= lead.status_id %>"></Status>
|
12
|
+
<% end %>
|
13
|
+
<% if lead.campaign_id? %>
|
14
|
+
<Campaign CampaignId="<%= lead.campaign_id %>"></Campaign>
|
15
|
+
<% end %>
|
16
|
+
<% if lead.agent_id? %>
|
17
|
+
<Agent AgentId="<%= lead.agent_id %>"></Agent>
|
18
|
+
<% end %>
|
19
|
+
<% unless lead.fields.empty? %>
|
20
|
+
<Fields>
|
21
|
+
<% lead.fields.each do |field| %>
|
22
|
+
<Field FieldId="<%= field[:id] %>" Value="<%= field[:value] %>"></Field>
|
23
|
+
<% end %>
|
24
|
+
</Fields>
|
25
|
+
<% end %>
|
26
|
+
</Lead>
|
17
27
|
<% end %>
|
18
|
-
</
|
19
|
-
|
20
|
-
</
|
21
|
-
|
22
|
-
</
|
28
|
+
</Leads>
|
29
|
+
</ser:leads>
|
30
|
+
</ser:AddLeads>
|
31
|
+
</env:Body>
|
32
|
+
</env:Envelope>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: velocify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Dyba
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -126,11 +126,13 @@ files:
|
|
126
126
|
- bin/console
|
127
127
|
- bin/setup
|
128
128
|
- lib/velocify.rb
|
129
|
+
- lib/velocify/add_leads_payload.rb
|
130
|
+
- lib/velocify/agent.rb
|
129
131
|
- lib/velocify/campaign.rb
|
130
132
|
- lib/velocify/field.rb
|
131
133
|
- lib/velocify/field_type.rb
|
132
134
|
- lib/velocify/lead.rb
|
133
|
-
- lib/velocify/
|
135
|
+
- lib/velocify/message_payload.rb
|
134
136
|
- lib/velocify/model.rb
|
135
137
|
- lib/velocify/response_reader.rb
|
136
138
|
- lib/velocify/status.rb
|
data/lib/velocify/lead_list.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
|
3
|
-
module Velocify
|
4
|
-
class LeadList
|
5
|
-
include ERB::Util
|
6
|
-
|
7
|
-
attr :leads
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@leads = []
|
11
|
-
end
|
12
|
-
|
13
|
-
def add_lead lead
|
14
|
-
@leads << lead
|
15
|
-
end
|
16
|
-
|
17
|
-
def render
|
18
|
-
relative_path = File.join '..', '..', 'templates', 'add_leads.xml.erb'
|
19
|
-
current_dir = File.dirname(__FILE__)
|
20
|
-
path = File.expand_path relative_path, current_dir
|
21
|
-
template = File.read(path)
|
22
|
-
ERB.new(template).result binding
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|