contacts 1.0.17 → 1.0.18

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/base.rb CHANGED
@@ -9,7 +9,7 @@ require "erb"
9
9
 
10
10
  class Contacts
11
11
  TYPES = {}
12
- VERSION = "1.0.17"
12
+ VERSION = "1.0.18"
13
13
 
14
14
  class Base
15
15
  def initialize(login, password)
@@ -1,5 +1,6 @@
1
1
  # Use ActiveSupport's version of JSON if available
2
- if Object.const_defined?('ActiveSupport') && ActiveSupport.const_defined?('JSON')
2
+ if Object.const_defined?('ActiveSupport') && ActiveSupport.const_defined?('JSON') && ActiveSupport::JSON.is_a?(Class)
3
+ puts JSON.class
3
4
  class JSON
4
5
  def self.parse(i)
5
6
  ActiveSupport::JSON.decode(i)
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Carlson
8
- autorequire: contacts
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-28 00:00:00 -07:00
12
+ date: 2009-05-06 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,9 +20,9 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.4.1
23
+ version: 1.1.1
24
24
  version:
25
- description: " Ridiculously easy contact list information from various providers including Yahoo, Gmail, and Hotmail\n"
25
+ description: A universal interface to grab contact list information from various providers including Yahoo, Gmail, Hotmail, and Plaxo.
26
26
  email: lucas@rufy.com
27
27
  executables: []
28
28
 
@@ -31,25 +31,18 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
 
33
33
  files:
34
+ - LICENSE
35
+ - Rakefile
36
+ - README
37
+ - examples/grab_contacts.rb
38
+ - lib/contacts.rb
34
39
  - lib/contacts/base.rb
35
40
  - lib/contacts/gmail.rb
36
41
  - lib/contacts/hotmail.rb
37
42
  - lib/contacts/plaxo.rb
38
43
  - lib/contacts/yahoo.rb
39
- - lib/contacts.rb
40
- - test/example_accounts.yml
41
- - test/test_helper.rb
42
- - test/test_suite.rb
43
- - test/unit/gmail_contact_importer_test.rb
44
- - test/unit/hotmail_contact_importer_test.rb
45
- - test/unit/test_accounts_test.rb
46
- - test/unit/yahoo_csv_contact_importer_test.rb
47
- - LICENSE
48
- - Rakefile
49
- - README
50
- - examples/grab_contacts.rb
51
44
  has_rdoc: true
52
- homepage: http://rubyforge.org/projects/contacts
45
+ homepage: http://github.com/cardmagic/contacts
53
46
  licenses: []
54
47
 
55
48
  post_install_message:
@@ -69,12 +62,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
62
  - !ruby/object:Gem::Version
70
63
  version: "0"
71
64
  version:
72
- requirements:
73
- - A json parser
65
+ requirements: []
66
+
74
67
  rubyforge_project:
75
68
  rubygems_version: 1.3.5
76
69
  signing_key:
77
70
  specification_version: 3
78
- summary: Ridiculously easy contact list information from various providers including Yahoo, Gmail, and Hotmail
71
+ summary: A universal interface to grab contact list information from various providers including Yahoo, Gmail, Hotmail, and Plaxo.
79
72
  test_files: []
80
73
 
