cardmagic-contacts 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/contacts/gmail.rb +14 -2
- data/lib/contacts/plaxo.rb +2 -2
- metadata +5 -4
data/lib/contacts/gmail.rb
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
# If the json gem is available, use it
|
3
|
+
require "json/add/rails"
|
4
|
+
rescue MissingSourceFile
|
5
|
+
# Otherwise wrap the ActiveSupport JSON implementation for our simple use case
|
6
|
+
class JSON
|
7
|
+
def self.parse(i)
|
8
|
+
ActiveSupport::JSON.decode(i)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
2
12
|
|
3
13
|
class Contacts
|
4
14
|
class Gmail < Base
|
@@ -28,9 +38,11 @@ class Contacts
|
|
28
38
|
data, resp, cookies, forward, old_url = post(LOGIN_URL, postdata, cookie, LOGIN_REFERER_URL) + [LOGIN_URL]
|
29
39
|
|
30
40
|
cookies = remove_cookie("GMAIL_LOGIN", cookies)
|
31
|
-
|
41
|
+
|
32
42
|
if data.index("Username and password do not match")
|
33
43
|
raise AuthenticationError, "Username and password do not match"
|
44
|
+
elsif data.index("The username or password you entered is incorrect")
|
45
|
+
raise AuthenticationError, "Username and password do not match"
|
34
46
|
elsif data.index("Required field must not be blank")
|
35
47
|
raise AuthenticationError, "Login and password must not be blank"
|
36
48
|
elsif data.index("errormsg_0_logincaptcha")
|
data/lib/contacts/plaxo.rb
CHANGED
@@ -34,8 +34,8 @@ class Contacts
|
|
34
34
|
elsif code == '200'
|
35
35
|
@contacts = []
|
36
36
|
doc.elements.each('//contact') do |cont|
|
37
|
-
name = cont.elements['fullName'].text
|
38
|
-
email = cont.elements['email1'].text
|
37
|
+
name = cont.elements['fullName'].nil? ? cont.elements['displayName'].text : cont.elements['fullName'].text
|
38
|
+
email = cont.elements['email1'].text
|
39
39
|
@contacts << [name, email]
|
40
40
|
end.compact
|
41
41
|
@contacts
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cardmagic-contacts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Carlson
|
@@ -9,17 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-05-06 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
|
-
- - "
|
21
|
+
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
23
|
+
version: 1.1.1
|
23
24
|
version:
|
24
25
|
description: A universal interface to grab contact list information from various providers including Yahoo, Gmail, Hotmail, and Plaxo.
|
25
26
|
email: lucas@rufy.com
|