alexjp-blackbook_csv 1.0.5

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.
Files changed (60) hide show
  1. data/CHANGES.markdown +44 -0
  2. data/Manifest.txt +59 -0
  3. data/README.markdown +72 -0
  4. data/Rakefile +39 -0
  5. data/debug_blackbook.rb +10 -0
  6. data/init.rb +1 -0
  7. data/lib/blackbook/exporter/base.rb +16 -0
  8. data/lib/blackbook/exporter/vcf.rb +45 -0
  9. data/lib/blackbook/exporter/xml.rb +28 -0
  10. data/lib/blackbook/importer/aol.rb +83 -0
  11. data/lib/blackbook/importer/base.rb +39 -0
  12. data/lib/blackbook/importer/csv.rb +87 -0
  13. data/lib/blackbook/importer/gmail.rb +66 -0
  14. data/lib/blackbook/importer/hotmail.rb +124 -0
  15. data/lib/blackbook/importer/page_scraper.rb +86 -0
  16. data/lib/blackbook/importer/yahoo.rb +61 -0
  17. data/lib/blackbook.rb +76 -0
  18. data/test/fixtures/aol_application_page.html +566 -0
  19. data/test/fixtures/aol_bad_login_response_stage_3.html +565 -0
  20. data/test/fixtures/aol_contacts.html +90 -0
  21. data/test/fixtures/aol_login_response_stage_1.html +158 -0
  22. data/test/fixtures/aol_login_response_stage_2.html +559 -0
  23. data/test/fixtures/aol_login_response_stage_3.html +61 -0
  24. data/test/fixtures/aol_login_response_stage_4.html +48 -0
  25. data/test/fixtures/aol_login_response_stage_5.html +404 -0
  26. data/test/fixtures/aol_new_contacts.html +431 -0
  27. data/test/fixtures/gmail.csv +3 -0
  28. data/test/fixtures/gmail_bad_login_response_stage_2.html +560 -0
  29. data/test/fixtures/gmail_contacts.html +228 -0
  30. data/test/fixtures/gmail_login_response_stage_1.html +556 -0
  31. data/test/fixtures/gmail_login_response_stage_2.html +1 -0
  32. data/test/fixtures/gmail_login_response_stage_2a.html +1 -0
  33. data/test/fixtures/gmail_login_response_stage_3.html +249 -0
  34. data/test/fixtures/hotmail_bad_login_response_stage_2.html +31 -0
  35. data/test/fixtures/hotmail_contacts.html +191 -0
  36. data/test/fixtures/hotmail_login_response_stage_1.html +31 -0
  37. data/test/fixtures/hotmail_login_response_stage_2.html +1 -0
  38. data/test/fixtures/hotmail_login_response_stage_3.html +380 -0
  39. data/test/fixtures/yahoo_bad_login_response_stage_2.html +443 -0
  40. data/test/fixtures/yahoo_contacts.csv +3 -0
  41. data/test/fixtures/yahoo_contacts_not_logged_in.html +432 -0
  42. data/test/fixtures/yahoo_contacts_stage_1.html +399 -0
  43. data/test/fixtures/yahoo_login_response_stage_1.html +433 -0
  44. data/test/fixtures/yahoo_login_response_stage_2.html +16 -0
  45. data/test/scripts/live_test.rb +25 -0
  46. data/test/test_blackbook.rb +60 -0
  47. data/test/test_blackbook_exporter_base.rb +16 -0
  48. data/test/test_blackbook_exporter_vcf.rb +52 -0
  49. data/test/test_blackbook_exporter_xml.rb +16 -0
  50. data/test/test_blackbook_importer_aol.rb +113 -0
  51. data/test/test_blackbook_importer_base.rb +24 -0
  52. data/test/test_blackbook_importer_csv.rb +60 -0
  53. data/test/test_blackbook_importer_gmail.rb +117 -0
  54. data/test/test_blackbook_importer_hotmail.rb +147 -0
  55. data/test/test_blackbook_importer_page_scraper.rb +51 -0
  56. data/test/test_blackbook_importer_yahoo.rb +97 -0
  57. data/test/test_helper.rb +69 -0
  58. data/vendor/plugins/blackbook/lib/autotest/blackbook.rb +27 -0
  59. data/vendor/plugins/blackbook/lib/autotest/discover.rb +3 -0
  60. metadata +176 -0
