blackbook 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +5 -0
- data/lib/blackbook.rb +1 -1
- data/lib/blackbook/importer/aol.rb +14 -9
- data/test/fixtures/aol_new_contacts.html +12 -12
- data/test/test_blackbook_importer_aol.rb +6 -4
- metadata +1 -1
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/blackbook.rb
CHANGED
@@ -55,17 +55,22 @@ class Blackbook::Importer::Aol < Blackbook::Importer::PageScraper
|
|
55
55
|
raise( Blackbook::BadCredentialsError, "Must be authenticated to access contacts." )
|
56
56
|
end
|
57
57
|
|
58
|
-
#
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
58
|
+
# jump through the hoops of formulating a request to get printable contacts
|
59
|
+
uri = agent.current_page.uri.dup
|
60
|
+
inputs = agent.current_page.search("//input")
|
61
|
+
user = inputs.detect{|i| i['type'] == 'hidden' && i['name'] == 'user'}
|
62
|
+
utoken = user['value']
|
63
|
+
|
64
|
+
path = uri.path.split('/')
|
65
|
+
path.pop
|
66
|
+
path << 'addresslist-print.aspx'
|
67
|
+
uri.path = path.join('/')
|
68
|
+
uri.query = "command=all&sort=FirstLastNick&sortDir=Ascending&nameFormat=FirstLastNick&user=#{utoken}"
|
69
|
+
page = agent.get uri.to_s
|
65
70
|
|
66
71
|
# Grab all the contacts
|
67
|
-
names = page.
|
68
|
-
emails = page.body.scan( /<span
|
72
|
+
names = page.body.scan( /<span class="fullName">([^<]+)<\/span>/ ).flatten
|
73
|
+
emails = page.body.scan( /<span>Email 1:<\/span> <span>([^<]+)<\/span>/ ).flatten
|
69
74
|
(0...[names.size,emails.size].max).collect do |i|
|
70
75
|
{
|
71
76
|
:name => names[i],
|
@@ -302,7 +302,7 @@
|
|
302
302
|
<div class="contactList">
|
303
303
|
<form id="contactListForm" enctype="multipart/form-data" method="post" action="http://webmail.aol.com/34865/aim/en-us/Lite/ContactList.aspx" accept-charset="UTF-8">
|
304
304
|
|
305
|
-
<div class="toolbar"><div class="basicControls"><input type="submit" name="NewContact" value="New Contact" id="newContactBtn1" title="New Contact Button" tabindex="-1"/><input type="submit" name="NewList" value="New List" id="newListBtn1" title="New List Button" tabindex="-1"/><input type="submit" name="Import" value="Import" title="Import Button" tabindex="-1"/><input type="submit" name="DeleteContacts" value="Delete" id="deleteContactsBtn1" title="Delete Button" tabindex="-1" onclick="return deleteConfirmation('Are you sure you want to delete the selected contacts?');" disabled="disabled" /><input type="submit" name="SendEmail" id="sendEmailBtn1" title="Send Email Button" value="Email" tabindex="-1"/><input type="button" onclick="ProcessCommand('
|
305
|
+
<div class="toolbar"><div class="basicControls"><input type="submit" name="NewContact" value="New Contact" id="newContactBtn1" title="New Contact Button" tabindex="-1"/><input type="submit" name="NewList" value="New List" id="newListBtn1" title="New List Button" tabindex="-1"/><input type="submit" name="Import" value="Import" title="Import Button" tabindex="-1"/><input type="submit" name="DeleteContacts" value="Delete" id="deleteContactsBtn1" title="Delete Button" tabindex="-1" onclick="return deleteConfirmation('Are you sure you want to delete the selected contacts?');" disabled="disabled" /><input type="submit" name="SendEmail" id="sendEmailBtn1" title="Send Email Button" value="Email" tabindex="-1"/><input type="button" onclick="ProcessCommand('4','An error occurred while processing your command.','The selection is incorrect.','An unspecified error has occurred.','\n\nIf this problem continues, please see our technical support information at ','No contacts are selected. Please select one or more contacts before using this command.','','http://webmail.aol.com/34865/aim/en-us/Lite/','ULKLrUelQ2');" class="toolbarType" name="messageAction" value="Print" tabindex="-1"></div><div class="toolbarRight"><div style="display:inline;float:left; margin-top:3px;"><span class="showLabel">View:</span><select name ="categoryFilter" class="categoryFilterSelect" title="Category Filter Select" tabindex="-1"/><option value = "All">All</option><option value = "Auto-Added">Auto-Added</option><option value = "Co-Workers">Co-Workers</option><option value = "Family">Family</option><option value = "Friends">Friends</option><option value = "Uncategorized">Uncategorized</option></select><input type="submit" title="Filter Submit Button" tabindex="-1" name="filterSubmitButton" value="Go" onclick="categoryFilterSubmit();"/></div><div style="display:inline;float:right;"><select disabled="disabled" name="pageJumpTo" title="PageJumpTo Select" tabindex="-1"><option class="disabled">Page 1 of 1</option></select><input style="margin-right:5px;" type="submit" title="PageJumpTo Submit Button" tabindex="-1"name="pageJumpAction" value="Go" disabled="disabled"/><img class="prevButtonDisabled" src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" id="prevBtn1" title="Previous Button" tabindex="-1"/><img class="nextButtonDisabled" src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" id="nextBtn1" title="Next Button" tabindex="-1"/></div></div><div style="clear:both;"></div></div>
|
306
306
|
|
307
307
|
<h1 id=main class=SROnly><a name=main>Contacts</a></h1>
|
308
308
|
|
@@ -311,20 +311,20 @@
|
|
311
311
|
<table width="100%" class="contactListTable" border="0" cellpadding="0" cellspacing="0">
|
312
312
|
<tr><th class="contactCheckCol"><input class="selectAllCB" type="checkbox" name="selectAllCB" onclick="aol.wsl.fContactsSelectAll();"/></th><th class="contactNameCol sortedColumn"><div class="contactNameHeader" onclick="sort('contactListForm','AB_SORT_ASCENDING','AB_SORT_BY_NAME');"><a href="#" class="contactNameHeaderLabel" onclick="sort('contactListForm','AB_SORT_ASCENDING','AB_SORT_BY_NAME');">Name</a></div><div class="sortAscending"></div></th><th class="contactEmailCol"><a href="#" class="contactEmailHeaderLabel" onclick="sort('contactListForm','AB_SORT_DESCENDING','AB_SORT_BY_EMAIL');">Email</a></th><th class="contactPhoneCol"><div class="headerLabel">Phone</div></th><th class="contactEditColSmall"><img src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" width="35" height="1"></th></tr>
|
313
313
|
|
314
|
-
<tr><td class="contactCheck"><input type="checkbox" name="mailto_select" onclick="aol.wsl.fContactsSelectCheckbox(this);" value="
|
315
|
-
<td class="contactName" id="
|
316
|
-
<td class="contactEmail" id="
|
317
|
-
<td class="contactEdit" id="
|
318
|
-
<tr><td class="contactCheck"><input type="checkbox" name="mailto_select" onclick="aol.wsl.fContactsSelectCheckbox(this);" value="
|
319
|
-
<td class="contactName" id="
|
320
|
-
<td class="contactEmail" id="
|
321
|
-
<td class="contactEdit" id="
|
314
|
+
<tr><td class="contactCheck"><input type="checkbox" name="mailto_select" onclick="aol.wsl.fContactsSelectCheckbox(this);" value="3" id="contact_3"/><label for="contact_3"><span class="SROnly">Jane User jane.user</span></label></td>
|
315
|
+
<td class="contactName" id="3"><a href="#" id="3" onclick="detailClick('3');" class="contactNameLabel" title="Details-Contact:Jane User jane.user">Jane User</a></td>
|
316
|
+
<td class="contactEmail" id="3"><a href="#" id="3" onclick="detailClick('3');" title="Details-Contact:Jane User jane.user"><span class="contactPrimaryEmailLabel">jane.user<span class="contactPrimaryEmailLabel">,</span><span class="contactOtherEmailLabel">jane.user@example.com</span></a></td><td NOWRAP class="contactPhone" id="3" onclick="detailClick('3');"></td>
|
317
|
+
<td class="contactEdit" id="3"><a href="#" title="Edit-Contact:Jane User jane.user" id="3" onclick="editClick('3');" class="contactEditLink">Edit</a></td></tr>
|
318
|
+
<tr><td class="contactCheck"><input type="checkbox" name="mailto_select" onclick="aol.wsl.fContactsSelectCheckbox(this);" value="4" id="contact_4"/><label for="contact_4"><span class="SROnly">Joe User joe.user@example.com</span></label></td>
|
319
|
+
<td class="contactName" id="4"><a href="#" id="4" onclick="detailClick('4');" class="contactNameLabel" title="Details-Contact:Joe User joe.user@example.com">Joe User</a></td>
|
320
|
+
<td class="contactEmail" id="4"><a href="#" id="4" onclick="detailClick('4');" title="Details-Contact:Joe User joe.user@example.com"><span class="contactPrimaryEmailLabel">joe.user@example.com</span><span class="contactPrimaryEmailLabel">,</span><span class="contactOtherEmailLabel">joe.user@example2.com</span></a></td><td NOWRAP class="contactPhone" id="4" onclick="detailClick('4');"></td>
|
321
|
+
<td class="contactEdit" id="4"><a href="#" title="Edit-Contact:Joe User joe.user@example.com" id="4" onclick="editClick('4');" class="contactEditLink">Edit</a></td></tr>
|
322
322
|
|
323
323
|
<tr><td><img alt="" src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" width="15" height="1" /></td><td><img alt="" src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" width="150" height="1" /></td><td><img alt="" src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" width="1" height="1" /></td><td><img alt="" src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" width="100" height="1" /></td><td><img alt="" src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" width="45" height="1"/>
|
324
324
|
|
325
325
|
<!-- suppresses the padding of hidden form elements -->
|
326
326
|
<div style="display:none;">
|
327
|
-
<input type="hidden" name="folder" value="" />
|
327
|
+
<input type="hidden" name="folder" value="Inbox" />
|
328
328
|
<input type="hidden" id="searchCriteria" name="searchCriteria" value="" />
|
329
329
|
<input type="hidden" id="categoryFilterName" name="categoryFilterName" value="" />
|
330
330
|
<input type="hidden" id="pageView" name="pageView" value="normal" />
|
@@ -343,7 +343,7 @@
|
|
343
343
|
</td></tr>
|
344
344
|
</table>
|
345
345
|
|
346
|
-
<div class="toolbarLower"><div class="basicControls"><input type="submit" name="NewContact" value="New Contact" id="newContactBtn" title="New Contact Button"/><input type="submit" name="NewList" value="New List" id="newListBtn" title="New List Button"/><input type="submit" name="Import" value="Import" title="Import Button"/><input type="submit" name="DeleteContacts" value="Delete" id="deleteContactsBtn" title="Delete Button" onclick="return deleteConfirmation('Are you sure you want to delete the selected contacts?');" disabled="disabled" /><input type="submit" name="SendEmail" id="sendEmailBtn" title="Send Email Button" value="Email"/><input type="button" onclick="ProcessCommand('
|
346
|
+
<div class="toolbarLower"><div class="basicControls"><input type="submit" name="NewContact" value="New Contact" id="newContactBtn" title="New Contact Button"/><input type="submit" name="NewList" value="New List" id="newListBtn" title="New List Button"/><input type="submit" name="Import" value="Import" title="Import Button"/><input type="submit" name="DeleteContacts" value="Delete" id="deleteContactsBtn" title="Delete Button" onclick="return deleteConfirmation('Are you sure you want to delete the selected contacts?');" disabled="disabled" /><input type="submit" name="SendEmail" id="sendEmailBtn" title="Send Email Button" value="Email"/><input type="button" onclick="ProcessCommand('4','An error occurred while processing your command.','The selection is incorrect.','An unspecified error has occurred.','\n\nIf this problem continues, please see our technical support information at ','No contacts are selected. Please select one or more contacts before using this command.','','http://webmail.aol.com/34865/aim/en-us/Lite/','ULKLrUelQ2');" class="toolbarType" name="messageAction" value="Print"></div><div class="toolbarRight"><div style="display:inline;float:left; margin-top:3px;"><span class="showLabel">View:</span><select name ="categoryFilter" class="categoryFilterSelect" title="Category Filter Select"/><option value = "All">All</option><option value = "Auto-Added">Auto-Added</option><option value = "Co-Workers">Co-Workers</option><option value = "Family">Family</option><option value = "Friends">Friends</option><option value = "Uncategorized">Uncategorized</option></select><input type="submit" title="Filter Submit Button" name="filterSubmitButton" value="Go" onclick="categoryFilterSubmit();"/></div><div style="display:inline;float:right;"><select disabled="disabled" name="pageJumpTo" title="PageJumpTo Select"><option class="disabled">Page 1 of 1</option></select><input style="margin-right:5px;" type="submit" title="PageJumpTo Submit Button"name="pageJumpAction" value="Go" disabled="disabled"/><img class="prevButtonDisabled" src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" id="prevBtn" title="Previous Button"/><img class="nextButtonDisabled" src="http://o.aolcdn.com/cdn.webmail.aol.com/34865/aim/en-us/images/space.gif" id="nextBtn" title="Next Button"/></div></div><div style="clear:both;"></div></div>
|
347
347
|
|
348
348
|
</form>
|
349
349
|
</div>
|
@@ -367,7 +367,7 @@
|
|
367
367
|
|
368
368
|
|
369
369
|
<div class="footer_container">
|
370
|
-
<table align="center"><tbody><tr width=100%><td><ul class="hatLinks links"><li><a href="http://webmail.aol.com/34865/aim/en-us/Lite/Today.aspx?AccessibilityRedirect=true" title="Click here for the accessible version">Accessible Version</a></li><li><a target="_blank" href="http://www.aol.com/aolnetwork/aolcom_terms.html">Terms of Service</a></li><li><a target="_blank" href="http://about.aol.com/aolnetwork/mem_commitments">Privacy Policy</a></li><li class=last><a target="_blank" href="http://www.aol.com/aolnetwork/trademarks.html">Trademarks</a></li></ul></td></tr></tbody></table>
|
370
|
+
<table align="center"><tbody><tr width=100%><td><ul class="hatLinks links"><li><a href="http://webmail.aol.com/34865/aim/en-us/Lite/Today.aspx?AccessibilityRedirect=true" title="Click here for the accessible version">Accessible Version</a></li><li><a href="http://webmail.aol.com/34865/aim/en-us/Suite.aspx?ac=f&r=464" title="Switch to Standard Version">Standard Version</a></li><li><a target="_blank" href="http://www.aol.com/aolnetwork/aolcom_terms.html">Terms of Service</a></li><li><a target="_blank" href="http://about.aol.com/aolnetwork/mem_commitments">Privacy Policy</a></li><li class=last><a target="_blank" href="http://www.aol.com/aolnetwork/trademarks.html">Trademarks</a></li></ul></td></tr></tbody></table>
|
371
371
|
<div class="copyright">© 2008 AOL LLC. All Rights Reserved</div>
|
372
372
|
<script>
|
373
373
|
axs.l10n.keycap_summary = "This table describes the shortcut keys implemented on this page.";
|
@@ -89,13 +89,15 @@ class TestBlackbookImporterAol < Test::Unit::TestCase
|
|
89
89
|
|
90
90
|
response = {'content-type' => 'text/html'}
|
91
91
|
body = load_fixture('aol_application_page.html').join
|
92
|
-
|
93
|
-
|
92
|
+
uri = URI.parse('http://webmail.aol.com/34865/aim/en-us/Lite/Today.aspx')
|
93
|
+
page = WWW::Mechanize::Page.new(uri, response, body, code=nil, mech=nil)
|
94
|
+
@importer.agent.expects(:current_page).times(2).returns(page)
|
94
95
|
|
95
96
|
response = {'content-type' => 'text/html'}
|
96
|
-
body = load_fixture('
|
97
|
+
body = load_fixture('aol_contacts.html').join
|
97
98
|
page = WWW::Mechanize::Page.new(uri=nil, response, body, code=nil, mech=nil)
|
98
|
-
@importer.agent.expects(:get).with(
|
99
|
+
@importer.agent.expects(:get).with(
|
100
|
+
'http://webmail.aol.com/34865/aim/en-us/Lite/addresslist-print.aspx?command=all&sort=FirstLastNick&sortDir=Ascending&nameFormat=FirstLastNick&user=ULKLrUelQ2'
|
99
101
|
).once.returns(page)
|
100
102
|
|
101
103
|
assert_nothing_raised do
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|