contact_sync 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/contact_sync/syncable.rb +45 -15
- data/lib/contact_sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 612e1896eed72d3d5b06580381ec3795bc3b9cba
|
4
|
+
data.tar.gz: 835712bb3edfb4a72c5a5276c856ddee426dc65d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 935692a079c125869b94965a3a600f0ce327aa76de011528415cf472f2f1f5fc5c2e8ce04fc848b4ae0d9fc61e3ecabeb34f2ebb7c9f7d75e8fe5dfd08dad793
|
7
|
+
data.tar.gz: f35d1125a44869a070fa04e054932c2b0f8b8a5926a24f4346c1ec78e6ace87b8377944f0d77e9f219249a1ba1dadcd398956925a03f8397a15cb383b9550c3e
|
@@ -83,26 +83,56 @@ module ContactSync
|
|
83
83
|
return result
|
84
84
|
end
|
85
85
|
|
86
|
+
|
86
87
|
def matched_contacts
|
87
|
-
|
88
|
-
|
89
|
-
user_emails = []
|
90
|
-
self.contacts.each do |con|
|
91
|
-
user_phones.concat con.phones
|
92
|
-
user_emails.concat con.emails
|
93
|
-
end
|
88
|
+
matched_users = []
|
89
|
+
other_contacts = []
|
94
90
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
91
|
+
self.contacts.includes([:emails, :phones]) do |aKon|
|
92
|
+
aKon.phones.each do |ph|
|
93
|
+
matches = false
|
94
|
+
u = User.where(encrypted_number: ph.number.encrypt(:symmetric)).limit(1).first
|
95
|
+
if !u.blank?
|
96
|
+
matches = true
|
97
|
+
matched_users << {user: u.id, phone: ph.id, contact: aKon.id}
|
98
|
+
end
|
99
|
+
end
|
100
|
+
aKon.emails.each do |em|
|
101
|
+
u = User.where(email: mail.email).limit(1).first
|
102
|
+
if !u.blank?
|
103
|
+
matches = true
|
104
|
+
matched_users << {user: u.id, email: em.id, contact: aKon.id}
|
105
|
+
end
|
106
|
+
end
|
107
|
+
other_contacts << aKon if !matches
|
102
108
|
end
|
103
|
-
return matched_contacts
|
104
109
|
end
|
105
110
|
|
111
|
+
|
112
|
+
|
113
|
+
# def matched_contacts
|
114
|
+
# matched_contacts = []
|
115
|
+
# user_phones = []
|
116
|
+
# user_emails = []
|
117
|
+
# self.contacts.each do |con|
|
118
|
+
# user_phones.concat con.phones
|
119
|
+
# user_emails.concat con.emails
|
120
|
+
# end
|
121
|
+
#
|
122
|
+
# user_phones.each do |phone|
|
123
|
+
# u = User.where(encrypted_number: phone.number.encrypt(:symmetric)).limit(1).first
|
124
|
+
# matched_contacts << u.id unless u.blank?
|
125
|
+
# end
|
126
|
+
# user_emails.each do |mail|
|
127
|
+
# u = User.where(email: mail.email).limit(1).first
|
128
|
+
# if !u.blank?
|
129
|
+
# matched_contacts << u.id
|
130
|
+
# end
|
131
|
+
# end
|
132
|
+
# other_contacts = self.contacts.collect(&:id) &
|
133
|
+
# return {app_users: matched_contacts, other_users: self.contacts}
|
134
|
+
# end
|
135
|
+
#
|
106
136
|
private
|
107
137
|
def contact_params(aContact)
|
108
138
|
aContact.permit(:composite_name, :first_name, :middle_name, :last_name, :prefix, :suffix, :nickname, :job_title, :department, :organization, :birthdate, :note, :creation_date, :modification_date, :record_id)
|
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
|
+
version: 1.1.0
|
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-05-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|