lead_create 0.0.5 → 0.0.6
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 +19 -12
- 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: 45999e31b3245b8fabd9733a2c8f2fa3dc2656b6
|
4
|
+
data.tar.gz: 1c8b5d696aa2902f6a23978f39b60ba58d07492d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca268215b2c2abec4ad62ae487de4aab26632e6513bcd03aceca0199c9bf43c676a23541be4e0710145bda0469bd7d0ff58a783e3f817b1c2e53adf44255e88f
|
7
|
+
data.tar.gz: 73d69cfc3625999efc5170e0263291da4d4c87fa91190e100b1a87910e8f3aa9c37c117dc36f37300e3294c9789f8b92f571cc25754bfbeec4166b89f2bd4cee
|
data/lib/lead_create.rb
CHANGED
@@ -1,10 +1,27 @@
|
|
1
1
|
class LeadCreate
|
2
2
|
def self.create(contato)
|
3
|
+
lead = get_lead_object
|
4
|
+
@lead = lead.new
|
5
|
+
@lead = load_new_lead(contato)
|
6
|
+
if @lead.save
|
7
|
+
contato.name + ' successfully added'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.list_leads
|
12
|
+
lead = get_lead
|
13
|
+
lead.all
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
def get_lead_object
|
3
18
|
client = Databasedotcom::Client.new('config/databasedotcom.yml')
|
4
19
|
client.authenticate :username => 'matheuslucena@gmail.com', :password => 'slayer666DT0tilUUmpLca7X5kWKGCKDf'
|
5
|
-
|
20
|
+
client.materialize('Lead')
|
21
|
+
end
|
22
|
+
|
23
|
+
def load_new_lead(contato)
|
6
24
|
user = client.materialize('User')
|
7
|
-
@lead = lead.new
|
8
25
|
@lead.OwnerId = user.first.Id
|
9
26
|
@lead.FirstName = contato.name
|
10
27
|
@lead.LastName = contato.last_name
|
@@ -15,15 +32,5 @@ class LeadCreate
|
|
15
32
|
@lead.Website = contato.website
|
16
33
|
@lead.IsConverted = false
|
17
34
|
@lead.IsUnreadByOwner = true
|
18
|
-
if @lead.save
|
19
|
-
contato.name + ' successfully added'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.list_leads
|
24
|
-
client = Databasedotcom::Client.new('config/databasedotcom.yml')
|
25
|
-
client.authenticate :username => 'matheuslucena@gmail.com', :password => 'slayer666DT0tilUUmpLca7X5kWKGCKDf'
|
26
|
-
lead = client.materialize('Lead')
|
27
|
-
lead.all
|
28
35
|
end
|
29
36
|
end
|