salesforceintegration 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/salesforceintegration/version.rb +1 -1
- data/lib/salesforceintegration.rb +3 -4
- 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: 0f4caaededd163eddffc43f3b76e97e746ee2239
|
4
|
+
data.tar.gz: 57a0297cf0663328211cc58d4062169525994fb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9678ac3b44c6cbcadeb18c9ffb48a45b71a6abf8b5f503c307235bd161bf9cf357ad5f78202be49fa4ab6159b4b18da7616ff6d3d0248bcbf1c29269feea49b4
|
7
|
+
data.tar.gz: b50cd92926ad25dbf46a20d3d94c2c51153374c07c4850af8d296926baf18c28e560b83e223cce6dd51e760a724393836aab932c89749abfc6dc0282b9670fd0
|
@@ -16,17 +16,16 @@ module SalesforceIntegration
|
|
16
16
|
client.materialize("User")
|
17
17
|
end
|
18
18
|
|
19
|
-
#TODO: Permitir associar a contas
|
20
19
|
def create_lead_on_salesforce(fields)
|
21
20
|
raise "The fields last_name and company are required" unless fields.has_key?(:last_name) and fields.has_key?(:company)
|
22
21
|
raise "The fields last_name and company cannot be blank" if fields[:last_name].blank? or fields[:company].blank?
|
22
|
+
raise "Email must be valid" unless fields[:email].blank? or
|
23
|
+
fields[:email] =~ /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/
|
23
24
|
|
24
25
|
lead = Lead.new
|
25
|
-
|
26
|
-
#TODO: Nao esta claro ao que corresponde esse usuario no salesforce. Verificar
|
27
26
|
user = User.first
|
28
|
-
lead['OwnerId'] = user.Id
|
29
27
|
|
28
|
+
lead['OwnerId'] = user.Id
|
30
29
|
lead['FirstName'] = fields[:first_name]
|
31
30
|
lead['LastName'] = fields[:last_name]
|
32
31
|
lead['Email'] = fields[:email]
|