blackbook 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig ADDED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.0.1 / 2008-02-08
2
+
3
+ * 2 minor enhancement
4
+ * fix edge case sign on issue with GMail
5
+
1
6
  == 1.0.0 / 2008-01-30
2
7
 
3
8
  * 2 major enhancements
data/Manifest.txt CHANGED
@@ -26,6 +26,7 @@ test/fixtures/gmail_bad_login_response_stage_2.html
26
26
  test/fixtures/gmail_contacts.html
27
27
  test/fixtures/gmail_login_response_stage_1.html
28
28
  test/fixtures/gmail_login_response_stage_2.html
29
+ test/fixtures/gmail_login_response_stage_2a.html
29
30
  test/fixtures/gmail_login_response_stage_3.html
30
31
  test/fixtures/hotmail_bad_login_response_stage_2.html
31
32
  test/fixtures/hotmail_contacts.html
data/lib/blackbook.rb CHANGED
@@ -4,7 +4,7 @@ require 'rubygems'
4
4
 
5
5
  class Blackbook
6
6
  include ::Singleton
7
- VERSION = '1.0.0'
7
+ VERSION = '1.0.1'
8
8
 
9
9
  class BlackbookError < ::StandardError; end
10
10
  class BadCredentialsError < BlackbookError; end
@@ -24,8 +24,9 @@ class Blackbook::Importer::Gmail < Blackbook::Importer::PageScraper
24
24
 
25
25
  raise( Blackbook::BadCredentialsError, "That username and password was not accepted. Please check them and try again." ) if page.body =~ /Username and password do not match/
26
26
 
27
- url = page.search('//meta').first.attributes['content'].split('URL=').last rescue nil
28
- page = agent.get url
27
+ if page.search('//meta').first.attributes['content'] =~ /url='?(http.+?)'?$/i
28
+ page = agent.get $1
29
+ end
29
30
  end
30
31
 
31
32
  ##
@@ -0,0 +1 @@
1
+ <html><head><meta http-equiv="Refresh" content="0;url='http://mail.google.com/mail/?ui=html&amp;zy=l'" /></head><body></body></html>
@@ -65,6 +65,27 @@ class TestBlackbookImporterGmail < Test::Unit::TestCase
65
65
  end
66
66
  end
67
67
 
68
+ def test_login_alternative_uri
69
+ response = {'content-type' => 'text/html'}
70
+
71
+ body = load_fixture('gmail_login_response_stage_1.html').join
72
+ page = WWW::Mechanize::Page.new(uri=nil, response, body, code=nil, mech=nil)
73
+ @importer.agent.expects(:get).with('http://mail.google.com/').once.returns(page)
74
+
75
+ body = load_fixture('gmail_login_response_stage_2a.html').join
76
+ page = WWW::Mechanize::Page.new(uri=nil, response, body, code=nil, mech=nil)
77
+ @importer.agent.expects(:submit).once.returns(page)
78
+
79
+ body = load_fixture('gmail_login_response_stage_3.html').join
80
+ page = WWW::Mechanize::Page.new(uri=nil, response, body, code=nil, mech=nil)
81
+ @importer.agent.expects(:get).with('http://mail.google.com/mail/?ui=html&zy=l'
82
+ ).once.returns(page)
83
+
84
+ assert_nothing_raised do
85
+ assert @importer.login
86
+ end
87
+ end
88
+
68
89
  def test_scrape_contacts_raises_badcredentialerror_when_not_logged_in
69
90
  @importer.agent.expects(:cookies).once.returns([])
70
91
  assert_raises(Blackbook::BadCredentialsError) do
metadata CHANGED
@@ -1,15 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentfree
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDPDCCAiSgAwIBAgIBADANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1taWtl
14
+ bW9uZHJhZ29uMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
15
+ FgNjb20wHhcNMDcwODI3MTk1NjQ1WhcNMDgwODI2MTk1NjQ1WjBEMRYwFAYDVQQD
16
+ DA1taWtlbW9uZHJhZ29uMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
17
+ k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD9J/K2
18
+ wp3uqpMzXOfOlY+zb2qRuP0Q6SaqPf8+Y/OD4n+KR91999nRcd9MED4b9okQb5XF
19
+ KjbIRtEyXRtX+nmajf3CqrtOe+Gej9Uru1jBiqwdegCipN2HRrqqOX0Tv15o2W6n
20
+ Lxayxj4JD/DWLrBaKWagv87MCwb0FeKB45Z6bZFA62QM7beBSB9TY+Lv7qpW+uPk
21
+ vlLC9nj765cU0jZNcddgLZcKVl4AihhA5YNOI6XztxA+DSYze8EryrkES8YjY+O7
22
+ oPSSvyi/13QnIPpB884/k9alxWqzx3+qQI6UxXeVY1idS9M+1q3QC6vteo5KqE41
23
+ enZ5Unpw288x+gc5AgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0G
24
+ A1UdDgQWBBQfSk8NE+/Ad8ZKbEAgwIoKvI5H+TANBgkqhkiG9w0BAQUFAAOCAQEA
25
+ ZyBadUGUGP/x2pZEIPYVcP9vG0l64wLDksJNVJ90rEgToaQqypCElvipbCXYF9Pe
26
+ y+5G/bJItH/OKiIHcdJUs8UdXMH5icCpyqNgNopHVkVsE8gghMYm0ptHyKWswRAK
27
+ 6nBO3mw0C2n+KiWdTSXf6HtF9sBg5SV+I/kZEGHbiFEglxfiVoUnlvsCbRt2QlCC
28
+ uMBzJ1sNVgCL3bqeEZwZj0o2HLxOHg0sSOc16rCfX5yvDo7bFM0XAMvwNgYg8ifQ
29
+ zeHINowDygx2eefh0hynPGd/QwgANxHpr4+V93KLsyLosIgAIsqoXRkNx3a5gecL
30
+ q8SfeAt4oNk4pWm9Ocmiww==
31
+ -----END CERTIFICATE-----
11
32
 
12
- date: 2008-02-01 00:00:00 -08:00
33
+ date: 2008-02-08 00:00:00 -08:00
13
34
  default_executable:
14
35
  dependencies:
15
36
  - !ruby/object:Gem::Dependency
@@ -78,6 +99,7 @@ files:
78
99
  - test/fixtures/gmail_contacts.html
79
100
  - test/fixtures/gmail_login_response_stage_1.html
80
101
  - test/fixtures/gmail_login_response_stage_2.html
102
+ - test/fixtures/gmail_login_response_stage_2a.html
81
103
  - test/fixtures/gmail_login_response_stage_3.html
82
104
  - test/fixtures/hotmail_bad_login_response_stage_2.html
83
105
  - test/fixtures/hotmail_contacts.html
metadata.gz.sig ADDED
Binary file