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 CHANGED
@@ -8,7 +8,7 @@ require "thread"
8
8
 
9
9
  class Contacts
10
10
  TYPES = {}
11
- VERSION = "1.1.18"
11
+ VERSION = "1.1.19"
12
12
 
13
13
  class Base
14
14
  def initialize(login, password)
@@ -14,18 +14,14 @@ class Contacts
14
14
 
15
15
  feed = @client.get(CONTACTS_FEED).to_xml
16
16
 
17
- @contacts = []
18
- feed.elements.each('entry') do |entry|
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
- @contacts << [title, email] unless email.nil?
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adamhunter-contacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.18
4
+ version: 1.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Carlson