contacts 1.0.8 → 1.0.9

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/README CHANGED
@@ -37,6 +37,7 @@ See the examples/ directory.
37
37
  == Contributors
38
38
 
39
39
  * Britt Selvitelle from Twitter (mailto:anotherbritt@gmail.com) - http://twitter.com
40
+ * Tony Targonski from GigPark (mailto:tony@gigpark.com) - http://gigpark.com
40
41
 
41
42
  This library is released under the terms of the BSD.
42
43
 
data/lib/contacts/base.rb CHANGED
@@ -8,7 +8,7 @@ require "thread"
8
8
 
9
9
  class Contacts
10
10
  TYPES = {}
11
- VERSION = "1.0.8"
11
+ VERSION = "1.0.9"
12
12
 
13
13
  class Base
14
14
  def initialize(login, password)
@@ -52,6 +52,8 @@ class Contacts
52
52
  def parse(data, options)
53
53
  data.gsub!(/^while \(true\); &&&START&&&/, '')
54
54
  data.gsub!(/ &&&END&&&$/, '')
55
+ data.gsub!(/\t/, ' ') # tabs in the note field cause errors with JSON.parse
56
+
55
57
  @contacts = JSON.parse(data)['Body']['Contacts']
56
58
 
57
59
  # Determine in which format to return the data.
@@ -99,11 +99,15 @@ class Contacts
99
99
  end
100
100
 
101
101
  def parse(data, options={})
102
- data = CSV.parse(data)
102
+ data = data.split("\r\n")
103
+ data = CSV.parse(data.join("\r\n").gsub('"', ''), ';')
103
104
  col_names = data.shift
105
+
104
106
  @contacts = data.map do |person|
105
- [[person[1], person[2], person[3]].delete_if{|i|i.nil?}.join(" "), person[46]] unless person[46].nil?
106
- end.compact
107
+ person = person[0].split(",")
108
+ next unless (idx = person.index('SMTP'))
109
+ [[person[1], person[2], person[3]].delete_if{|i|i.empty?}.join(" "), person[idx - 1]] unless person[idx - 1].nil?
110
+ end.compact
107
111
  end
108
112
 
109
113
  end
metadata CHANGED
@@ -1,33 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: contacts
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.0.8
7
- date: 2007-11-26 00:00:00 -08:00
8
- summary: Ridiculously easy contact list information from various providers including Yahoo, Gmail, and Hotmail
9
- require_paths:
10
- - lib
11
- email: lucas@rufy.com
12
- homepage: http://rubyforge.org/projects/contacts
13
- rubyforge_project:
14
- description: Ridiculously easy contact list information from various providers including Yahoo, Gmail, and Hotmail
15
- autorequire: contacts
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 1.0.9
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Lucas Carlson
8
+ autorequire: contacts
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-02-26 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: json
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.4.1
23
+ version:
24
+ description: Ridiculously easy contact list information from various providers including Yahoo, Gmail, and Hotmail
25
+ email: lucas@rufy.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
31
32
  files:
32
33
  - lib/contacts
33
34
  - lib/contacts/base.rb
@@ -39,25 +40,31 @@ files:
39
40
  - Rakefile
40
41
  - README
41
42
  - examples/grab_contacts.rb
42
- test_files: []
43
-
43
+ has_rdoc: true
44
+ homepage: http://rubyforge.org/projects/contacts
45
+ post_install_message:
44
46
  rdoc_options: []
45
47
 
46
- extra_rdoc_files: []
47
-
48
- executables: []
49
-
50
- extensions: []
51
-
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
52
62
  requirements:
53
63
  - A json parser
54
- dependencies:
55
- - !ruby/object:Gem::Dependency
56
- name: json
57
- version_requirement:
58
- version_requirements: !ruby/object:Gem::Version::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 0.4.1
63
- version:
64
+ rubyforge_project:
65
+ rubygems_version: 1.0.1
66
+ signing_key:
67
+ specification_version: 2
68
+ summary: Ridiculously easy contact list information from various providers including Yahoo, Gmail, and Hotmail
69
+ test_files: []
70
+