yehezkielbs-contacts 1.2.13 → 1.2.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/contacts/aol.rb +13 -6
- data/lib/contacts/gmail.rb +6 -14
- metadata +4 -4
data/lib/contacts/aol.rb
CHANGED
@@ -136,17 +136,24 @@ class Contacts
|
|
136
136
|
private
|
137
137
|
|
138
138
|
def parse(data, options={})
|
139
|
-
|
139
|
+
@contacts = []
|
140
|
+
|
141
|
+
first_line = true
|
140
142
|
data.split("\n").each do |line|
|
141
143
|
begin
|
142
|
-
|
144
|
+
if first_line
|
145
|
+
first_line = false
|
146
|
+
else
|
147
|
+
person = FasterCSV.parse_line(line)
|
148
|
+
if person[4] && !person[4].empty?
|
149
|
+
@contacts << ["#{person[0]} #{person[1]}", person[4]]
|
150
|
+
end
|
151
|
+
end
|
143
152
|
rescue
|
144
153
|
end
|
145
154
|
end
|
146
|
-
|
147
|
-
@contacts =
|
148
|
-
["#{person[0]} #{person[1]}", person[4]] if person[4] && !person[4].empty?
|
149
|
-
end.compact
|
155
|
+
|
156
|
+
@contacts = @contacts.compact
|
150
157
|
end
|
151
158
|
|
152
159
|
def h_to_query_string(hash)
|
data/lib/contacts/gmail.rb
CHANGED
@@ -11,10 +11,10 @@ class Contacts
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def real_connect
|
14
|
-
|
15
|
-
|
14
|
+
gclient = GData::Client::Contacts.new
|
15
|
+
gclient.clientlogin(@login, @password, @captcha_token, @captcha_response)
|
16
16
|
|
17
|
-
feed =
|
17
|
+
feed = gclient.get(CONTACTS_FEED).to_xml
|
18
18
|
|
19
19
|
@contacts = feed.elements.to_a('entry').collect do |entry|
|
20
20
|
title, email = entry.elements['title'].text, nil
|
@@ -22,18 +22,10 @@ class Contacts
|
|
22
22
|
email = e.attribute('address').value if e.attribute('primary')
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
avatar_el = entry.elements['link[@type="image/*"]']
|
28
|
-
if avatar_el
|
29
|
-
avatar_response = @client.get(avatar_el.attribute('href').to_s)
|
30
|
-
avatar = avatar_response.body if avatar_response.status_code == 200
|
31
|
-
end
|
32
|
-
rescue
|
33
|
-
avatar = nil
|
34
|
-
end
|
25
|
+
avatar_el = entry.elements['link[@type="image/*"]']
|
26
|
+
avatar_url = avatar_el ? avatar_el.attribute('href').to_s : nil
|
35
27
|
|
36
|
-
[title, email,
|
28
|
+
[title, email, avatar_url] unless email.nil?
|
37
29
|
end
|
38
30
|
@contacts.compact!
|
39
31
|
rescue GData::Client::AuthorizationError => e
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yehezkielbs-contacts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 14
|
10
|
+
version: 1.2.14
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lucas Carlson
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2012-04-
|
22
|
+
date: 2012-04-24 00:00:00 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: json
|