contacts 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  == Welcome to Contacts
2
2
 
3
- Contacts is a universal interface to grab contact list information from various providers including Hotmail, AOL, Gmail and Yahoo.
3
+ Contacts is a universal interface to grab contact list information from various providers including Hotmail, AOL, Gmail, Plaxo and Yahoo.
4
4
 
5
5
  == Download
6
6
 
@@ -41,6 +41,7 @@ See the examples/ directory.
41
41
  * Waheed Barghouthi from Watwet (mailto:waheed.barghouthi@gmail.com) - http://watwet.com
42
42
  * Glenn Sidney from Glenn Fu (mailto:glenn@glennfu.com) - http://glennfu.com
43
43
  * Brian McQuay from Onomojo (mailto:brian@onomojo.com) - http://onomojo.com
44
+ * Adam Hunter (mailto:adamhunter@me.com) - http://adamhunter.me/
44
45
 
45
46
  This library is released under the terms of the BSD.
46
47
 
@@ -9,6 +9,7 @@ end
9
9
 
10
10
  class Contacts
11
11
  require 'hpricot'
12
+ require 'csv'
12
13
  class Aol < Base
13
14
  URL = "http://www.aol.com/"
14
15
  LOGIN_URL = "https://my.screenname.aol.com/_cqr/login/login.psp"
@@ -125,21 +126,25 @@ class Contacts
125
126
  end
126
127
 
127
128
  data, resp, cookies, forward, old_url = get(CONTACT_LIST_CSV_URL, @cookies, CONTACT_LIST_URL) + [CONTACT_LIST_URL]
129
+
130
+ until forward.nil?
131
+ data, resp, cookies, forward, old_url = get(forward, cookies, old_url) + [forward]
132
+ end
128
133
 
129
- if forward.nil?
130
- parse data
131
- else
132
- raise AuthenticationError, "Account cancelled"
134
+ if data.include?("error.gif")
135
+ raise AuthenticationError, "Account invalid"
133
136
  end
137
+
138
+ parse data
134
139
  end
135
140
  end
136
141
  private
137
142
 
138
143
  def parse(data, options={})
139
- data = CSV.parse(data)
144
+ data = CSV::Reader.parse(data)
140
145
  col_names = data.shift
141
146
  @contacts = data.map do |person|
142
- ["#{person[0]} #{person[1]}", person[4]] unless person[4].empty?
147
+ ["#{person[0]} #{person[1]}", person[4]] if person[4] && !person[4].empty?
143
148
  end.compact
144
149
  end
145
150
  end
@@ -9,7 +9,7 @@ require "erb"
9
9
 
10
10
  class Contacts
11
11
  TYPES = {}
12
- VERSION = "1.2.0"
12
+ VERSION = "1.2.1"
13
13
 
14
14
  class Base
15
15
  def initialize(login, password)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Carlson