contact_sync 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0684c816809ee85db24dfa43722c0a2d224fa037
|
4
|
+
data.tar.gz: e9c0a7d4f4672409610c999ddcbd483bf7508080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 351d271bc8482d4a7d627861c55a137bb9bcf6879ce926cc9ea6b8879a8b5ccc0144fe69ed6320ce98dcfd3109179daa66486a25e73ba847dcf2ba8fe2a9c201
|
7
|
+
data.tar.gz: 11730ca66d792814b1efb706fe85d15dfc70b87bf7245a1a7be439502ccf39a3382d5e456efb896cf95df691044eec1eb7cdb65991f2ee9b4b1d09a9dfeaf2e8
|
@@ -28,31 +28,32 @@ module ContactSync
|
|
28
28
|
contacts.each do |aContact|
|
29
29
|
phones = aContact[:phones]
|
30
30
|
emails = aContact[:emails]
|
31
|
-
|
32
31
|
aContact.delete :phones
|
33
32
|
aContact.delete :emails
|
33
|
+
newContact = Contact.new(contact_params(aContact))
|
34
34
|
begin
|
35
|
-
newContact = Contact.new(contact_params(aContact))
|
35
|
+
# newContact = Contact.new(contact_params(aContact))
|
36
36
|
# newContact.device_id = contact_hash[:device_id]
|
37
|
-
if phones
|
37
|
+
if phones && phones.class == Array
|
38
38
|
phones.each do |aPhone|
|
39
39
|
newContact.phones.build(phone_params(aPhone))
|
40
40
|
end
|
41
41
|
end
|
42
|
-
if emails
|
42
|
+
if emails && emails.class == Array
|
43
43
|
emails.each do |anEmail|
|
44
44
|
newContact.emails.build(email_params(anEmail))
|
45
45
|
end
|
46
46
|
end
|
47
|
+
self.contacts << newContact
|
47
48
|
if newContact.save
|
48
49
|
# result[:new][:success] << newContact.record_id
|
49
|
-
self.contacts << newContact
|
50
50
|
else
|
51
51
|
result[:new][:failed] << newContact.record_id
|
52
52
|
end
|
53
53
|
rescue ActiveRecord::RecordNotUnique => e
|
54
54
|
puts "Rescuing Duplicate Record"
|
55
55
|
result[:new][:duplicate] << newContact.record_id
|
56
|
+
newContact.destroy
|
56
57
|
end
|
57
58
|
end
|
58
59
|
end
|
data/lib/contact_sync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contact_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saad Masood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|