yehezkielbs-contacts 1.2.11 → 1.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/contacts/gmail.rb +14 -2
  2. metadata +4 -4
@@ -21,7 +21,19 @@ class Contacts
21
21
  entry.elements.each('gd:email') do |e|
22
22
  email = e.attribute('address').value if e.attribute('primary')
23
23
  end
24
- [title, email] unless email.nil?
24
+
25
+ avatar = nil
26
+ begin
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
35
+
36
+ [title, email, avatar] unless email.nil?
25
37
  end
26
38
  @contacts.compact!
27
39
  rescue GData::Client::AuthorizationError => e
@@ -32,4 +44,4 @@ class Contacts
32
44
 
33
45
  TYPES[:gmail] = Gmail
34
46
  end
35
- end
47
+ end
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: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 11
10
- version: 1.2.11
9
+ - 12
10
+ version: 1.2.12
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-05 00:00:00 Z
22
+ date: 2012-04-12 00:00:00 Z
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: json