lead_create 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lead_create.rb +17 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6dbcccb2ee4afc2fbad517682d4ba174e067824
|
4
|
+
data.tar.gz: e82578a7642d38d162efb45f752b51fc553f53fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 882cabd5799c721bbd722240b6bc5fb5e9cada9bedc17b42be9509824e45041c6d9d0d221c74955249437ab59e510529cc92bbbc5ad1090e82fe82e42419ffaa
|
7
|
+
data.tar.gz: b8a0d07cb05080fb1bfdb790c620d9bc9dcba3b7e3c62ad79c5ea3c29b30297a1e8ec4619381a9b239fe4bb4a06344290144e207557eafd6695ce281060f0f93
|
data/lib/lead_create.rb
CHANGED
@@ -2,8 +2,12 @@ class LeadCreate
|
|
2
2
|
def self.create(contato)
|
3
3
|
connect
|
4
4
|
load_new_lead(contato)
|
5
|
-
if
|
6
|
-
|
5
|
+
if(@lead.all.select { |lead| lead.FirstName == @new_lead.FirstName }.empty?)
|
6
|
+
if @lead.save
|
7
|
+
contato.name + ' successfully added'
|
8
|
+
end
|
9
|
+
else
|
10
|
+
'This contact has already been added'
|
7
11
|
end
|
8
12
|
end
|
9
13
|
|
@@ -26,17 +30,17 @@ class LeadCreate
|
|
26
30
|
|
27
31
|
def self.load_new_lead(contato)
|
28
32
|
@lead = @client.materialize('Lead')
|
29
|
-
@
|
33
|
+
@new_lead = @lead.new
|
30
34
|
user = @client.materialize('User')
|
31
|
-
@
|
32
|
-
@
|
33
|
-
@
|
34
|
-
@
|
35
|
-
@
|
36
|
-
@
|
37
|
-
@
|
38
|
-
@
|
39
|
-
@
|
40
|
-
@
|
35
|
+
@new_lead.OwnerId = user.first.Id
|
36
|
+
@new_lead.FirstName = contato.name
|
37
|
+
@new_lead.LastName = contato.last_name
|
38
|
+
@new_lead.Email = contato.email
|
39
|
+
@new_lead.Company = contato.company
|
40
|
+
@new_lead.Title = contato.job_title
|
41
|
+
@new_lead.Phone = contato.phone
|
42
|
+
@new_lead.Website = contato.website
|
43
|
+
@new_lead.IsConverted = false
|
44
|
+
@new_lead.IsUnreadByOwner = true
|
41
45
|
end
|
42
46
|
end
|