@@ -0,0 +1,399 @@
1
+ <!DOCTYPE html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <style>
5
+ body {font:84.5% tahoma,arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
6
+ </style>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
8
+ <link rel="stylesheet" type="text/css" media="all" href="http://l.yimg.com/us.yimg.com/lib/pim/r/abook/yab3/16_0/all/yab_grayorg.css" />
9
+
10
+
11
+ <title>Yahoo! Address Book - mike_mondragon</title>
12
+ <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" l gen true for "http://address.yahoo.com/yab/us" r ( nz 0 vz 0 lz 0 oz 0 ca 1))'>
13
+ <script type="text/javascript" language="JavaScript">
14
+ <!-- // <![CDATA[
15
+ if(typeof document.charset != "undefined" &&
16
+ document.charset != "UTF-8" &&
17
+ document.charset != "utf-8") {
18
+ document.charset = "UTF-8";
19
+ }
20
+ // ]]> -->
21
+ </script>
22
+
23
+ </head>
24
+ <body> <div id="masthead">
25
+ <!-- SpaceID=0 robot -->
26
+ <!-- SpaceID=0 robot -->
27
+ <form name="yhdr_form" id="masthead_form"
28
+ action="http://search.yahoo.com/search"
29
+ target="_blank" accept-charset="utf-8">
30
+ <div id="ygma">
31
+ <input type="hidden" name="fr" value="ush1-add"/>
32
+ <input type="hidden" name="ei" value="utf-8"/>
33
+
34
+ <div id="masthead_row1">
35
+ <span class="masthead_search">
36
+ <img src="http://us.i1.yimg.com/us.yimg.com/i/us/hdr/el/uh_crn2.gif"
37
+ id="img_crnr" border="0" height="14" width="13" align="bottom" alt=""
38
+ /><img src="http://us.i1.yimg.com/us.yimg.com/i/us/nt/hdr/stw.gif" width="34" height="17" alt="Search the web">
39
+ <input type="text" name="p" size="12" title="Enter search terms here" maxlength="100"/>
40
+ <input class="ygbt" type="submit" value="Search" title="Search"/>
41
+ </span>
42
+ <span class="masthead_link"><a href="http://www.yahoo.com" target="_top">Yahoo!</a></span>
43
+ <span class="masthead_link"><a href="http://my.yahoo.com" target="_top">My Yahoo!</a></span>
44
+ <span class="masthead_link"><a href="http://mail.yahoo.com" target="_top">Mail</a></span>
45
+ <span class="masthead_link"><a href="http://www.yahoo.com/bin/set" target="_top">Make Yahoo! your home page</a></span>
46
+
47
+ </div>
48
+
49
+ <div id="masthead_row2">
50
+ <span id="masthead_logo"><a href="http://address.yahoo.com"><img id="ygmalogo" src="http://us.i1.yimg.com/us.yimg.com/i/us/nt/ma/ma_ab_1.gif" width="318" height="33" alt="Yahoo! Address Book"></a></span>
51
+ <div id="masthead_welcome1">Welcome, <span id="masthead_login">mike_mondragon</span></div>
52
+ <div id="masthead_property_links">
53
+ <a href="http://address.yahoo.com" target="_top">Address Book Home</a> - <a href="http://help.yahoo.com/l/us/yahoo/addressbook/" target="_top">Help</a>
54
+ </div>
55
+ <div id="masthead_welcome2">
56
+ [<a href="http://login.yahoo.com/config/login?logout=1&.done=http://address.yahoo.com&.src=ab&.intl=us" target="_top">Sign Out</a>, <a href="http://edit.yahoo.com/config/eval_profile?.done=http://address.yahoo.com&.src=ab&.intl=us" target="_top">My Account</a>] </div>
57
+ </div>
58
+ </div>
59
+ </form>
60
+ </div> <!-- end masthead -->
61
+ <div id="north_ad"><!-- SpaceID=0 robot -->
62
+ </div>
63
+ <div id="pimnav">
64
+ <div>
65
+ <ul id="apps">
66
+ <li class="first" id="mail"><a href="http://us.rd.yahoo.com/ab_us/pimnav/mail/*http://mail.yahoo.com" class="first">Mail</a></li>
67
+ <li id="addresses" class="selected"><a href="?VPC=contact_list&amp;.rand=73586795" class="first" id="qa_abtab1" ><em>Contacts</em></a></li>
68
+ <li id="calendar"><a href="http://us.rd.yahoo.com/ab_us/pimnav/mail/*http://calendar.yahoo.com/" class="first">Calendar</a></li>
69
+ <li class="last" id="notepad"><a href="http://us.rd.yahoo.com/ab_us/pimnav/mail/*http://notepad.yahoo.com/" class="first">Notepad</a></li>
70
+ </ul>
71
+ <ul id="misc">
72
+ <li class="first"><a href="?1&amp;VPC=sync_info&amp;.rand=73586795" id="qa_sync1" >Sync</a></li>
73
+ <li><a href="?1&amp;VPC=import_export&amp;.rand=73586795" id="qa_impexp1" >Import/Export</a></li>
74
+ <li class="last"><a href="?1&amp;VPC=options&amp;.rand=73586795" id="qa_options1" >Options</a></li>
75
+ </ul>
76
+ </div>
77
+ </div>
78
+
79
+ <!-- this button bar only contains the Done button -->
80
+ <div id="topglobalnavigation" class="globalnavigation">
81
+ <ul class="first">
82
+ <li><a href="?1&amp;VPC=options&amp;.rand=73586795" class="button" id="qa_done1" >Done</a></li>
83
+ </ul>
84
+ </div>
85
+
86
+ <div id="optionsview">
87
+
88
+ <!-- main content panel (originally white and grey, with one round corner) -->
89
+ <table id="priwrap" cellpadding="0" cellspacing="0" width="100%"><colgroup><col width="1"><col width="*"></colgroup><tbody><tr>
90
+ <td id="sec">
91
+ <div id="optionsnav" class="simplemodule sidebar">
92
+ <div class="shd">
93
+ <div class="nw"> </div>
94
+ <div class="ne"> </div>
95
+ </div>
96
+ <div class="sbd">
97
+ <div class="label">Options</div>
98
+ <ul>
99
+ <li><a href="http://mrd.mail.yahoo.com/colors">Colors</a></li>
100
+ <li><a href="http://mrd.mail.yahoo.com/options">Mail</a></li>
101
+ <li class="selected"><a href="?&amp;VPC=options&amp;.rand=73586795">Address Book</a></li>
102
+ <li><a href="http://calendar.yahoo.com/?v=70">Calendar</a></li>
103
+ <li><a href="http://notepad.yahoo.com/?v=165">Notepad</a></li>
104
+ <li><a href="http://edit.yahoo.com/config/eval_profile?.done=http%3A%2F%2Faddress.yahoo.com%2F%3F%26VPC%3Dimport_export%26.rand%3D73586795">Account Information</a></li>
105
+
106
+ </ul>
107
+ </div>
108
+ <div class="sft">
109
+ <div class="sw"> </div>
110
+ <div class="se"> </div>
111
+ <div class="clearfix"><!-- blank --></div>
112
+ </div>
113
+ </div>
114
+
115
+ </td> <!-- closes sec container -->
116
+ <td id="pri">
117
+ <div id="nwcnr">&nbsp;</div>
118
+
119
+ <!-- the header that says Import and Export (originally white) -->
120
+ <h1>Import and Export</h1>
121
+
122
+ <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
123
+
124
+ <!-- the section containing import options (orignally light-grey) -->
125
+ <div id="import" class="optioncontainer alternatinga">
126
+
127
+ <!-- the section header that says Import -->
128
+ <h2>Import</h2>
129
+ <div class="formcontainer"> <!-- container for the forms and help -->
130
+ <!-- the help box on the right side -->
131
+ <div class="help"> <!-- why the extra container? see yab_options.css -->
132
+ <div class="simplemodule" id="import_help">
133
+ <div class="shd">
134
+ <div class="nw"></div>
135
+ <div class="ne"></div>
136
+ </div>
137
+ <div class="sbd">
138
+ <!-- here comes help -->
139
+ <div id="import_help_header">
140
+ Help importing from: </div>
141
+ <ul>
142
+ <li>
143
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-07.html" id="qa_imphelp1" >Outlook Express</a>
144
+ </li>
145
+
146
+ <li>
147
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-05.html" id="qa_imphelp2" >Outlook 97/98/2000</a>
148
+ </li>
149
+
150
+ <li>
151
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-03.html" id="qa_imphelp3" >Outlook 2002 (XP)/2003</a>
152
+ </li>
153
+
154
+ <li>
155
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-10.html" id="qa_imphelp4" >Palm Desktop</a>
156
+ </li>
157
+
158
+ <li>
159
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-12.html" id="qa_imphelp5" >Netscape Address Book</a>
160
+ </li>
161
+
162
+ <li>
163
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-16.html" id="qa_imphelp6" >Yahoo! CSV</a>
164
+ </li>
165
+ </ul>
166
+
167
+ <div id="import_help_warning">
168
+ <span id="import_help_warning_label">
169
+ Warning: </span>
170
+ <span id="import_help_warning_text">
171
+ Importing data may cause duplication with existing contacts in your address book. You may wish to consider <a href="?1&amp;VPC=trash_all&amp;.rand=73586795">deleting&nbsp;all&nbsp;contacts</a> from your address book. </span>
172
+ </div>
173
+ </div>
174
+ <div class="sft">
175
+ <div class="sw"></div>
176
+ <div class="se"></div>
177
+ </div>
178
+ </div> <!-- closes simplemodule -->
179
+ </div> <!-- closes help -->
180
+ <div id="maincontent_import_body">
181
+
182
+ <form method="POST" enctype="multipart/form-data" action="index.php" accept-charset="utf-8">
183
+
184
+ <!-- options, comboboxes, buttons -->
185
+ <div id="maincontent_import_left">
186
+ <input type="hidden" name=".crumb" id="crumb1" value="wxwncVxsaLY">
187
+ <input type="hidden" name="VPC" value="import_export"> <ol>
188
+ <!-- 1. -->
189
+ <li>
190
+ <dl>
191
+ <dt>
192
+ Choose a program to import contacts from: </dt>
193
+ <dd>
194
+ <select name="import_format">
195
+ <option value="msocsv">Microsoft Outlook (.CSV file)</option>
196
+ <option value="ldif">Netscape (.LDIF file)</option>
197
+ <option value="ycsv">Yahoo! (.CSV file)</option>
198
+ <option value="vcf">vCard (.VCF file)</option>
199
+ </select>
200
+ </dd>
201
+ </dl>
202
+ </li>
203
+ <!-- 2. -->
204
+ <li>
205
+ <dl>
206
+ <dt>
207
+ Go to that program (application) and export the appropriate records. </dt>
208
+ <dd class="helptext">
209
+ (refer to the Help section on right) </dd>
210
+ </dl>
211
+ </li>
212
+ <!-- 3. -->
213
+ <li>
214
+ <dl>
215
+ <dt>
216
+ Specify the file to import: </dt>
217
+ <dd>
218
+ <input type="file" accept="text" name="file_upload" />
219
+ </dd>
220
+ </dl>
221
+ </li>
222
+
223
+ <!-- 4. -->
224
+ <li>
225
+ <dl>
226
+ <dt>
227
+ Press Import Now to Import the file: </dt>
228
+ <dd>
229
+ <input name="submit[action_import_file]" type="submit" value="Import Now" />
230
+ </dd>
231
+ </dl>
232
+ </li>
233
+ </ol>
234
+ </div><!-- closes yab_maincontent_import_left -->
235
+ </form>
236
+ </div>
237
+
238
+ </div> <!-- closes formcontainer -->
239
+ <div class="clearfloats"></div>
240
+ </div> <!-- closes the import module -->
241
+
242
+ <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
243
+
244
+ <!-- the section containing export options (orignally dark-grey) -->
245
+ <div id="export" class="optioncontainer alternatingb">
246
+ <!-- the section header that says Export -->
247
+ <h2 id="maincontent_export_header">Export</h2>
248
+
249
+ <!-- the line that instructs the user to pick an option -->
250
+ <h3>Choose the program you want to export to and click the corresponding button:</h3>
251
+ <!-- the remainder of the export panel -->
252
+ <div class="formcontainer">
253
+ <!-- the help box on the right side -->
254
+ <div class="help">
255
+ <div class="simplemodule" id="export_help">
256
+ <div class="shd">
257
+ <div class="nw"></div>
258
+ <div class="ne"></div>
259
+ </div>
260
+ <div class="sbd">
261
+ <!-- here comes help -->
262
+ <div id="export_help_header">
263
+ Help exporting to: </div>
264
+ <ul>
265
+ <li>
266
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-08.html" id="qa_exphelp1" >Outlook Express</a>
267
+ </li>
268
+
269
+ <li>
270
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-06.html" id="qa_exphelp2" >Outlook 97/98/2000</a>
271
+ </li>
272
+
273
+ <li>
274
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-04.html" id="qa_exphelp3" >Outlook 2002 (XP)/2003</a>
275
+ </li>
276
+
277
+ <li>
278
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-11.html" id="qa_exphelp4" >Palm Desktop</a>
279
+ </li>
280
+
281
+ <li>
282
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-13.html" id="qa_exphelp5" >Netscape Address Book</a
283
+ </li>
284
+
285
+ <li>
286
+ <a href="http://help.yahoo.com/l/us/yahoo/addressbook/impexp/impexp-16.html" id="qa_exphelp6" >Yahoo! CSV</a>
287
+ </li>
288
+ </ul>
289
+
290
+ <div id="export_help_warning">
291
+ <span id="export_help_warning_label">
292
+ Warning: </span>
293
+ <span id="export_help_warning_text">
294
+ Contacts added from Yahoo! Yellow Pages will not be exported. </span>
295
+ </div>
296
+ </div> <!-- class bd -->
297
+ <div class="sft">
298
+ <div class="sw"></div>
299
+ <div class="se"></div>
300
+ <div class="clearfix"><!--blank--></div>
301
+ </div>
302
+ </div> <!-- closes help module -->
303
+ </div> <!-- closes help container -->
304
+ <!-- options, comboboxes, buttons -->
305
+ <form method="POST" action="index.php" accept-charset="utf-8">
306
+ <input type="hidden" name=".crumb" id="crumb2" value="wxwncVxsaLY">
307
+ <input type="hidden" name="VPC" value="import_export"> <div class="propertylist content">
308
+ <dl>
309
+ <div><dt>Microsoft Outlook:</dt>
310
+ <dd>
311
+ <!-- depending on the separator we might have one or two options here -->
312
+ <input name="submit[action_export_outlook]" type="submit" value="Export Now" />
313
+
314
+ </dd></div>
315
+
316
+ <div><dt>Netscape/Thunderbird:</dt>
317
+ <dd>
318
+ <input name="submit[action_export_ldif]" type=submit value="Export Now" />
319
+ </dd></div>
320
+
321
+ <div><dt>Yahoo! CSV:</dt>
322
+ <dd>
323
+ <!-- depending on the separator we might have one or two options here -->
324
+ <input name="submit[action_export_yahoo]" type="submit" value="Export Now" />
325
+ </dd></div>
326
+
327
+ <div><dt>vCard Single File:<br />
328
+ <small>(recommended for Palm Desktop users)</small> </dt>
329
+ <dd>
330
+ <input class=fbutton name="submit[action_export_vcard]" type=submit value="Export Now" />
331
+ </dd></div>
332
+
333
+ <div><dt>vCard, Zip of .VCF files:<br />
334
+ <small>(One .VCF file per contact, Outlook compatible)</small>
335
+ </dt>
336
+ <dd>
337
+ <input class=fbutton name="submit[action_export_vcard2]" type=submit value="Export Now" />
338
+ </dd></div>
339
+ </dl>
340
+ </div><!-- closes yab_maincontent_export_left -->
341
+ </form>
342
+ </div> <!-- closes form / help container -->
343
+ <div class="clearfix"><!--blank--></div>
344
+ </div> <!-- closes export module -->
345
+ </td>
346
+ </tr></tbody></table>
347
+ </div> <!-- closes optionsview ID module -->
348
+
349
+ <div id="bottomglobalnavigation" class="globalnavigation">
350
+ <ul class="first">
351
+ <li><a href="?1&amp;VPC=options&amp;.rand=73586795" class="button" id="qa_done2" >Done</a></li>
352
+ </ul>
353
+ </div>
354
+
355
+ <div id="footer">
356
+ <!-- SpaceID=0 robot -->
357
+ <!-- SpaceID=0 robot -->
358
+ <!-- SpaceID=0 robot -->
359
+ <div id="mastfoot">
360
+
361
+ <div id="mastfoot_legal">
362
+ <span id="mastfoot_copyright">Copyright &copy; 2008 <a href="http://www.yahoo.com">Yahoo! Inc.</a> All Rights Reserved.</span>
363
+ <a target="_top" href="http://docs.yahoo.com/info/terms/">Terms of Service</a> - <a href="http://docs.yahoo.com/info/copyright/copyright.html">Copyright/IP Policy</a> </div>
364
+ <div id="mastfoot_privacy">
365
+ NOTICE: We collect personal information on this site.<br>To learn more about how we use your information, see our <a target="_top" href="http://privacy.yahoo.com/privacy/us">Privacy Policy</a> </div>
366
+
367
+ </div>
368
+ <div style="float: right; font-size: 65%; font-color: #333;">
369
+ 1.9.1<br></div> </div>
370
+ </body>
371
+
372
+ <script type="text/javascript" src="http://l.yimg.com/us.yimg.com/lib/pim/r/abook/yab3/16_0/all/yab.js"></script>
373
+
374
+
375
+
376
+ <script type="text/javascript">
377
+ <!-- <CDATA[[
378
+ if(typeof CallDOMLoadedHandlers != "undefined"){
379
+ CallDOMLoadedHandlers();
380
+ }
381
+ // ]]> -->
382
+ </script><!--
383
+ // TS: 1201392258
384
+ // P: 14.69
385
+
386
+ // T: 2.65
387
+
388
+ // B: 0
389
+ // BTX: 0
390
+
391
+ // R: 5.84
392
+ // U: 5.15
393
+ // A: 0.38
394
+ // O: 0
395
+
396
+ -->
397
+
398
+
399
+ <!-- // RPPID:9984 --></html><!-- web245.address.pim.mud.yahoo.com compressed/chunked Sat Jan 26 16:04:18 PST 2008 -->