harleytt-gvoice-ruby 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -0
- data/.gitignore +5 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +24 -0
- data/README.rdoc +90 -0
- data/Rakefile +12 -0
- data/VERSION +1 -0
- data/bin/gv-notifier +78 -0
- data/bin/gv-place-call +22 -0
- data/bin/gv-send-sms +16 -0
- data/config/gvoice-ruby-config.yml.sample +11 -0
- data/gvoice-ruby.gemspec +34 -0
- data/lib/gvoice-ruby/call.rb +9 -0
- data/lib/gvoice-ruby/client.rb +277 -0
- data/lib/gvoice-ruby/compatibility.rb +75 -0
- data/lib/gvoice-ruby/config.rb +39 -0
- data/lib/gvoice-ruby/errors.rb +5 -0
- data/lib/gvoice-ruby/inbox_parser.rb +126 -0
- data/lib/gvoice-ruby/sms.rb +9 -0
- data/lib/gvoice-ruby/user.rb +12 -0
- data/lib/gvoice-ruby/version.rb +4 -0
- data/lib/gvoice-ruby/voicemail.rb +10 -0
- data/lib/gvoice-ruby.rb +5 -0
- data/test/client_test.rb +59 -0
- data/test/compatibility_test.rb +47 -0
- data/test/config_test.rb +50 -0
- data/test/fixtures/config_fixture.yml +11 -0
- data/test/fixtures/inbox.json +1 -0
- data/test/fixtures/inbox.yml +206 -0
- data/test/fixtures/inbox_fixture.html +2657 -0
- data/test/fixtures/login_fixture.html +567 -0
- data/test/gvoice-ruby_test.rb +9 -0
- data/test/inbox_parser_test.rb +53 -0
- data/test/test_helper.rb +20 -0
- metadata +223 -0
@@ -0,0 +1,567 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<style type="text/css"><!--
|
4
|
+
body,td,div,p,a,font,span {font-family: arial,sans-serif;}
|
5
|
+
body {margin-top:2}.c {width:4; height: 4}
|
6
|
+
html body { bgcolor: "#ffffff"; padding: 0; margin: 0; }
|
7
|
+
A:link {color:#0000cc; }
|
8
|
+
A:visited { color:#551a8b; }
|
9
|
+
A:active { color:#ff0000; }
|
10
|
+
.form-noindent {background-color: #ffffff; border: #C3D9FF 1px solid;}
|
11
|
+
|
12
|
+
div { display: block; }
|
13
|
+
|
14
|
+
div.loginBox {
|
15
|
+
padding-top: 10px;
|
16
|
+
padding-bottom: 16px;
|
17
|
+
}
|
18
|
+
|
19
|
+
#gc-signup-closed {
|
20
|
+
background-color: #ffffcd;
|
21
|
+
width: 600px;
|
22
|
+
font-size: 13px;
|
23
|
+
margin-top: 30px;
|
24
|
+
padding: 10px;
|
25
|
+
text-align: center;
|
26
|
+
}
|
27
|
+
|
28
|
+
#gaia_table {
|
29
|
+
white-space: normal;
|
30
|
+
text-align: left;
|
31
|
+
}
|
32
|
+
|
33
|
+
.gc-mid {
|
34
|
+
width: 806px;
|
35
|
+
margin: 0 auto;
|
36
|
+
}
|
37
|
+
|
38
|
+
#gc-footer {
|
39
|
+
padding: 60px 0 0 0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#gc-footer a,
|
43
|
+
#gc-more a {
|
44
|
+
color: #3b73cc;
|
45
|
+
}
|
46
|
+
|
47
|
+
#gc-main {
|
48
|
+
width: 100%;
|
49
|
+
}
|
50
|
+
|
51
|
+
#gc-main td {
|
52
|
+
text-align: left;
|
53
|
+
}
|
54
|
+
|
55
|
+
#gc-banner {
|
56
|
+
display: block;
|
57
|
+
height: 90px;
|
58
|
+
background-color: #E0ECFF;
|
59
|
+
border-top: 1px solid #C3D9FF;
|
60
|
+
border-bottom: 1px solid #C3D9FF;
|
61
|
+
text-align: left;
|
62
|
+
}
|
63
|
+
|
64
|
+
#gc-banner-content {
|
65
|
+
height: 90px;
|
66
|
+
position: relative;
|
67
|
+
}
|
68
|
+
|
69
|
+
#gc-banner-low {
|
70
|
+
margin: 14px 0 0 0;
|
71
|
+
}
|
72
|
+
|
73
|
+
#gc-watch {
|
74
|
+
color: #3b73cc;
|
75
|
+
text-decoration: none;
|
76
|
+
font-size: 14px;
|
77
|
+
font-weight: bold;
|
78
|
+
padding: 3px 0 3px 30px;
|
79
|
+
background: url(/accounts/grandcentral/movie_button.gif) no-repeat center left;
|
80
|
+
}
|
81
|
+
|
82
|
+
#gc-create-acc {
|
83
|
+
position: absolute;
|
84
|
+
top: -100px;
|
85
|
+
right: 0px;
|
86
|
+
}
|
87
|
+
|
88
|
+
.gc-features {
|
89
|
+
width: 528px;
|
90
|
+
color: #666;
|
91
|
+
margin: 16px 0 10px 0;
|
92
|
+
}
|
93
|
+
|
94
|
+
.gc-features td {
|
95
|
+
vertical-align: top;
|
96
|
+
padding: 8px 0;
|
97
|
+
}
|
98
|
+
|
99
|
+
.gc-sep {
|
100
|
+
border-right: 1px solid #ccc;
|
101
|
+
}
|
102
|
+
|
103
|
+
.gc-item-hd {
|
104
|
+
font-weight: bold;
|
105
|
+
font-size: 14px;
|
106
|
+
}
|
107
|
+
|
108
|
+
.gc-item-txt {
|
109
|
+
font-size: 12px;
|
110
|
+
padding: 4px 0 16px;
|
111
|
+
}
|
112
|
+
|
113
|
+
.gc-item-details {
|
114
|
+
width: 268px;
|
115
|
+
}
|
116
|
+
|
117
|
+
.gc-item-img {
|
118
|
+
width: 68px;
|
119
|
+
float: left;
|
120
|
+
}
|
121
|
+
|
122
|
+
.gc-item-list {
|
123
|
+
width: 200px;
|
124
|
+
float: right;
|
125
|
+
}
|
126
|
+
|
127
|
+
ul.gc-signup-list {
|
128
|
+
margin: 0 0 0 24px;
|
129
|
+
padding: 0;
|
130
|
+
font-size: 12px;
|
131
|
+
}
|
132
|
+
|
133
|
+
ul.gc-signup-list li {
|
134
|
+
line-height: 1.4em;
|
135
|
+
padding: 0 0 0.5em;
|
136
|
+
}
|
137
|
+
|
138
|
+
#gc-more {
|
139
|
+
padding: 10px 0 0 2px;
|
140
|
+
text-align: left;
|
141
|
+
}
|
142
|
+
|
143
|
+
.gc-nopad {
|
144
|
+
padding: 0;
|
145
|
+
}
|
146
|
+
|
147
|
+
.gc-si-content {
|
148
|
+
position: absolute;
|
149
|
+
top: -70px;
|
150
|
+
right: 2px;
|
151
|
+
height: 248px;
|
152
|
+
white-space: normal;
|
153
|
+
width: 248px;
|
154
|
+
z-index: 8;
|
155
|
+
}
|
156
|
+
|
157
|
+
--></style>
|
158
|
+
<style type="text/css"><!--
|
159
|
+
.gaia.le.lbl { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
|
160
|
+
.gaia.le.fpwd { font-family: Arial, Helvetica, sans-serif; font-size: 70%; }
|
161
|
+
.gaia.le.chusr { font-family: Arial, Helvetica, sans-serif; font-size: 70%; }
|
162
|
+
.gaia.le.val { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
|
163
|
+
.gaia.le.button { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
|
164
|
+
.gaia.le.rem { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
|
165
|
+
|
166
|
+
.gaia.captchahtml.desc { font-family: arial, sans-serif; font-size: smaller; }
|
167
|
+
.gaia.captchahtml.cmt { font-family: arial, sans-serif; font-size: smaller; font-style: italic; }
|
168
|
+
|
169
|
+
--></style>
|
170
|
+
<head>
|
171
|
+
<title>Google Voice - One phone number, online voicemail, and enhanced call features</title>
|
172
|
+
<style type="text/css"><!--
|
173
|
+
|
174
|
+
|
175
|
+
body {
|
176
|
+
font-family: arial, sans-serif;
|
177
|
+
margin: 0;
|
178
|
+
padding: 13px 15px 15px;
|
179
|
+
|
180
|
+
}
|
181
|
+
.body {
|
182
|
+
margin: 0;
|
183
|
+
}
|
184
|
+
div.errorbox-good {}
|
185
|
+
|
186
|
+
div.errorbox-bad {}
|
187
|
+
|
188
|
+
div.errormsg { color: red; font-size: smaller; font-family: arial,sans-serif;}
|
189
|
+
font.errormsg { color: red; font-size: smaller; font-family: arial,sans-serif;}
|
190
|
+
|
191
|
+
|
192
|
+
div.topbar {
|
193
|
+
font-size:smaller;
|
194
|
+
margin-right: -5px;
|
195
|
+
text-align:right;
|
196
|
+
white-space:nowrap;
|
197
|
+
}
|
198
|
+
div.header {
|
199
|
+
margin-bottom: 9px;
|
200
|
+
margin-left: -2px;
|
201
|
+
position:relative;
|
202
|
+
zoom: 1
|
203
|
+
}
|
204
|
+
div.header img.logo {
|
205
|
+
border: 0;
|
206
|
+
float:left;
|
207
|
+
}
|
208
|
+
div.header div.headercontent {
|
209
|
+
float:right;
|
210
|
+
margin-top:17px;
|
211
|
+
}
|
212
|
+
div.header:after{
|
213
|
+
content:".";
|
214
|
+
display:block;
|
215
|
+
height:0;
|
216
|
+
clear:both;
|
217
|
+
visibility:hidden;
|
218
|
+
}
|
219
|
+
div.pagetitle {
|
220
|
+
font-weight:bold;
|
221
|
+
}
|
222
|
+
|
223
|
+
.footer {
|
224
|
+
color: #666;
|
225
|
+
font-size: smaller;
|
226
|
+
margin-top: 40px;
|
227
|
+
text-align: center;
|
228
|
+
}
|
229
|
+
|
230
|
+
table#signupform {
|
231
|
+
left: -5px;
|
232
|
+
top: -7px;
|
233
|
+
position:relative;
|
234
|
+
}
|
235
|
+
table#signupform td{
|
236
|
+
padding: 7px 5px;
|
237
|
+
}
|
238
|
+
table#signupform td table td{
|
239
|
+
padding: 1px;
|
240
|
+
}
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
hr {
|
245
|
+
border: 0;
|
246
|
+
background-color:#DDDDDD;
|
247
|
+
height: 1px;
|
248
|
+
width: 100%;
|
249
|
+
text-align: left;
|
250
|
+
margin: 5px;
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
--></style>
|
257
|
+
<meta name="description" content="Google Voice gives you one number for all your phones, voicemail as easy as email, free US long distance, low rates on international calls, and many calling features like transcripts, call blocking, call screening, conference calling, SMS, and more.">
|
258
|
+
</head>
|
259
|
+
<body dir="ltr"
|
260
|
+
onload=
|
261
|
+
"gaia_setFocus();"
|
262
|
+
>
|
263
|
+
<div class="gc-mid">
|
264
|
+
<div style="padding: 20px 0 6px 0;">
|
265
|
+
<a href='https://www.google.com/voice'>
|
266
|
+
<img src="/accounts/grandcentral/voice-logo.png"
|
267
|
+
border="0"
|
268
|
+
alt="Google Voice" />
|
269
|
+
</a>
|
270
|
+
</div>
|
271
|
+
</div>
|
272
|
+
<div id="gc-banner">
|
273
|
+
<table id="gc-banner-content" class="gc-mid">
|
274
|
+
<tr>
|
275
|
+
<td>
|
276
|
+
<div><img alt="Supercharge your phone" src="/accounts/grandcentral/banner1.png"/></div>
|
277
|
+
</td>
|
278
|
+
</tr>
|
279
|
+
</table>
|
280
|
+
</div>
|
281
|
+
<div class="gc-mid" style="position: relative;">
|
282
|
+
<table class="gc-features">
|
283
|
+
<tr>
|
284
|
+
<td class="gc-sep" style="padding-right: 0;">
|
285
|
+
<div class="gc-item-hd">Use your existing number</div>
|
286
|
+
<div class="gc-item-txt">and get these features:</div>
|
287
|
+
<div class="gc-item-details">
|
288
|
+
<div class="gc-item-img"><img src="/accounts/grandcentral/gvl.png" alt=""/></div>
|
289
|
+
<div class="gc-item-list">
|
290
|
+
<ul class="gc-signup-list">
|
291
|
+
<li><b>Transcribed voicemail</b> online</li>
|
292
|
+
<li>Low cost <b>international calls</b></li>
|
293
|
+
<li><b>Custom greetings</b> for callers</li>
|
294
|
+
</ul>
|
295
|
+
</div>
|
296
|
+
</div>
|
297
|
+
</td>
|
298
|
+
<td style="padding-left: 8px;">
|
299
|
+
<div class="gc-item-hd">Get a Google number</div>
|
300
|
+
<div class="gc-item-txt">and get these additional features:</div>
|
301
|
+
<div class="gc-item-details">
|
302
|
+
<div class="gc-item-img"><img src="/accounts/grandcentral/gv.png" alt=""/></div>
|
303
|
+
<div class="gc-item-list">
|
304
|
+
<ul class="gc-signup-list">
|
305
|
+
<li><b>One number</b> for all your phones</li>
|
306
|
+
<li>Get <b>SMS messages</b> via email</li>
|
307
|
+
<li><b>Block</b> unwanted callers</li>
|
308
|
+
</ul>
|
309
|
+
</div>
|
310
|
+
</div>
|
311
|
+
</td>
|
312
|
+
</tr>
|
313
|
+
</table>
|
314
|
+
<div class="gc-si-content">
|
315
|
+
<script><!--
|
316
|
+
|
317
|
+
function gaia_onLoginSubmit() {
|
318
|
+
|
319
|
+
|
320
|
+
if (window.gaiacb_onLoginSubmit) {
|
321
|
+
return gaiacb_onLoginSubmit();
|
322
|
+
} else {
|
323
|
+
return true;
|
324
|
+
}
|
325
|
+
|
326
|
+
}
|
327
|
+
|
328
|
+
|
329
|
+
function gaia_setFocus() {
|
330
|
+
var f = null;
|
331
|
+
if (document.getElementById) {
|
332
|
+
f = document.getElementById("gaia_loginform");
|
333
|
+
} else if (window.gaia_loginform) {
|
334
|
+
f = window.gaia_loginform;
|
335
|
+
}
|
336
|
+
if (f) {
|
337
|
+
if (f.Email && (f.Email.value == null || f.Email.value == "")) {
|
338
|
+
f.Email.focus();
|
339
|
+
} else if (f.Passwd) {
|
340
|
+
f.Passwd.focus();
|
341
|
+
}
|
342
|
+
}
|
343
|
+
}
|
344
|
+
--></script>
|
345
|
+
<style type="text/css"><!--
|
346
|
+
div.errormsg { color: red; font-size: smaller; font-family:arial,sans-serif; }
|
347
|
+
font.errormsg { color: red; font-size: smaller; font-family:arial,sans-serif; }
|
348
|
+
--></style>
|
349
|
+
<style type="text/css"><!--
|
350
|
+
.gaia.le.lbl { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
|
351
|
+
.gaia.le.fpwd { font-family: Arial, Helvetica, sans-serif; font-size: 70%; }
|
352
|
+
.gaia.le.chusr { font-family: Arial, Helvetica, sans-serif; font-size: 70%; }
|
353
|
+
.gaia.le.val { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
|
354
|
+
.gaia.le.button { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
|
355
|
+
.gaia.le.rem { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
|
356
|
+
|
357
|
+
.gaia.captchahtml.desc { font-family: arial, sans-serif; font-size: smaller; }
|
358
|
+
.gaia.captchahtml.cmt { font-family: arial, sans-serif; font-size: smaller; font-style: italic; }
|
359
|
+
|
360
|
+
--></style>
|
361
|
+
<form id="gaia_loginform"
|
362
|
+
|
363
|
+
action="https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral" method="post"
|
364
|
+
|
365
|
+
onsubmit=
|
366
|
+
"return(gaia_onLoginSubmit());"
|
367
|
+
>
|
368
|
+
<div id="gaia_loginbox">
|
369
|
+
<table class="form-noindent" cellspacing="3" cellpadding="5" width="100%" border="0">
|
370
|
+
<tr>
|
371
|
+
<td valign="top" style="text-align:center" nowrap="nowrap"
|
372
|
+
bgcolor="#e8eefa">
|
373
|
+
<input type="hidden" name="ltmpl"
|
374
|
+
value="bluebar">
|
375
|
+
<div class="loginBox">
|
376
|
+
<table id="gaia_table" align="center" border="0" cellpadding="1" cellspacing="0">
|
377
|
+
<tr>
|
378
|
+
<td colspan="2" align="center">
|
379
|
+
<font size="-1">
|
380
|
+
Sign in to
|
381
|
+
Google Voice
|
382
|
+
with your
|
383
|
+
</font>
|
384
|
+
<table>
|
385
|
+
<tr>
|
386
|
+
<td valign="top">
|
387
|
+
<img src="google_transparent.gif"
|
388
|
+
alt="Google">
|
389
|
+
</img>
|
390
|
+
</td>
|
391
|
+
<td valign="middle">
|
392
|
+
<font size="+0"><b>Account</b></font>
|
393
|
+
</td>
|
394
|
+
</tr>
|
395
|
+
</table>
|
396
|
+
</td>
|
397
|
+
</tr>
|
398
|
+
<script type="text/javascript"><!--
|
399
|
+
function onPreCreateAccount() {
|
400
|
+
|
401
|
+
return true;
|
402
|
+
|
403
|
+
}
|
404
|
+
|
405
|
+
function onPreLogin() {
|
406
|
+
|
407
|
+
|
408
|
+
if (window["onlogin"] != null) {
|
409
|
+
return onlogin();
|
410
|
+
} else {
|
411
|
+
return true;
|
412
|
+
}
|
413
|
+
|
414
|
+
}
|
415
|
+
--></script>
|
416
|
+
<tr>
|
417
|
+
<td colspan="2" align="center">
|
418
|
+
</td>
|
419
|
+
</tr>
|
420
|
+
<tr id="email-row">
|
421
|
+
<td nowrap="nowrap">
|
422
|
+
<div align="right">
|
423
|
+
<span class="gaia le lbl">
|
424
|
+
Email:
|
425
|
+
</span>
|
426
|
+
</div>
|
427
|
+
</td>
|
428
|
+
<td>
|
429
|
+
<input type="hidden" name="continue" id="continue"
|
430
|
+
value="https://www.google.com/voice/account/signin" />
|
431
|
+
<input type="hidden" name="service" id="service"
|
432
|
+
value="grandcentral" />
|
433
|
+
<input type="hidden" name="dsh" id="dsh"
|
434
|
+
value="42373325670724957" />
|
435
|
+
<input type="hidden" name="ltmpl" id="ltmpl"
|
436
|
+
value="bluebar" />
|
437
|
+
<input type="hidden" name="ltmpl" id="ltmpl"
|
438
|
+
value="bluebar" />
|
439
|
+
<input type="hidden"
|
440
|
+
name="GALX"
|
441
|
+
value="k0KpPxKzZJw" />
|
442
|
+
<input type="text" name="Email" id="Email"
|
443
|
+
size="18" value=""
|
444
|
+
|
445
|
+
|
446
|
+
class='gaia le val'
|
447
|
+
|
448
|
+
/>
|
449
|
+
</td>
|
450
|
+
</tr>
|
451
|
+
<tr>
|
452
|
+
<td></td>
|
453
|
+
<td align="left">
|
454
|
+
</td>
|
455
|
+
</tr>
|
456
|
+
<tr id="password-row" class="enabled">
|
457
|
+
<td align="right" nowrap="nowrap">
|
458
|
+
<span class="gaia le lbl">
|
459
|
+
Password:
|
460
|
+
</span>
|
461
|
+
</td>
|
462
|
+
<td>
|
463
|
+
<input type="password"
|
464
|
+
name="Passwd" id="Passwd"
|
465
|
+
size="18"
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
class="gaia le val"
|
471
|
+
|
472
|
+
/>
|
473
|
+
</td>
|
474
|
+
</tr>
|
475
|
+
<tr>
|
476
|
+
<td> </td>
|
477
|
+
<td align="left">
|
478
|
+
</td>
|
479
|
+
</tr>
|
480
|
+
<tr id="rememberme-row" class="enabled">
|
481
|
+
<td align="right" valign="top">
|
482
|
+
<input type="checkbox" name="PersistentCookie" id="PersistentCookie"
|
483
|
+
value="yes"
|
484
|
+
|
485
|
+
checked='checked'
|
486
|
+
|
487
|
+
/>
|
488
|
+
<input type="hidden" name='rmShown' value="1" />
|
489
|
+
</td>
|
490
|
+
<td>
|
491
|
+
<label for="PersistentCookie" id="PersistentCookieLabel" class="gaia le rem">
|
492
|
+
Stay signed in
|
493
|
+
</label>
|
494
|
+
</td>
|
495
|
+
</tr>
|
496
|
+
<tr>
|
497
|
+
<td>
|
498
|
+
</td>
|
499
|
+
<td align="left">
|
500
|
+
<input type="submit" class="gaia le button" name="signIn"
|
501
|
+
value="Sign in"
|
502
|
+
/>
|
503
|
+
</td>
|
504
|
+
</tr>
|
505
|
+
<tr id="ga-fprow">
|
506
|
+
<td colspan="2" height="33.0" class="gaia le fpwd"
|
507
|
+
align="center" valign="bottom">
|
508
|
+
<a href="http://www.google.com/support/accounts/bin/answer.py?answer=48598&hl=en&ctx=ch_ServiceLogin&p=grandcentral&fpUrl=https%3A%2F%2Fwww.google.com%2Faccounts%2FForgotPasswd%3FfpOnly%3D1%26continue%3Dhttps%253A%252F%252Fwww.google.com%252Fvoice%252Faccount%252Fsignin%26service%3Dgrandcentral%26ltmpl%3Dbluebar"
|
509
|
+
target=_top>
|
510
|
+
Can't access your account?
|
511
|
+
</a>
|
512
|
+
</td>
|
513
|
+
</tr>
|
514
|
+
</table>
|
515
|
+
</div>
|
516
|
+
</td>
|
517
|
+
</tr>
|
518
|
+
</table>
|
519
|
+
</div>
|
520
|
+
<input type="hidden" name="asts"
|
521
|
+
id="asts"
|
522
|
+
value="">
|
523
|
+
</form>
|
524
|
+
<form id="gaia_universallogin"
|
525
|
+
action="https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral" method="post"
|
526
|
+
onsubmit="return(gaia_onLoginSubmit());">
|
527
|
+
<input type="hidden" name="continue" id="continue"
|
528
|
+
value="https://www.google.com/voice/account/signin" />
|
529
|
+
<input type="hidden" name="service" id="service"
|
530
|
+
value="grandcentral" />
|
531
|
+
<input type="hidden" name="dsh" id="dsh"
|
532
|
+
value="42373325670724957" />
|
533
|
+
<input type="hidden" name="ltmpl" id="ltmpl"
|
534
|
+
value="bluebar" />
|
535
|
+
<input type="hidden" name="ltmpl" id="ltmpl"
|
536
|
+
value="bluebar" />
|
537
|
+
<input type="hidden" name="ltmpl" id="ltmpl"
|
538
|
+
value="bluebar" />
|
539
|
+
</form>
|
540
|
+
</div>
|
541
|
+
</div>
|
542
|
+
<div class="gc-mid" id="gc-more">
|
543
|
+
<a style="font-weight: bold; font-size: 13px;"
|
544
|
+
href="https://www.google.com/voice/about"
|
545
|
+
>See more features <span style="font-size: 16px;">»</span></a>
|
546
|
+
</div>
|
547
|
+
<div class="gc-mid" id="gc-signup-closed">
|
548
|
+
Google Voice is currently available by invite only.
|
549
|
+
<a href="https://services.google.com/fb/forms/googlevoiceinvite/" target="_blank">Request an invite</a>
|
550
|
+
</div>
|
551
|
+
<div id="gc-footer" class="gc-mid">
|
552
|
+
<div style="border-top: 1px solid #C3D9FF; margin: 0pt 3px; padding: 4px;">
|
553
|
+
<center>
|
554
|
+
<font color="#676767" size="-1">
|
555
|
+
©2010 Google
|
556
|
+
-
|
557
|
+
<a href='http://www.google.com/support/voice/'>Help</a>
|
558
|
+
-
|
559
|
+
<a href='https://www.google.com/voice/help'>Terms</a>
|
560
|
+
-
|
561
|
+
<a href='http://googlevoiceblog.blogspot.com/'>Blog</a>
|
562
|
+
</font>
|
563
|
+
</center>
|
564
|
+
</div>
|
565
|
+
</div>
|
566
|
+
</body>
|
567
|
+
</html>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.dirname(__FILE__) + "/test_helper"
|
3
|
+
require 'mocha'
|
4
|
+
|
5
|
+
class InboxParserTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@page_body = String.new(File.read(File.join(File.dirname(__FILE__), 'fixtures', 'inbox_fixture.html')))
|
9
|
+
@inbox_fixture = File.open(File.join(File.dirname(__FILE__), 'fixtures', 'inbox.yml')) { |yf| YAML::load(yf) }
|
10
|
+
@page_obj = mock()
|
11
|
+
@page_obj.stubs(:body_str).returns(@page_body)
|
12
|
+
end
|
13
|
+
|
14
|
+
should "return true" do
|
15
|
+
assert true
|
16
|
+
end
|
17
|
+
|
18
|
+
should "create instance variables" do
|
19
|
+
ibp = GvoiceRuby::InboxParser.new
|
20
|
+
assert_equal([], ibp.instance_variable_get(:@smss))
|
21
|
+
assert_equal([], ibp.instance_variable_get(:@voicemails))
|
22
|
+
end
|
23
|
+
|
24
|
+
should "parse the page" do
|
25
|
+
GvoiceRuby::Client.any_instance.stubs(:fetch_page).returns(true)
|
26
|
+
inbox = GvoiceRuby::InboxParser.new.parse_page(@page_obj)
|
27
|
+
assert_equal(Hash, inbox.class)
|
28
|
+
assert_equal(@inbox_fixture, inbox)
|
29
|
+
end
|
30
|
+
|
31
|
+
should "parse sms messages" do
|
32
|
+
GvoiceRuby::Client.any_instance.stubs(:fetch_page).returns(true)
|
33
|
+
parser = GvoiceRuby::InboxParser.new
|
34
|
+
inbox = parser.parse_page(@page_obj)
|
35
|
+
parser.parse_sms_messages(inbox['messages'])
|
36
|
+
assert_equal(parser.instance_variable_get(:@smss)[0].class, GvoiceRuby::Sms)
|
37
|
+
assert_equal(parser.instance_variable_get(:@voicemails), [])
|
38
|
+
# y parser.parse_sms_messages(inbox['messages'])
|
39
|
+
# y parser.instance_variable_get(:@smss)
|
40
|
+
end
|
41
|
+
|
42
|
+
should "parse voicemail messages" do
|
43
|
+
GvoiceRuby::Client.any_instance.stubs(:fetch_page).returns(true)
|
44
|
+
parser = GvoiceRuby::InboxParser.new
|
45
|
+
inbox = parser.parse_page(@page_obj)
|
46
|
+
parser.parse_voicemail_messages(inbox['messages'])
|
47
|
+
assert_equal(parser.instance_variable_get(:@voicemails)[0].class, GvoiceRuby::Voicemail)
|
48
|
+
assert_equal(parser.instance_variable_get(:@smss), [])
|
49
|
+
# y parser.parse_sms_messages(inbox['messages'])
|
50
|
+
# y parser.instance_variable_get(:@smss)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'test/unit'
|
3
|
+
begin
|
4
|
+
require 'shoulda'
|
5
|
+
rescue LoadError
|
6
|
+
warn "\nYou need to run 'bundle exec rake test' in order to avoid load errors.\n"
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'gvoice-ruby'
|
10
|
+
|
11
|
+
class Test::Unit::TestCase
|
12
|
+
|
13
|
+
# def config_file
|
14
|
+
# File.join(File.dirname(__FILE__), 'fixtures', 'config_fixture.yml')
|
15
|
+
# end unless method_defined?(:config_file)
|
16
|
+
|
17
|
+
def deny(*args)
|
18
|
+
args.each { |arg| assert !arg }
|
19
|
+
end
|
20
|
+
end
|