adamhunter-contacts 1.1.18 → 1.1.19
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/contacts/base.rb +1 -1
- data/lib/contacts/gmail.rb +5 -10
- metadata +1 -1
data/lib/contacts/base.rb
CHANGED
data/lib/contacts/gmail.rb
CHANGED
@@ -14,18 +14,14 @@ class Contacts
|
|
14
14
|
|
15
15
|
feed = @client.get(CONTACTS_FEED).to_xml
|
16
16
|
|
17
|
-
@contacts =
|
18
|
-
|
19
|
-
title = entry.elements['title'].text
|
20
|
-
email = nil
|
17
|
+
@contacts = feed.elements.to_a('entry').collect do |entry|
|
18
|
+
title, email = entry.elements['title'].text, nil
|
21
19
|
entry.elements.each('gd:email') do |e|
|
22
|
-
if e.attribute('primary')
|
23
|
-
email = e.attribute('address').value
|
24
|
-
end
|
20
|
+
email = e.attribute('address').value if e.attribute('primary')
|
25
21
|
end
|
26
|
-
|
22
|
+
[title, email] unless email.nil?
|
27
23
|
end
|
28
|
-
@contacts
|
24
|
+
@contacts.compact!
|
29
25
|
rescue GData::Client::AuthorizationError => e
|
30
26
|
raise Contacts::AuthenticationError
|
31
27
|
end
|
@@ -33,6 +29,5 @@ class Contacts
|
|
33
29
|
private
|
34
30
|
|
35
31
|
TYPES[:gmail] = Gmail
|
36
|
-
|
37
32
|
end
|
38
33
|
end
|