@@ -1,40 +0,0 @@
1
- gmail:
2
- username: <changeme>
3
- password: <changeme>
4
- contacts:
5
- -
6
- name: "FirstName1 LastName1"
7
- email_address: "firstname1@example.com"
8
- -
9
- name: "FirstName2 LastName2"
10
- email_address: "firstname2@example.com"
11
- yahoo:
12
- username: <changeme>
13
- password: <changeme>
14
- contacts:
15
- -
16
- name: "FirstName1 LastName1"
17
- email_address: "firstname1@example.com"
18
- -
19
- name: "FirstName2 LastName2"
20
- email_address: "firstname2@example.com"
21
- hotmail:
22
- username: <changeme>
23
- password: <changeme>
24
- contacts:
25
- -
26
- name: "FirstName1 LastName1"
27
- email_address: "firstname1@example.com"
28
- -
29
- name: "FirstName2 LastName2"
30
- email_address: "firstname2@example.com"
31
- aol:
32
- username: <changeme>
33
- password: <changeme>
34
- contacts:
35
- -
36
- name: "FirstName1 LastName1"
37
- email_address: "firstname1@example.com"
38
- -
39
- name: "FirstName2 LastName2"
40
- email_address: "firstname2@example.com"
data/test/test_helper.rb DELETED
@@ -1,30 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- $LOAD_PATH.unshift(dir + "/../lib/")
3
- require 'test/unit'
4
- require 'contacts'
5
-
6
- class ContactImporterTestCase < Test::Unit::TestCase
7
- # Add more helper methods to be used by all tests here...
8
- def default_test
9
- assert true
10
- end
11
- end
12
-
13
- class TestAccounts
14
- def self.[](type)
15
- load[type]
16
- end
17
-
18
- def self.load(file = File.dirname(__FILE__) + "/accounts.yml")
19
- raise "/test/accounts.yml file not found, please create, see /test/example_accounts.yml for information" unless File.exist?(file)
20
-
21
- accounts = {}
22
- YAML::load(File.open(file)).each do |type, contents|
23
- contacts = contents["contacts"].collect {|contact| [contact["name"], contact["email_address"]]}
24
- accounts[type.to_sym] = Account.new(type.to_sym, contents["username"], contents["password"], contacts)
25
- end
26
- accounts
27
- end
28
-
29
- Account = Struct.new :type, :username, :password, :contacts
30
- end
data/test/test_suite.rb DELETED
@@ -1,4 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- Dir["#{dir}/**/*_test.rb"].each do |file|
3
- require file
4
- end
@@ -1,39 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- require "#{dir}/../test_helper"
3
- require 'contacts'
4
-
5
- class GmailContactImporterTest < ContactImporterTestCase
6
- def setup
7
- super
8
- @account = TestAccounts[:gmail]
9
- end
10
-
11
- def test_successful_login
12
- Contacts.new(:gmail, @account.username, @account.password)
13
- end
14
-
15
- def test_importer_fails_with_invalid_password
16
- assert_raise(Contacts::AuthenticationError) do
17
- Contacts.new(:gmail, @account.username, "wrong_password")
18
- end
19
- end
20
-
21
- def test_importer_fails_with_blank_password
22
- assert_raise(Contacts::AuthenticationError) do
23
- Contacts.new(:gmail, @account.username, "")
24
- end
25
- end
26
-
27
- def test_importer_fails_with_blank_username
28
- assert_raise(Contacts::AuthenticationError) do
29
- Contacts.new(:gmail, "", @account.password)
30
- end
31
- end
32
-
33
- def test_fetch_contacts
34
- contacts = Contacts.new(:gmail, @account.username, @account.password).contacts
35
- @account.contacts.each do |contact|
36
- assert contacts.include?(contact), "Could not find: #{contact.inspect} in #{contacts.inspect}"
37
- end
38
- end
39
- end
@@ -1,27 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- require "#{dir}/../test_helper"
3
- require 'contacts'
4
-
5
- class HotmailContactImporterTest < ContactImporterTestCase
6
- def setup
7
- super
8
- @account = TestAccounts[:hotmail]
9
- end
10
-
11
- def test_successful_login
12
- Contacts.new(:hotmail, @account.username, @account.password)
13
- end
14
-
15
- def test_importer_fails_with_invalid_password
16
- assert_raise(Contacts::AuthenticationError) do
17
- Contacts.new(:hotmail, @account.username,"wrong_password")
18
- end
19
- end
20
-
21
- def test_fetch_contacts
22
- contacts = Contacts.new(:hotmail, @account.username, @account.password).contacts
23
- @account.contacts.each do |contact|
24
- assert contacts.include?(contact), "Could not find: #{contact.inspect} in #{contacts.inspect}"
25
- end
26
- end
27
- end
@@ -1,23 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- require "#{dir}/../test_helper"
3
-
4
- class TestAccountsTest < ContactImporterTestCase
5
- def test_test_accounts_loads_data_from_example_accounts_file
6
- account = TestAccounts.load(File.dirname(__FILE__) + "/../example_accounts.yml")[:gmail]
7
-
8
- assert_equal :gmail, account.type
9
- assert_equal "<changeme>", account.username
10
- assert_equal "<changeme>", account.password
11
- assert_equal [["FirstName1 LastName1", "firstname1@example.com"], ["FirstName2 LastName2", "firstname2@example.com"]], account.contacts
12
- end
13
-
14
- def test_test_accounts_blows_up_if_file_doesnt_exist
15
- assert_raise(RuntimeError) do
16
- TestAccounts.load("file_that_does_not_exist.yml")
17
- end
18
- end
19
-
20
- def test_we_can_load_from_account_file
21
- assert_not_nil TestAccounts[:gmail].username
22
- end
23
- end
@@ -1,32 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- require "#{dir}/../test_helper"
3
- require 'contacts'
4
-
5
- class YahooContactImporterTest < ContactImporterTestCase
6
- def setup
7
- super
8
- @account = TestAccounts[:yahoo]
9
- end
10
-
11
- def test_successful_login
12
- Contacts.new(:yahoo, @account.username, @account.password)
13
- end
14
-
15
- def test_importer_fails_with_invalid_password
16
- assert_raise(Contacts::AuthenticationError) do
17
- Contacts.new(:yahoo, @account.username,"wrong_password")
18
- end
19
- # run the "successful" login test to ensure we reset yahoo's failed login lockout counter
20
- # See http://www.pivotaltracker.com/story/show/138210
21
- assert_nothing_raised do
22
- Contacts.new(:yahoo, @account.username, @account.password)
23
- end
24
- end
25
-
26
- def test_fetch_contacts
27
- contacts = Contacts.new(:yahoo, @account.username, @account.password).contacts
28
- @account.contacts.each do |contact|
29
- assert contacts.include?(contact), "Could not find: #{contact.inspect} in #{contacts.inspect}"
30
- end
31
- end
32
- end