google-authsub 0.0.4
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/.gitignore +1 -0
- data/MIT-LICENSE +20 -0
- data/README +98 -0
- data/Rakefile +19 -0
- data/VERSION +1 -0
- data/coverage/-Library-Ruby-Gems-1_8-gems-FakeWeb-1_1_2-lib-fake_net_http_rb.html +679 -0
- data/coverage/-Library-Ruby-Gems-1_8-gems-FakeWeb-1_1_2-lib-fake_web_rb.html +843 -0
- data/coverage/-Library-Ruby-Gems-1_8-gems-rcov-0_8_1_2_0-lib-rcov_rb.html +1598 -0
- data/coverage/index.html +360 -0
- data/coverage/lib-googleauthsub_rb.html +877 -0
- data/coverage/spec-googleauthsub_spec_rb.html +950 -0
- data/coverage/spec-spec_helper_rb.html +640 -0
- data/doc/classes/AuthEchoServlet.html +152 -0
- data/doc/classes/AuthEchoServlet.src/M000001.html +20 -0
- data/doc/classes/AuthEchoServlet.src/M000002.html +18 -0
- data/doc/classes/GData/AuthSubError.html +139 -0
- data/doc/classes/GData/AuthSubError.src/M000019.html +18 -0
- data/doc/classes/GData/Error.html +111 -0
- data/doc/classes/GData/GoogleAuthSub.html +521 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000001.html +29 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000002.html +22 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000003.html +29 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000004.html +22 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000005.html +24 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000006.html +19 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000007.html +18 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000008.html +18 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000009.html +24 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000010.html +25 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000011.html +30 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000012.html +18 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000013.html +18 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000014.html +18 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000015.html +18 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000016.html +20 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000017.html +20 -0
- data/doc/classes/GData/GoogleAuthSub.src/M000018.html +19 -0
- data/doc/classes/GData.html +162 -0
- data/doc/created.rid +1 -0
- data/doc/files/googleauthsub_rb.html +140 -0
- data/doc/files/lib/googleauthsub_rb.html +140 -0
- data/doc/files/spec/googleauthsub_spec_rb.html +146 -0
- data/doc/files/spec/googleresponder_rb.html +121 -0
- data/doc/files/spec/spec_helper_rb.html +149 -0
- data/doc/fr_class_index.html +31 -0
- data/doc/fr_file_index.html +30 -0
- data/doc/fr_method_index.html +45 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/google-authsub-0.0.2.gem +0 -0
- data/google-authsub-0.0.3.gem +0 -0
- data/google-authsub.gemspec +109 -0
- data/lib/googleauthsub.rb +271 -0
- data/live test/authsub_test.html +40 -0
- data/live test/gastest.rb +90 -0
- data/spec/googleauthsub_spec.rb +350 -0
- data/spec/googleresponder.rb +26 -0
- data/spec/mock responses/bad_token_info.txt +11 -0
- data/spec/mock responses/calendar.txt +11 -0
- data/spec/mock responses/revoke_token.txt +7 -0
- data/spec/mock responses/revoked_token.txt +17 -0
- data/spec/mock responses/session_token.txt +9 -0
- data/spec/mock responses/token_info.txt +11 -0
- data/spec/mock responses/unauthorized.txt +18 -0
- data/spec/mock_certs/test_private_key.pem +15 -0
- data/spec/mock_certs/test_public_key.pem +6 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/spec_opts +7 -0
- metadata +125 -0
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.DS_Store
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2008-2009 Stuart Coyle
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
GoogleAuthSub
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
NOTE: This is still in very alpha stages of development.
|
|
5
|
+
It passes all the mocked specs but has no live testing specs yet.
|
|
6
|
+
|
|
7
|
+
Overview:
|
|
8
|
+
|
|
9
|
+
The GoogleAuthSub class handles interaction with Google via the
|
|
10
|
+
Account Authentication API (AuthSub). This is for web applications to get data from
|
|
11
|
+
Google with the user signing in.
|
|
12
|
+
|
|
13
|
+
For details on the Account Authentication API refer to:
|
|
14
|
+
http://code.google.com/apis/accounts/docs/AuthForWebApps.html
|
|
15
|
+
|
|
16
|
+
The Google Group can provide some help also:
|
|
17
|
+
http://groups.google.com/group/Google-Accounts-API
|
|
18
|
+
|
|
19
|
+
The OAuth protocol has taken over much of the role of Authsub.
|
|
20
|
+
Oauth does not provide access to non registered apps as Authsub does.
|
|
21
|
+
|
|
22
|
+
Requirements:
|
|
23
|
+
For testing you will need the rspec and fake_web gems
|
|
24
|
+
|
|
25
|
+
To use:
|
|
26
|
+
|
|
27
|
+
Non-signed access, single request.
|
|
28
|
+
1. Create your GoogleAuthSub object.
|
|
29
|
+
auth = GoogleAuthSub.new(:next_url => "www.example.com/next",
|
|
30
|
+
:scope_url => "http://www.google.com/calendar/feeds")
|
|
31
|
+
|
|
32
|
+
2. Redirect the user to the Google sign in page. request_url gives us the correct url to go to.
|
|
33
|
+
In rails:
|
|
34
|
+
redirect_to auth.request_url
|
|
35
|
+
|
|
36
|
+
3. Once the user has successfully logged in they will then be redirected back to the url specified
|
|
37
|
+
as the :next_url in step 1. In the handler for this the token needs to be extracted.
|
|
38
|
+
To do this call:
|
|
39
|
+
auth.receive_token(url)
|
|
40
|
+
or in rails just do:
|
|
41
|
+
auth.token=params[:token]
|
|
42
|
+
|
|
43
|
+
4. Now everything should be set to make a single request with:
|
|
44
|
+
auth.get(url), auth.post(url), auth.put(url) or auth.delete(url)
|
|
45
|
+
The url will automagically have the :scope_url prepended to it if not included.
|
|
46
|
+
These calls return a Net::HTTPResponse object
|
|
47
|
+
|
|
48
|
+
Once a request has been made the token will no longer be valid and you will have to start from step 2 in
|
|
49
|
+
order to make another request.
|
|
50
|
+
|
|
51
|
+
Non-signed access with session token.
|
|
52
|
+
1. Create your GoogleAuthSub object with :session => true.
|
|
53
|
+
auth = GoogleAuthSub.new(:next_url => "www.example.com/next",
|
|
54
|
+
:scope_url => "http://www.google.com/calendar/feeds",
|
|
55
|
+
:session => true)
|
|
56
|
+
|
|
57
|
+
2,3 as per previous example
|
|
58
|
+
|
|
59
|
+
4. Exchange the single use token for a session token.
|
|
60
|
+
auth.request_session_token
|
|
61
|
+
NOTE: this has changed from the previous version, which was confusingly named session_token.
|
|
62
|
+
|
|
63
|
+
5. Make requests with auth.get and auth.put.
|
|
64
|
+
|
|
65
|
+
Secure access with session token.
|
|
66
|
+
0. Call GoogleAuthSub.set_private_key(key)
|
|
67
|
+
key can be a certificate file, string or OpenSSL::Pkey::RSA object.
|
|
68
|
+
This should be the key that the site has registered with Goggle.
|
|
69
|
+
For details on the registration process see:
|
|
70
|
+
http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html
|
|
71
|
+
|
|
72
|
+
1. Create your GoogleAuthSub object with :session => true.
|
|
73
|
+
auth = GoogleAuthSub.new(:next_url => "www.example.com/next",
|
|
74
|
+
:scope_url => "http://www.google.com/calendar/feeds",
|
|
75
|
+
:session => true, :secure=>true)
|
|
76
|
+
|
|
77
|
+
2,3,4,5 as per previous examples
|
|
78
|
+
|
|
79
|
+
The private key is stored as a class variable so there is one instance per app.
|
|
80
|
+
|
|
81
|
+
Tokens can be revoked with:
|
|
82
|
+
auth.revoke_token
|
|
83
|
+
|
|
84
|
+
Token information can be received from Google with:
|
|
85
|
+
auth.token_info
|
|
86
|
+
This returns a hash with the keys: :target, :scope and :secure
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
TODO:
|
|
90
|
+
Live tests. Currently getting errors with encrypted tokens.
|
|
91
|
+
Storage of session tokens: ActiveRecord
|
|
92
|
+
Encryption of tokens.
|
|
93
|
+
Session token revocation
|
|
94
|
+
Rails plugin
|
|
95
|
+
|
|
96
|
+
Contact the author via stuart.coyle@gmail.com
|
|
97
|
+
|
|
98
|
+
Copyright (c) 2008-2009 Stuart Coyle, released under the MIT license
|
data/Rakefile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake'
|
|
3
|
+
|
|
4
|
+
begin
|
|
5
|
+
require 'jeweler'
|
|
6
|
+
Jeweler::Tasks.new do |gemspec|
|
|
7
|
+
gemspec.name = "google-authsub"
|
|
8
|
+
gemspec.summary = "A ruby implementation of Google Authentication for Web Applications API"
|
|
9
|
+
gemspec.description = "GoogleAuthSub provides the Google Authentications for Web Applications API."
|
|
10
|
+
gemspec.email = "stuart.coyle@gmail.com"
|
|
11
|
+
gemspec.homepage = "http://github.com/stuart/google-authsub/tree/master"
|
|
12
|
+
gemspec.authors = ["Stuart Coyle", "Jesse Storimer"]
|
|
13
|
+
end
|
|
14
|
+
Jeweler::GemcutterTasks.new
|
|
15
|
+
rescue LoadError
|
|
16
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.4
|
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
|
+
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>/Library/Ruby/Gems/1.8/gems/FakeWeb-1.1.2/lib/fake_net_http.rb - C0 code coverage information</title>
|
|
3
|
+
<style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
|
|
4
|
+
<style type='text/css'>span.cross-ref-title {
|
|
5
|
+
font-size: 140%;
|
|
6
|
+
}
|
|
7
|
+
span.cross-ref a {
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
}
|
|
10
|
+
span.cross-ref {
|
|
11
|
+
background-color:#f3f7fa;
|
|
12
|
+
border: 1px dashed #333;
|
|
13
|
+
margin: 1em;
|
|
14
|
+
padding: 0.5em;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
a.crossref-toggle {
|
|
18
|
+
text-decoration: none;
|
|
19
|
+
}
|
|
20
|
+
span.marked0 {
|
|
21
|
+
background-color: rgb(185, 210, 200);
|
|
22
|
+
display: block;
|
|
23
|
+
}
|
|
24
|
+
span.marked1 {
|
|
25
|
+
background-color: rgb(190, 215, 205);
|
|
26
|
+
display: block;
|
|
27
|
+
}
|
|
28
|
+
span.inferred0 {
|
|
29
|
+
background-color: rgb(175, 200, 200);
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
span.inferred1 {
|
|
33
|
+
background-color: rgb(180, 205, 205);
|
|
34
|
+
display: block;
|
|
35
|
+
}
|
|
36
|
+
span.uncovered0 {
|
|
37
|
+
background-color: rgb(225, 110, 110);
|
|
38
|
+
display: block;
|
|
39
|
+
}
|
|
40
|
+
span.uncovered1 {
|
|
41
|
+
background-color: rgb(235, 120, 120);
|
|
42
|
+
display: block;
|
|
43
|
+
}
|
|
44
|
+
span.overview {
|
|
45
|
+
border-bottom: 8px solid black;
|
|
46
|
+
}
|
|
47
|
+
div.overview {
|
|
48
|
+
border-bottom: 8px solid black;
|
|
49
|
+
}
|
|
50
|
+
body {
|
|
51
|
+
font-family: verdana, arial, helvetica;
|
|
52
|
+
}
|
|
53
|
+
div.footer {
|
|
54
|
+
font-size: 68%;
|
|
55
|
+
margin-top: 1.5em;
|
|
56
|
+
}
|
|
57
|
+
h1, h2, h3, h4, h5, h6 {
|
|
58
|
+
margin-bottom: 0.5em;
|
|
59
|
+
}
|
|
60
|
+
h5 {
|
|
61
|
+
margin-top: 0.5em;
|
|
62
|
+
}
|
|
63
|
+
.hidden {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
div.separator {
|
|
67
|
+
height: 10px;
|
|
68
|
+
}
|
|
69
|
+
/* Commented out for better readability, esp. on IE */
|
|
70
|
+
/*
|
|
71
|
+
table tr td, table tr th {
|
|
72
|
+
font-size: 68%;
|
|
73
|
+
}
|
|
74
|
+
td.value table tr td {
|
|
75
|
+
font-size: 11px;
|
|
76
|
+
}
|
|
77
|
+
*/
|
|
78
|
+
table.percent_graph {
|
|
79
|
+
height: 12px;
|
|
80
|
+
border: #808080 1px solid;
|
|
81
|
+
empty-cells: show;
|
|
82
|
+
}
|
|
83
|
+
table.percent_graph td.covered {
|
|
84
|
+
height: 10px;
|
|
85
|
+
background: #00f000;
|
|
86
|
+
}
|
|
87
|
+
table.percent_graph td.uncovered {
|
|
88
|
+
height: 10px;
|
|
89
|
+
background: #e00000;
|
|
90
|
+
}
|
|
91
|
+
table.percent_graph td.NA {
|
|
92
|
+
height: 10px;
|
|
93
|
+
background: #eaeaea;
|
|
94
|
+
}
|
|
95
|
+
table.report {
|
|
96
|
+
border-collapse: collapse;
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
table.report td.heading {
|
|
100
|
+
background: #dcecff;
|
|
101
|
+
border: #d0d0d0 1px solid;
|
|
102
|
+
font-weight: bold;
|
|
103
|
+
text-align: center;
|
|
104
|
+
}
|
|
105
|
+
table.report td.heading:hover {
|
|
106
|
+
background: #c0ffc0;
|
|
107
|
+
}
|
|
108
|
+
table.report td.text {
|
|
109
|
+
border: #d0d0d0 1px solid;
|
|
110
|
+
}
|
|
111
|
+
table.report td.value,
|
|
112
|
+
table.report td.lines_total,
|
|
113
|
+
table.report td.lines_code {
|
|
114
|
+
text-align: right;
|
|
115
|
+
border: #d0d0d0 1px solid;
|
|
116
|
+
}
|
|
117
|
+
table.report tr.light {
|
|
118
|
+
background-color: rgb(240, 240, 245);
|
|
119
|
+
}
|
|
120
|
+
table.report tr.dark {
|
|
121
|
+
background-color: rgb(230, 230, 235);
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
124
|
+
<script type='text/javascript'>
|
|
125
|
+
// <![CDATA[
|
|
126
|
+
function toggleCode( id ) {
|
|
127
|
+
if ( document.getElementById )
|
|
128
|
+
elem = document.getElementById( id );
|
|
129
|
+
else if ( document.all )
|
|
130
|
+
elem = eval( "document.all." + id );
|
|
131
|
+
else
|
|
132
|
+
return false;
|
|
133
|
+
|
|
134
|
+
elemStyle = elem.style;
|
|
135
|
+
|
|
136
|
+
if ( elemStyle.display != "block" ) {
|
|
137
|
+
elemStyle.display = "block"
|
|
138
|
+
} else {
|
|
139
|
+
elemStyle.display = "none"
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Make cross-references hidden by default
|
|
146
|
+
document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
|
|
147
|
+
// ]]>
|
|
148
|
+
</script>
|
|
149
|
+
<style type='text/css'>span.run0 {
|
|
150
|
+
background-color: rgb(178, 204, 255);
|
|
151
|
+
display: block;
|
|
152
|
+
}
|
|
153
|
+
span.run1 {
|
|
154
|
+
background-color: rgb(178, 206, 255);
|
|
155
|
+
display: block;
|
|
156
|
+
}
|
|
157
|
+
span.run2 {
|
|
158
|
+
background-color: rgb(178, 209, 255);
|
|
159
|
+
display: block;
|
|
160
|
+
}
|
|
161
|
+
span.run3 {
|
|
162
|
+
background-color: rgb(178, 211, 255);
|
|
163
|
+
display: block;
|
|
164
|
+
}
|
|
165
|
+
span.run4 {
|
|
166
|
+
background-color: rgb(178, 214, 255);
|
|
167
|
+
display: block;
|
|
168
|
+
}
|
|
169
|
+
span.run5 {
|
|
170
|
+
background-color: rgb(178, 218, 255);
|
|
171
|
+
display: block;
|
|
172
|
+
}
|
|
173
|
+
span.run6 {
|
|
174
|
+
background-color: rgb(178, 220, 255);
|
|
175
|
+
display: block;
|
|
176
|
+
}
|
|
177
|
+
span.run7 {
|
|
178
|
+
background-color: rgb(178, 223, 255);
|
|
179
|
+
display: block;
|
|
180
|
+
}
|
|
181
|
+
span.run8 {
|
|
182
|
+
background-color: rgb(178, 225, 255);
|
|
183
|
+
display: block;
|
|
184
|
+
}
|
|
185
|
+
span.run9 {
|
|
186
|
+
background-color: rgb(178, 228, 255);
|
|
187
|
+
display: block;
|
|
188
|
+
}
|
|
189
|
+
span.run10 {
|
|
190
|
+
background-color: rgb(178, 232, 255);
|
|
191
|
+
display: block;
|
|
192
|
+
}
|
|
193
|
+
span.run11 {
|
|
194
|
+
background-color: rgb(178, 234, 255);
|
|
195
|
+
display: block;
|
|
196
|
+
}
|
|
197
|
+
span.run12 {
|
|
198
|
+
background-color: rgb(178, 237, 255);
|
|
199
|
+
display: block;
|
|
200
|
+
}
|
|
201
|
+
span.run13 {
|
|
202
|
+
background-color: rgb(178, 239, 255);
|
|
203
|
+
display: block;
|
|
204
|
+
}
|
|
205
|
+
span.run14 {
|
|
206
|
+
background-color: rgb(178, 242, 255);
|
|
207
|
+
display: block;
|
|
208
|
+
}
|
|
209
|
+
span.run15 {
|
|
210
|
+
background-color: rgb(178, 246, 255);
|
|
211
|
+
display: block;
|
|
212
|
+
}
|
|
213
|
+
span.run16 {
|
|
214
|
+
background-color: rgb(178, 248, 255);
|
|
215
|
+
display: block;
|
|
216
|
+
}
|
|
217
|
+
span.run17 {
|
|
218
|
+
background-color: rgb(178, 251, 255);
|
|
219
|
+
display: block;
|
|
220
|
+
}
|
|
221
|
+
span.run18 {
|
|
222
|
+
background-color: rgb(178, 253, 255);
|
|
223
|
+
display: block;
|
|
224
|
+
}
|
|
225
|
+
span.run19 {
|
|
226
|
+
background-color: rgb(178, 255, 253);
|
|
227
|
+
display: block;
|
|
228
|
+
}
|
|
229
|
+
span.run20 {
|
|
230
|
+
background-color: rgb(178, 255, 249);
|
|
231
|
+
display: block;
|
|
232
|
+
}
|
|
233
|
+
span.run21 {
|
|
234
|
+
background-color: rgb(178, 255, 247);
|
|
235
|
+
display: block;
|
|
236
|
+
}
|
|
237
|
+
span.run22 {
|
|
238
|
+
background-color: rgb(178, 255, 244);
|
|
239
|
+
display: block;
|
|
240
|
+
}
|
|
241
|
+
span.run23 {
|
|
242
|
+
background-color: rgb(178, 255, 242);
|
|
243
|
+
display: block;
|
|
244
|
+
}
|
|
245
|
+
span.run24 {
|
|
246
|
+
background-color: rgb(178, 255, 239);
|
|
247
|
+
display: block;
|
|
248
|
+
}
|
|
249
|
+
span.run25 {
|
|
250
|
+
background-color: rgb(178, 255, 235);
|
|
251
|
+
display: block;
|
|
252
|
+
}
|
|
253
|
+
span.run26 {
|
|
254
|
+
background-color: rgb(178, 255, 233);
|
|
255
|
+
display: block;
|
|
256
|
+
}
|
|
257
|
+
span.run27 {
|
|
258
|
+
background-color: rgb(178, 255, 230);
|
|
259
|
+
display: block;
|
|
260
|
+
}
|
|
261
|
+
span.run28 {
|
|
262
|
+
background-color: rgb(178, 255, 228);
|
|
263
|
+
display: block;
|
|
264
|
+
}
|
|
265
|
+
span.run29 {
|
|
266
|
+
background-color: rgb(178, 255, 225);
|
|
267
|
+
display: block;
|
|
268
|
+
}
|
|
269
|
+
span.run30 {
|
|
270
|
+
background-color: rgb(178, 255, 221);
|
|
271
|
+
display: block;
|
|
272
|
+
}
|
|
273
|
+
span.run31 {
|
|
274
|
+
background-color: rgb(178, 255, 219);
|
|
275
|
+
display: block;
|
|
276
|
+
}
|
|
277
|
+
span.run32 {
|
|
278
|
+
background-color: rgb(178, 255, 216);
|
|
279
|
+
display: block;
|
|
280
|
+
}
|
|
281
|
+
span.run33 {
|
|
282
|
+
background-color: rgb(178, 255, 214);
|
|
283
|
+
display: block;
|
|
284
|
+
}
|
|
285
|
+
span.run34 {
|
|
286
|
+
background-color: rgb(178, 255, 211);
|
|
287
|
+
display: block;
|
|
288
|
+
}
|
|
289
|
+
span.run35 {
|
|
290
|
+
background-color: rgb(178, 255, 207);
|
|
291
|
+
display: block;
|
|
292
|
+
}
|
|
293
|
+
span.run36 {
|
|
294
|
+
background-color: rgb(178, 255, 205);
|
|
295
|
+
display: block;
|
|
296
|
+
}
|
|
297
|
+
span.run37 {
|
|
298
|
+
background-color: rgb(178, 255, 202);
|
|
299
|
+
display: block;
|
|
300
|
+
}
|
|
301
|
+
span.run38 {
|
|
302
|
+
background-color: rgb(178, 255, 200);
|
|
303
|
+
display: block;
|
|
304
|
+
}
|
|
305
|
+
span.run39 {
|
|
306
|
+
background-color: rgb(178, 255, 197);
|
|
307
|
+
display: block;
|
|
308
|
+
}
|
|
309
|
+
span.run40 {
|
|
310
|
+
background-color: rgb(178, 255, 193);
|
|
311
|
+
display: block;
|
|
312
|
+
}
|
|
313
|
+
span.run41 {
|
|
314
|
+
background-color: rgb(178, 255, 191);
|
|
315
|
+
display: block;
|
|
316
|
+
}
|
|
317
|
+
span.run42 {
|
|
318
|
+
background-color: rgb(178, 255, 188);
|
|
319
|
+
display: block;
|
|
320
|
+
}
|
|
321
|
+
span.run43 {
|
|
322
|
+
background-color: rgb(178, 255, 186);
|
|
323
|
+
display: block;
|
|
324
|
+
}
|
|
325
|
+
span.run44 {
|
|
326
|
+
background-color: rgb(178, 255, 183);
|
|
327
|
+
display: block;
|
|
328
|
+
}
|
|
329
|
+
span.run45 {
|
|
330
|
+
background-color: rgb(178, 255, 179);
|
|
331
|
+
display: block;
|
|
332
|
+
}
|
|
333
|
+
span.run46 {
|
|
334
|
+
background-color: rgb(179, 255, 178);
|
|
335
|
+
display: block;
|
|
336
|
+
}
|
|
337
|
+
span.run47 {
|
|
338
|
+
background-color: rgb(182, 255, 178);
|
|
339
|
+
display: block;
|
|
340
|
+
}
|
|
341
|
+
span.run48 {
|
|
342
|
+
background-color: rgb(184, 255, 178);
|
|
343
|
+
display: block;
|
|
344
|
+
}
|
|
345
|
+
span.run49 {
|
|
346
|
+
background-color: rgb(187, 255, 178);
|
|
347
|
+
display: block;
|
|
348
|
+
}
|
|
349
|
+
span.run50 {
|
|
350
|
+
background-color: rgb(191, 255, 178);
|
|
351
|
+
display: block;
|
|
352
|
+
}
|
|
353
|
+
span.run51 {
|
|
354
|
+
background-color: rgb(193, 255, 178);
|
|
355
|
+
display: block;
|
|
356
|
+
}
|
|
357
|
+
span.run52 {
|
|
358
|
+
background-color: rgb(196, 255, 178);
|
|
359
|
+
display: block;
|
|
360
|
+
}
|
|
361
|
+
span.run53 {
|
|
362
|
+
background-color: rgb(198, 255, 178);
|
|
363
|
+
display: block;
|
|
364
|
+
}
|
|
365
|
+
span.run54 {
|
|
366
|
+
background-color: rgb(201, 255, 178);
|
|
367
|
+
display: block;
|
|
368
|
+
}
|
|
369
|
+
span.run55 {
|
|
370
|
+
background-color: rgb(205, 255, 178);
|
|
371
|
+
display: block;
|
|
372
|
+
}
|
|
373
|
+
span.run56 {
|
|
374
|
+
background-color: rgb(207, 255, 178);
|
|
375
|
+
display: block;
|
|
376
|
+
}
|
|
377
|
+
span.run57 {
|
|
378
|
+
background-color: rgb(210, 255, 178);
|
|
379
|
+
display: block;
|
|
380
|
+
}
|
|
381
|
+
span.run58 {
|
|
382
|
+
background-color: rgb(212, 255, 178);
|
|
383
|
+
display: block;
|
|
384
|
+
}
|
|
385
|
+
span.run59 {
|
|
386
|
+
background-color: rgb(215, 255, 178);
|
|
387
|
+
display: block;
|
|
388
|
+
}
|
|
389
|
+
span.run60 {
|
|
390
|
+
background-color: rgb(219, 255, 178);
|
|
391
|
+
display: block;
|
|
392
|
+
}
|
|
393
|
+
span.run61 {
|
|
394
|
+
background-color: rgb(221, 255, 178);
|
|
395
|
+
display: block;
|
|
396
|
+
}
|
|
397
|
+
span.run62 {
|
|
398
|
+
background-color: rgb(224, 255, 178);
|
|
399
|
+
display: block;
|
|
400
|
+
}
|
|
401
|
+
span.run63 {
|
|
402
|
+
background-color: rgb(226, 255, 178);
|
|
403
|
+
display: block;
|
|
404
|
+
}
|
|
405
|
+
span.run64 {
|
|
406
|
+
background-color: rgb(229, 255, 178);
|
|
407
|
+
display: block;
|
|
408
|
+
}
|
|
409
|
+
span.run65 {
|
|
410
|
+
background-color: rgb(233, 255, 178);
|
|
411
|
+
display: block;
|
|
412
|
+
}
|
|
413
|
+
span.run66 {
|
|
414
|
+
background-color: rgb(235, 255, 178);
|
|
415
|
+
display: block;
|
|
416
|
+
}
|
|
417
|
+
span.run67 {
|
|
418
|
+
background-color: rgb(238, 255, 178);
|
|
419
|
+
display: block;
|
|
420
|
+
}
|
|
421
|
+
span.run68 {
|
|
422
|
+
background-color: rgb(240, 255, 178);
|
|
423
|
+
display: block;
|
|
424
|
+
}
|
|
425
|
+
span.run69 {
|
|
426
|
+
background-color: rgb(243, 255, 178);
|
|
427
|
+
display: block;
|
|
428
|
+
}
|
|
429
|
+
span.run70 {
|
|
430
|
+
background-color: rgb(247, 255, 178);
|
|
431
|
+
display: block;
|
|
432
|
+
}
|
|
433
|
+
span.run71 {
|
|
434
|
+
background-color: rgb(249, 255, 178);
|
|
435
|
+
display: block;
|
|
436
|
+
}
|
|
437
|
+
span.run72 {
|
|
438
|
+
background-color: rgb(252, 255, 178);
|
|
439
|
+
display: block;
|
|
440
|
+
}
|
|
441
|
+
span.run73 {
|
|
442
|
+
background-color: rgb(255, 255, 178);
|
|
443
|
+
display: block;
|
|
444
|
+
}
|
|
445
|
+
span.run74 {
|
|
446
|
+
background-color: rgb(255, 252, 178);
|
|
447
|
+
display: block;
|
|
448
|
+
}
|
|
449
|
+
span.run75 {
|
|
450
|
+
background-color: rgb(255, 248, 178);
|
|
451
|
+
display: block;
|
|
452
|
+
}
|
|
453
|
+
span.run76 {
|
|
454
|
+
background-color: rgb(255, 246, 178);
|
|
455
|
+
display: block;
|
|
456
|
+
}
|
|
457
|
+
span.run77 {
|
|
458
|
+
background-color: rgb(255, 243, 178);
|
|
459
|
+
display: block;
|
|
460
|
+
}
|
|
461
|
+
span.run78 {
|
|
462
|
+
background-color: rgb(255, 240, 178);
|
|
463
|
+
display: block;
|
|
464
|
+
}
|
|
465
|
+
span.run79 {
|
|
466
|
+
background-color: rgb(255, 238, 178);
|
|
467
|
+
display: block;
|
|
468
|
+
}
|
|
469
|
+
span.run80 {
|
|
470
|
+
background-color: rgb(255, 234, 178);
|
|
471
|
+
display: block;
|
|
472
|
+
}
|
|
473
|
+
span.run81 {
|
|
474
|
+
background-color: rgb(255, 232, 178);
|
|
475
|
+
display: block;
|
|
476
|
+
}
|
|
477
|
+
span.run82 {
|
|
478
|
+
background-color: rgb(255, 229, 178);
|
|
479
|
+
display: block;
|
|
480
|
+
}
|
|
481
|
+
span.run83 {
|
|
482
|
+
background-color: rgb(255, 226, 178);
|
|
483
|
+
display: block;
|
|
484
|
+
}
|
|
485
|
+
span.run84 {
|
|
486
|
+
background-color: rgb(255, 224, 178);
|
|
487
|
+
display: block;
|
|
488
|
+
}
|
|
489
|
+
span.run85 {
|
|
490
|
+
background-color: rgb(255, 220, 178);
|
|
491
|
+
display: block;
|
|
492
|
+
}
|
|
493
|
+
span.run86 {
|
|
494
|
+
background-color: rgb(255, 218, 178);
|
|
495
|
+
display: block;
|
|
496
|
+
}
|
|
497
|
+
span.run87 {
|
|
498
|
+
background-color: rgb(255, 215, 178);
|
|
499
|
+
display: block;
|
|
500
|
+
}
|
|
501
|
+
span.run88 {
|
|
502
|
+
background-color: rgb(255, 212, 178);
|
|
503
|
+
display: block;
|
|
504
|
+
}
|
|
505
|
+
span.run89 {
|
|
506
|
+
background-color: rgb(255, 210, 178);
|
|
507
|
+
display: block;
|
|
508
|
+
}
|
|
509
|
+
span.run90 {
|
|
510
|
+
background-color: rgb(255, 206, 178);
|
|
511
|
+
display: block;
|
|
512
|
+
}
|
|
513
|
+
span.run91 {
|
|
514
|
+
background-color: rgb(255, 204, 178);
|
|
515
|
+
display: block;
|
|
516
|
+
}
|
|
517
|
+
span.run92 {
|
|
518
|
+
background-color: rgb(255, 201, 178);
|
|
519
|
+
display: block;
|
|
520
|
+
}
|
|
521
|
+
span.run93 {
|
|
522
|
+
background-color: rgb(255, 198, 178);
|
|
523
|
+
display: block;
|
|
524
|
+
}
|
|
525
|
+
span.run94 {
|
|
526
|
+
background-color: rgb(255, 196, 178);
|
|
527
|
+
display: block;
|
|
528
|
+
}
|
|
529
|
+
span.run95 {
|
|
530
|
+
background-color: rgb(255, 192, 178);
|
|
531
|
+
display: block;
|
|
532
|
+
}
|
|
533
|
+
span.run96 {
|
|
534
|
+
background-color: rgb(255, 189, 178);
|
|
535
|
+
display: block;
|
|
536
|
+
}
|
|
537
|
+
span.run97 {
|
|
538
|
+
background-color: rgb(255, 187, 178);
|
|
539
|
+
display: block;
|
|
540
|
+
}
|
|
541
|
+
span.run98 {
|
|
542
|
+
background-color: rgb(255, 184, 178);
|
|
543
|
+
display: block;
|
|
544
|
+
}
|
|
545
|
+
span.run99 {
|
|
546
|
+
background-color: rgb(255, 182, 178);
|
|
547
|
+
display: block;
|
|
548
|
+
}
|
|
549
|
+
span.run100 {
|
|
550
|
+
background-color: rgb(255, 178, 178);
|
|
551
|
+
display: block;
|
|
552
|
+
}
|
|
553
|
+
</style>
|
|
554
|
+
</head>
|
|
555
|
+
<body><h3>C0 code coverage information</h3>
|
|
556
|
+
<p>Generated on Sat Jun 07 16:45:06 +1000 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
|
|
557
|
+
</p>
|
|
558
|
+
<hr/>
|
|
559
|
+
<pre><span class='marked0'>Code reported as executed by Ruby looks like this...
|
|
560
|
+
</span><span class='marked1'>and this: this line is also marked as covered.
|
|
561
|
+
</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this,
|
|
562
|
+
</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).
|
|
563
|
+
</span><span class='uncovered0'>Finally, here's a line marked as not executed.
|
|
564
|
+
</span></pre>
|
|
565
|
+
<table class='report'><thead><tr><td class='heading'>Name</td>
|
|
566
|
+
<td class='heading'>Total lines</td>
|
|
567
|
+
<td class='heading'>Lines of code</td>
|
|
568
|
+
<td class='heading'>Total coverage</td>
|
|
569
|
+
<td class='heading'>Code coverage</td>
|
|
570
|
+
</tr>
|
|
571
|
+
</thead>
|
|
572
|
+
<tbody><tr class='light'><td><a href='-Library-Ruby-Gems-1_8-gems-FakeWeb-1_1_2-lib-fake_net_http_rb.html'>/Library/Ruby/Gems/1.8/gems/FakeWeb-1.1.2/lib/fake_net_http.rb</a>
|
|
573
|
+
</td>
|
|
574
|
+
<td class='lines_total'><tt>69</tt>
|
|
575
|
+
</td>
|
|
576
|
+
<td class='lines_code'><tt>43</tt>
|
|
577
|
+
</td>
|
|
578
|
+
<td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>62.3%</tt>
|
|
579
|
+
</td>
|
|
580
|
+
<td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='62'/>
|
|
581
|
+
<td class='uncovered' width='38'/>
|
|
582
|
+
</tr>
|
|
583
|
+
</table>
|
|
584
|
+
</td>
|
|
585
|
+
</tr>
|
|
586
|
+
</table>
|
|
587
|
+
</td>
|
|
588
|
+
<td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>39.5%</tt>
|
|
589
|
+
</td>
|
|
590
|
+
<td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='40'/>
|
|
591
|
+
<td class='uncovered' width='60'/>
|
|
592
|
+
</tr>
|
|
593
|
+
</table>
|
|
594
|
+
</td>
|
|
595
|
+
</tr>
|
|
596
|
+
</table>
|
|
597
|
+
</td>
|
|
598
|
+
</tr>
|
|
599
|
+
</tbody>
|
|
600
|
+
</table>
|
|
601
|
+
<pre><span class="inferred1"><a name="line1"></a> 1 # FakeWeb - Ruby Helper for Faking Web Requests
|
|
602
|
+
</span><span class="inferred0"><a name="line2"></a> 2 # Copyright 2006 Blaine Cook <romeda@gmail.com>.
|
|
603
|
+
</span><span class="inferred1"><a name="line3"></a> 3 #
|
|
604
|
+
</span><span class="inferred0"><a name="line4"></a> 4 # FakeWeb is free software; you can redistribute it and/or modify
|
|
605
|
+
</span><span class="inferred1"><a name="line5"></a> 5 # it under the terms of the GNU General Public License as published by
|
|
606
|
+
</span><span class="inferred0"><a name="line6"></a> 6 # the Free Software Foundation; either version 2 of the License, or
|
|
607
|
+
</span><span class="inferred1"><a name="line7"></a> 7 # (at your option) any later version.
|
|
608
|
+
</span><span class="inferred0"><a name="line8"></a> 8 #
|
|
609
|
+
</span><span class="inferred1"><a name="line9"></a> 9 # FakeWeb is distributed in the hope that it will be useful,
|
|
610
|
+
</span><span class="inferred0"><a name="line10"></a>10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
611
|
+
</span><span class="inferred1"><a name="line11"></a>11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
612
|
+
</span><span class="inferred0"><a name="line12"></a>12 # GNU General Public License for more details.
|
|
613
|
+
</span><span class="inferred1"><a name="line13"></a>13 #
|
|
614
|
+
</span><span class="inferred0"><a name="line14"></a>14 # You should have received a copy of the GNU General Public License
|
|
615
|
+
</span><span class="inferred1"><a name="line15"></a>15 # along with FakeWeb; if not, write to the Free Software
|
|
616
|
+
</span><span class="inferred0"><a name="line16"></a>16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
617
|
+
</span><span class="inferred1"><a name="line17"></a>17
|
|
618
|
+
</span><span class="marked0"><a name="line18"></a>18 require 'net/http'
|
|
619
|
+
</span><span class="marked1"><a name="line19"></a>19 require 'net/https'
|
|
620
|
+
</span><span class="marked0"><a name="line20"></a>20 require 'stringio'
|
|
621
|
+
</span><span class="inferred1"><a name="line21"></a>21
|
|
622
|
+
</span><span class="marked0"><a name="line22"></a>22 module Net #:nodoc:
|
|
623
|
+
</span><span class="inferred1"><a name="line23"></a>23
|
|
624
|
+
</span><span class="marked0"><a name="line24"></a>24 class BufferedIO #:nodoc:
|
|
625
|
+
</span><span class="marked1"><a name="line25"></a>25 def initialize( io, debug_output = nil )
|
|
626
|
+
</span><span class="uncovered0"><a name="line26"></a>26 @debug_output = debug_output
|
|
627
|
+
</span><span class="uncovered1"><a name="line27"></a>27 @io = case io
|
|
628
|
+
</span><span class="uncovered0"><a name="line28"></a>28 when Socket, IO: io
|
|
629
|
+
</span><span class="uncovered1"><a name="line29"></a>29 when String
|
|
630
|
+
</span><span class="uncovered0"><a name="line30"></a>30 File.exists?(io) ? File.open(io, "r") : StringIO.new(io)
|
|
631
|
+
</span><span class="uncovered1"><a name="line31"></a>31 end
|
|
632
|
+
</span><span class="uncovered0"><a name="line32"></a>32 raise "Unable to create local socket" unless @io
|
|
633
|
+
</span><span class="uncovered1"><a name="line33"></a>33 connect
|
|
634
|
+
</span><span class="uncovered0"><a name="line34"></a>34 end
|
|
635
|
+
</span><span class="inferred1"><a name="line35"></a>35
|
|
636
|
+
</span><span class="marked0"><a name="line36"></a>36 def connect(*args)
|
|
637
|
+
</span><span class="uncovered1"><a name="line37"></a>37 @rbuf = ''
|
|
638
|
+
</span><span class="uncovered0"><a name="line38"></a>38 end
|
|
639
|
+
</span><span class="inferred1"><a name="line39"></a>39
|
|
640
|
+
</span><span class="marked0"><a name="line40"></a>40 def rbuf_fill
|
|
641
|
+
</span><span class="uncovered1"><a name="line41"></a>41 @rbuf << @io.sysread(1024)
|
|
642
|
+
</span><span class="uncovered0"><a name="line42"></a>42 end
|
|
643
|
+
</span><span class="uncovered1"><a name="line43"></a>43 end
|
|
644
|
+
</span><span class="inferred0"><a name="line44"></a>44
|
|
645
|
+
</span><span class="marked1"><a name="line45"></a>45 class HTTP #:nodoc:
|
|
646
|
+
</span><span class="inferred0"><a name="line46"></a>46
|
|
647
|
+
</span><span class="marked1"><a name="line47"></a>47 def HTTP.socket_type #:nodoc:
|
|
648
|
+
</span><span class="uncovered0"><a name="line48"></a>48 FakeWeb::SocketDelegator
|
|
649
|
+
</span><span class="uncovered1"><a name="line49"></a>49 end
|
|
650
|
+
</span><span class="inferred0"><a name="line50"></a>50
|
|
651
|
+
</span><span class="marked1"><a name="line51"></a>51 alias :original_net_http_request :request
|
|
652
|
+
</span><span class="marked0"><a name="line52"></a>52 alias :original_net_http_connect :connect
|
|
653
|
+
</span><span class="inferred1"><a name="line53"></a>53
|
|
654
|
+
</span><span class="marked0"><a name="line54"></a>54 def request(req, body = nil, &block)
|
|
655
|
+
</span><span class="uncovered1"><a name="line55"></a>55 prot = use_ssl ? "https" : "http"
|
|
656
|
+
</span><span class="uncovered0"><a name="line56"></a>56 uri = "#{prot}://#{self.address}#{req.path}"
|
|
657
|
+
</span><span class="uncovered1"><a name="line57"></a>57 if FakeWeb.registered_uri?(uri)
|
|
658
|
+
</span><span class="uncovered0"><a name="line58"></a>58 @socket = Net::HTTP.socket_type.new
|
|
659
|
+
</span><span class="uncovered1"><a name="line59"></a>59 return FakeWeb.response_for(uri, &block)
|
|
660
|
+
</span><span class="uncovered0"><a name="line60"></a>60 else
|
|
661
|
+
</span><span class="uncovered1"><a name="line61"></a>61 original_net_http_connect
|
|
662
|
+
</span><span class="uncovered0"><a name="line62"></a>62 return original_net_http_request(req, body, &block)
|
|
663
|
+
</span><span class="uncovered1"><a name="line63"></a>63 end
|
|
664
|
+
</span><span class="uncovered0"><a name="line64"></a>64 end
|
|
665
|
+
</span><span class="inferred1"><a name="line65"></a>65
|
|
666
|
+
</span><span class="marked0"><a name="line66"></a>66 def connect
|
|
667
|
+
</span><span class="inferred1"><a name="line67"></a>67 end
|
|
668
|
+
</span><span class="inferred0"><a name="line68"></a>68 end
|
|
669
|
+
</span><span class="inferred1"><a name="line69"></a>69 end
|
|
670
|
+
</span></pre><hr/>
|
|
671
|
+
<p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a>
|
|
672
|
+
version 0.8.1.2.</p>
|
|
673
|
+
<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/>
|
|
674
|
+
</a>
|
|
675
|
+
<a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/>
|
|
676
|
+
</a>
|
|
677
|
+
</p>
|
|
678
|
+
</body>
|
|
679
|
+
</html>
|