gdata_19 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.hgtags +5 -0
- data/LICENSE +202 -0
- data/README +97 -0
- data/Rakefile +82 -0
- data/VERSION +1 -0
- data/bin/test_captcha.rb +52 -0
- data/doc/classes/GData/Auth/AuthSub.html +349 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000020.html +29 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000021.html +29 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000022.html +31 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000023.html +29 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000024.html +32 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000025.html +26 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000026.html +29 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000038.html +28 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000039.html +29 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000040.html +31 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000041.html +29 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000042.html +32 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000043.html +28 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000044.html +29 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000045.html +31 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000046.html +28 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000047.html +28 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000048.html +29 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000049.html +31 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000050.html +28 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000051.html +31 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000052.html +25 -0
- data/doc/classes/GData/Auth/AuthSub.src/M000053.html +29 -0
- data/doc/classes/GData/Auth/ClientLogin.html +232 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000027.html +27 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000028.html +47 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000029.html +22 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000045.html +29 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000046.html +49 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000047.html +22 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000050.html +29 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000051.html +49 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000052.html +22 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000053.html +29 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000054.html +29 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000055.html +49 -0
- data/doc/classes/GData/Auth/ClientLogin.src/M000056.html +22 -0
- data/doc/classes/GData/Auth.html +133 -0
- data/doc/classes/GData/Client/Apps.html +146 -0
- data/doc/classes/GData/Client/Apps.src/M000027.html +19 -0
- data/doc/classes/GData/Client/Apps.src/M000028.html +19 -0
- data/doc/classes/GData/Client/AuthorizationError.html +113 -0
- data/doc/classes/GData/Client/BadRequestError.html +113 -0
- data/doc/classes/GData/Client/Base.html +453 -0
- data/doc/classes/GData/Client/Base.src/M000002.html +21 -0
- data/doc/classes/GData/Client/Base.src/M000003.html +55 -0
- data/doc/classes/GData/Client/Base.src/M000004.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000005.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000006.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000007.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000008.html +22 -0
- data/doc/classes/GData/Client/Base.src/M000009.html +26 -0
- data/doc/classes/GData/Client/Base.src/M000010.html +22 -0
- data/doc/classes/GData/Client/Base.src/M000011.html +25 -0
- data/doc/classes/GData/Client/Base.src/M000012.html +25 -0
- data/doc/classes/GData/Client/Base.src/M000013.html +33 -0
- data/doc/classes/GData/Client/Base.src/M000014.html +44 -0
- data/doc/classes/GData/Client/Base.src/M000015.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000016.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000017.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000018.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000019.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000020.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000021.html +25 -0
- data/doc/classes/GData/Client/Base.src/M000022.html +28 -0
- data/doc/classes/GData/Client/Base.src/M000023.html +22 -0
- data/doc/classes/GData/Client/Base.src/M000024.html +18 -0
- data/doc/classes/GData/Client/Base.src/M000025.html +22 -0
- data/doc/classes/GData/Client/Blogger.html +146 -0
- data/doc/classes/GData/Client/Blogger.src/M000002.html +20 -0
- data/doc/classes/GData/Client/BookSearch.html +146 -0
- data/doc/classes/GData/Client/BookSearch.src/M000010.html +20 -0
- data/doc/classes/GData/Client/BookSearch.src/M000011.html +20 -0
- data/doc/classes/GData/Client/Calendar.html +221 -0
- data/doc/classes/GData/Client/Calendar.src/M000030.html +20 -0
- data/doc/classes/GData/Client/Calendar.src/M000031.html +20 -0
- data/doc/classes/GData/Client/Calendar.src/M000032.html +19 -0
- data/doc/classes/GData/Client/Calendar.src/M000033.html +25 -0
- data/doc/classes/GData/Client/Calendar.src/M000034.html +21 -0
- data/doc/classes/GData/Client/CaptchaError.html +167 -0
- data/doc/classes/GData/Client/CaptchaError.src/M000001.html +19 -0
- data/doc/classes/GData/Client/CaptchaError.src/M000005.html +19 -0
- data/doc/classes/GData/Client/Contacts.html +146 -0
- data/doc/classes/GData/Client/Contacts.src/M000003.html +20 -0
- data/doc/classes/GData/Client/DocList.html +146 -0
- data/doc/classes/GData/Client/DocList.src/M000006.html +20 -0
- data/doc/classes/GData/Client/DocList.src/M000007.html +20 -0
- data/doc/classes/GData/Client/Error.html +118 -0
- data/doc/classes/GData/Client/Finance.html +146 -0
- data/doc/classes/GData/Client/Finance.src/M000029.html +20 -0
- data/doc/classes/GData/Client/Finance.src/M000030.html +20 -0
- data/doc/classes/GData/Client/GBase.html +146 -0
- data/doc/classes/GData/Client/GBase.src/M000004.html +20 -0
- data/doc/classes/GData/Client/GMail.html +146 -0
- data/doc/classes/GData/Client/GMail.src/M000028.html +20 -0
- data/doc/classes/GData/Client/GMail.src/M000029.html +20 -0
- data/doc/classes/GData/Client/Health.html +146 -0
- data/doc/classes/GData/Client/Health.src/M000031.html +20 -0
- data/doc/classes/GData/Client/Health.src/M000034.html +20 -0
- data/doc/classes/GData/Client/Health.src/M000035.html +20 -0
- data/doc/classes/GData/Client/Notebook.html +146 -0
- data/doc/classes/GData/Client/Notebook.src/M000009.html +20 -0
- data/doc/classes/GData/Client/Notebook.src/M000010.html +20 -0
- data/doc/classes/GData/Client/Photos.html +146 -0
- data/doc/classes/GData/Client/Photos.src/M000008.html +21 -0
- data/doc/classes/GData/Client/Photos.src/M000009.html +21 -0
- data/doc/classes/GData/Client/RequestError.html +167 -0
- data/doc/classes/GData/Client/RequestError.src/M000006.html +20 -0
- data/doc/classes/GData/Client/ServerError.html +113 -0
- data/doc/classes/GData/Client/Spreadsheets.html +146 -0
- data/doc/classes/GData/Client/Spreadsheets.src/M000001.html +20 -0
- data/doc/classes/GData/Client/UnknownError.html +113 -0
- data/doc/classes/GData/Client/VersionConflictError.html +113 -0
- data/doc/classes/GData/Client/WebmasterTools.html +146 -0
- data/doc/classes/GData/Client/WebmasterTools.src/M000007.html +20 -0
- data/doc/classes/GData/Client/WebmasterTools.src/M000008.html +20 -0
- data/doc/classes/GData/Client/YouTube.html +192 -0
- data/doc/classes/GData/Client/YouTube.src/M000013.html +19 -0
- data/doc/classes/GData/Client/YouTube.src/M000014.html +24 -0
- data/doc/classes/GData/Client/YouTube.src/M000025.html +22 -0
- data/doc/classes/GData/Client/YouTube.src/M000026.html +22 -0
- data/doc/classes/GData/Client/YouTube.src/M000027.html +24 -0
- data/doc/classes/GData/Client.html +198 -0
- data/doc/classes/GData/HTTP/DefaultService.html +150 -0
- data/doc/classes/GData/HTTP/DefaultService.src/M000019.html +48 -0
- data/doc/classes/GData/HTTP/DefaultService.src/M000037.html +63 -0
- data/doc/classes/GData/HTTP/DefaultService.src/M000042.html +66 -0
- data/doc/classes/GData/HTTP/DefaultService.src/M000045.html +66 -0
- data/doc/classes/GData/HTTP/DefaultService.src/M000046.html +66 -0
- data/doc/classes/GData/HTTP/MimeBody.html +202 -0
- data/doc/classes/GData/HTTP/MimeBody.src/M000032.html +22 -0
- data/doc/classes/GData/HTTP/MimeBody.src/M000033.html +31 -0
- data/doc/classes/GData/HTTP/MimeBody.src/M000034.html +18 -0
- data/doc/classes/GData/HTTP/MimeBody.src/M000035.html +22 -0
- data/doc/classes/GData/HTTP/MimeBody.src/M000036.html +22 -0
- data/doc/classes/GData/HTTP/MimeBody.src/M000037.html +31 -0
- data/doc/classes/GData/HTTP/MimeBody.src/M000038.html +18 -0
- data/doc/classes/GData/HTTP/MimeBodyString.html +164 -0
- data/doc/classes/GData/HTTP/MimeBodyString.src/M000036.html +19 -0
- data/doc/classes/GData/HTTP/MimeBodyString.src/M000037.html +27 -0
- data/doc/classes/GData/HTTP/MimeBodyString.src/M000039.html +19 -0
- data/doc/classes/GData/HTTP/MimeBodyString.src/M000040.html +19 -0
- data/doc/classes/GData/HTTP/MimeBodyString.src/M000041.html +27 -0
- data/doc/classes/GData/HTTP/Request.html +243 -0
- data/doc/classes/GData/HTTP/Request.src/M000015.html +22 -0
- data/doc/classes/GData/HTTP/Request.src/M000016.html +22 -0
- data/doc/classes/GData/HTTP/Request.src/M000017.html +22 -0
- data/doc/classes/GData/HTTP/Request.src/M000018.html +24 -0
- data/doc/classes/GData/HTTP/Request.src/M000033.html +24 -0
- data/doc/classes/GData/HTTP/Request.src/M000034.html +22 -0
- data/doc/classes/GData/HTTP/Request.src/M000035.html +22 -0
- data/doc/classes/GData/HTTP/Request.src/M000036.html +25 -0
- data/doc/classes/GData/HTTP/Request.src/M000038.html +24 -0
- data/doc/classes/GData/HTTP/Request.src/M000039.html +22 -0
- data/doc/classes/GData/HTTP/Request.src/M000040.html +22 -0
- data/doc/classes/GData/HTTP/Request.src/M000041.html +24 -0
- data/doc/classes/GData/HTTP/Request.src/M000042.html +24 -0
- data/doc/classes/GData/HTTP/Request.src/M000043.html +22 -0
- data/doc/classes/GData/HTTP/Request.src/M000044.html +22 -0
- data/doc/classes/GData/HTTP/Request.src/M000045.html +25 -0
- data/doc/classes/GData/HTTP/Response.html +179 -0
- data/doc/classes/GData/HTTP/Response.src/M000032.html +26 -0
- data/doc/classes/GData/HTTP/Response.src/M000035.html +26 -0
- data/doc/classes/GData/HTTP/Response.src/M000038.html +26 -0
- data/doc/classes/GData/HTTP/Response.src/M000039.html +26 -0
- data/doc/classes/GData/HTTP.html +127 -0
- data/doc/classes/GData.html +226 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +214 -0
- data/doc/files/lib/gdata/auth/authsub_rb.html +131 -0
- data/doc/files/lib/gdata/auth/clientlogin_rb.html +129 -0
- data/doc/files/lib/gdata/auth_rb.html +130 -0
- data/doc/files/lib/gdata/client/apps_rb.html +122 -0
- data/doc/files/lib/gdata/client/base_rb.html +122 -0
- data/doc/files/lib/gdata/client/blogger_rb.html +122 -0
- data/doc/files/lib/gdata/client/booksearch_rb.html +122 -0
- data/doc/files/lib/gdata/client/calendar_rb.html +122 -0
- data/doc/files/lib/gdata/client/contacts_rb.html +122 -0
- data/doc/files/lib/gdata/client/doclist_rb.html +122 -0
- data/doc/files/lib/gdata/client/finance_rb.html +122 -0
- data/doc/files/lib/gdata/client/gbase_rb.html +122 -0
- data/doc/files/lib/gdata/client/gdata_rb.html +129 -0
- data/doc/files/lib/gdata/client/gmail_rb.html +122 -0
- data/doc/files/lib/gdata/client/health_rb.html +122 -0
- data/doc/files/lib/gdata/client/notebook_rb.html +122 -0
- data/doc/files/lib/gdata/client/photos_rb.html +122 -0
- data/doc/files/lib/gdata/client/spreadsheets_rb.html +122 -0
- data/doc/files/lib/gdata/client/webmaster_tools_rb.html +122 -0
- data/doc/files/lib/gdata/client/youtube_rb.html +122 -0
- data/doc/files/lib/gdata/client_rb.html +144 -0
- data/doc/files/lib/gdata/http/default_service_rb.html +131 -0
- data/doc/files/lib/gdata/http/mime_body_rb.html +122 -0
- data/doc/files/lib/gdata/http/request_rb.html +129 -0
- data/doc/files/lib/gdata/http/response_rb.html +129 -0
- data/doc/files/lib/gdata/http_rb.html +132 -0
- data/doc/files/lib/gdata_rb.html +132 -0
- data/doc/fr_class_index.html +61 -0
- data/doc/fr_file_index.html +53 -0
- data/doc/fr_method_index.html +82 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/gdata19.gemspec +294 -0
- data/lib/gdata/auth/authsub.rb +162 -0
- data/lib/gdata/auth/clientlogin.rb +103 -0
- data/lib/gdata/auth.rb +23 -0
- data/lib/gdata/client/apps.rb +28 -0
- data/lib/gdata/client/base.rb +183 -0
- data/lib/gdata/client/blogger.rb +29 -0
- data/lib/gdata/client/booksearch.rb +29 -0
- data/lib/gdata/client/calendar.rb +59 -0
- data/lib/gdata/client/contacts.rb +29 -0
- data/lib/gdata/client/doclist.rb +29 -0
- data/lib/gdata/client/finance.rb +29 -0
- data/lib/gdata/client/gbase.rb +29 -0
- data/lib/gdata/client/gmail.rb +29 -0
- data/lib/gdata/client/health.rb +29 -0
- data/lib/gdata/client/notebook.rb +29 -0
- data/lib/gdata/client/photos.rb +30 -0
- data/lib/gdata/client/spreadsheets.rb +29 -0
- data/lib/gdata/client/webmaster_tools.rb +29 -0
- data/lib/gdata/client/youtube.rb +48 -0
- data/lib/gdata/client.rb +85 -0
- data/lib/gdata/http/default_service.rb +83 -0
- data/lib/gdata/http/mime_body.rb +101 -0
- data/lib/gdata/http/request.rb +75 -0
- data/lib/gdata/http/response.rb +45 -0
- data/lib/gdata/http.rb +19 -0
- data/lib/gdata.rb +24 -0
- data/pkg/gdata19-1.1.2.gem +0 -0
- data/test/tc_gdata_auth_authsub.rb +53 -0
- data/test/tc_gdata_auth_clientlogin.rb +59 -0
- data/test/tc_gdata_client_base.rb +37 -0
- data/test/tc_gdata_client_calendar.rb +40 -0
- data/test/tc_gdata_client_photos.rb +65 -0
- data/test/tc_gdata_client_youtube.rb +77 -0
- data/test/tc_gdata_http_mime_body.rb +47 -0
- data/test/tc_gdata_http_request.rb +36 -0
- data/test/test_config.yml.example +7 -0
- data/test/test_helper.rb +47 -0
- data/test/testimage.jpg +0 -0
- data/test/ts_gdata.rb +48 -0
- data/test/ts_gdata_auth.rb +25 -0
- data/test/ts_gdata_client.rb +29 -0
- data/test/ts_gdata_http.rb +25 -0
- metadata +320 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>private_key= (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 62</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">private_key=</span>(<span class="ruby-identifier">key</span>)
|
15
|
+
<span class="ruby-keyword kw">begin</span>
|
16
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>
|
17
|
+
<span class="ruby-ivar">@private_key</span> = <span class="ruby-identifier">key</span>
|
18
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">key</span>)
|
19
|
+
<span class="ruby-identifier">key_from_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">key</span>)
|
20
|
+
<span class="ruby-ivar">@private_key</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">key_from_file</span>)
|
21
|
+
<span class="ruby-keyword kw">else</span>
|
22
|
+
<span class="ruby-ivar">@private_key</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">key</span>)
|
23
|
+
<span class="ruby-keyword kw">end</span>
|
24
|
+
<span class="ruby-keyword kw">rescue</span>
|
25
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Not a valid private key."</span>
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
<span class="ruby-keyword kw">end</span></pre>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>sign_request! (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 79</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sign_request!</span>(<span class="ruby-identifier">request</span>)
|
15
|
+
<span class="ruby-identifier">header</span> = <span class="ruby-node">"AuthSub token=\"#{@token}\""</span>
|
16
|
+
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@private_key</span>
|
18
|
+
<span class="ruby-identifier">time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>
|
19
|
+
<span class="ruby-identifier">nonce</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">BN</span>.<span class="ruby-identifier">rand_range</span>(<span class="ruby-constant">BIG_INT_MAX</span>)
|
20
|
+
<span class="ruby-identifier">method</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>
|
21
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-node">"#{method} #{request.url} #{time} #{nonce}"</span>
|
22
|
+
<span class="ruby-identifier">sig</span> = <span class="ruby-ivar">@private_key</span>.<span class="ruby-identifier">sign</span>(<span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA1</span>.<span class="ruby-identifier">new</span>, <span class="ruby-identifier">data</span>)
|
23
|
+
<span class="ruby-identifier">sig</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">sig</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n/</span>, <span class="ruby-value str">''</span>)
|
24
|
+
<span class="ruby-identifier">header</span> = <span class="ruby-node">"#{header} sigalg=\"rsa-sha1\" data=\"#{data}\""</span>
|
25
|
+
<span class="ruby-identifier">header</span> = <span class="ruby-node">"#{header} sig=\"#{sig}\""</span>
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
|
28
|
+
<span class="ruby-identifier">request</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Authorization'</span>] = <span class="ruby-identifier">header</span>
|
29
|
+
<span class="ruby-keyword kw">end</span></pre>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>upgrade (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 97</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upgrade</span>
|
15
|
+
<span class="ruby-identifier">request</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">SESSION_HANDLER</span>)
|
16
|
+
<span class="ruby-identifier">sign_request!</span>(<span class="ruby-identifier">request</span>)
|
17
|
+
<span class="ruby-identifier">service</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultService</span>.<span class="ruby-identifier">new</span>
|
18
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">service</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-identifier">request</span>)
|
19
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status_code</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
|
20
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span><span class="ruby-operator">::</span><span class="ruby-constant">AuthorizationError</span>,
|
21
|
+
<span class="ruby-node">"#{response.status_code} : #{response.body}"</span>
|
22
|
+
<span class="ruby-keyword kw">end</span>
|
23
|
+
|
24
|
+
<span class="ruby-ivar">@token</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>[<span class="ruby-regexp re">/Token=(.*)/</span>,<span class="ruby-value">1</span>]
|
25
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@token</span>
|
26
|
+
|
27
|
+
<span class="ruby-keyword kw">end</span></pre>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>info (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 114</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">info</span>
|
15
|
+
<span class="ruby-identifier">request</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">INFO_HANDLER</span>)
|
16
|
+
<span class="ruby-identifier">sign_request!</span>(<span class="ruby-identifier">request</span>)
|
17
|
+
<span class="ruby-identifier">service</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultService</span>.<span class="ruby-identifier">new</span>
|
18
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">service</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-identifier">request</span>)
|
19
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status_code</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
|
20
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span><span class="ruby-operator">::</span><span class="ruby-constant">AuthorizationError</span>,
|
21
|
+
<span class="ruby-node">"#{response.status_code} : #{response.body}"</span>
|
22
|
+
<span class="ruby-keyword kw">end</span>
|
23
|
+
|
24
|
+
<span class="ruby-identifier">result</span> = {}
|
25
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-identifier">:target</span>] = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>[<span class="ruby-regexp re">/Target=(.*)/</span>,<span class="ruby-value">1</span>]
|
26
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-identifier">:scope</span>] = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>[<span class="ruby-regexp re">/Scope=(.*)/</span>,<span class="ruby-value">1</span>]
|
27
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-identifier">:secure</span>] = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>[<span class="ruby-regexp re">/Secure=(.*)/</span>,<span class="ruby-value">1</span>]
|
28
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
29
|
+
|
30
|
+
<span class="ruby-keyword kw">end</span></pre>
|
31
|
+
</body>
|
32
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 44</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">token</span>, <span class="ruby-identifier">options</span> = {})
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">token</span>.<span class="ruby-identifier">nil?</span>
|
16
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Token cannot be nil."</span>
|
17
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">token</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">String</span>
|
18
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Token must be a String."</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
20
|
+
|
21
|
+
<span class="ruby-ivar">@token</span> = <span class="ruby-identifier">token</span>
|
22
|
+
|
23
|
+
<span class="ruby-identifier">options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
24
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{key}="</span>, <span class="ruby-identifier">value</span>)
|
25
|
+
<span class="ruby-keyword kw">end</span>
|
26
|
+
<span class="ruby-keyword kw">end</span></pre>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>private_key= (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 62</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">private_key=</span>(<span class="ruby-identifier">key</span>)
|
15
|
+
<span class="ruby-keyword kw">begin</span>
|
16
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>
|
17
|
+
<span class="ruby-ivar">@private_key</span> = <span class="ruby-identifier">key</span>
|
18
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">key</span>)
|
19
|
+
<span class="ruby-identifier">key_from_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">key</span>)
|
20
|
+
<span class="ruby-ivar">@private_key</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">key_from_file</span>)
|
21
|
+
<span class="ruby-keyword kw">else</span>
|
22
|
+
<span class="ruby-ivar">@private_key</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">key</span>)
|
23
|
+
<span class="ruby-keyword kw">end</span>
|
24
|
+
<span class="ruby-keyword kw">rescue</span>
|
25
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Not a valid private key."</span>
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
<span class="ruby-keyword kw">end</span></pre>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>sign_request! (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 79</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sign_request!</span>(<span class="ruby-identifier">request</span>)
|
15
|
+
<span class="ruby-identifier">header</span> = <span class="ruby-node">"AuthSub token=\"#{@token}\""</span>
|
16
|
+
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@private_key</span>
|
18
|
+
<span class="ruby-identifier">time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>
|
19
|
+
<span class="ruby-identifier">nonce</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">BN</span>.<span class="ruby-identifier">rand_range</span>(<span class="ruby-constant">BIG_INT_MAX</span>)
|
20
|
+
<span class="ruby-identifier">method</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>
|
21
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-node">"#{method} #{request.url} #{time} #{nonce}"</span>
|
22
|
+
<span class="ruby-identifier">sig</span> = <span class="ruby-ivar">@private_key</span>.<span class="ruby-identifier">sign</span>(<span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA1</span>.<span class="ruby-identifier">new</span>, <span class="ruby-identifier">data</span>)
|
23
|
+
<span class="ruby-identifier">sig</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">sig</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n/</span>, <span class="ruby-value str">''</span>)
|
24
|
+
<span class="ruby-identifier">header</span> = <span class="ruby-node">"#{header} sigalg=\"rsa-sha1\" data=\"#{data}\""</span>
|
25
|
+
<span class="ruby-identifier">header</span> = <span class="ruby-node">"#{header} sig=\"#{sig}\""</span>
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
|
28
|
+
<span class="ruby-identifier">request</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Authorization'</span>] = <span class="ruby-identifier">header</span>
|
29
|
+
<span class="ruby-keyword kw">end</span></pre>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 44</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">token</span>, <span class="ruby-identifier">options</span> = {})
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">token</span>.<span class="ruby-identifier">nil?</span>
|
16
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Token cannot be nil."</span>
|
17
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">token</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">String</span>
|
18
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Token must be a String."</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
20
|
+
|
21
|
+
<span class="ruby-ivar">@token</span> = <span class="ruby-identifier">token</span>
|
22
|
+
|
23
|
+
<span class="ruby-identifier">options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
24
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{key}="</span>, <span class="ruby-identifier">value</span>)
|
25
|
+
<span class="ruby-keyword kw">end</span>
|
26
|
+
<span class="ruby-keyword kw">end</span></pre>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 44</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">token</span>, <span class="ruby-identifier">options</span> = {})
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">token</span>.<span class="ruby-identifier">nil?</span>
|
16
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Token cannot be nil."</span>
|
17
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">token</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">String</span>
|
18
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Token must be a String."</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
20
|
+
|
21
|
+
<span class="ruby-ivar">@token</span> = <span class="ruby-identifier">token</span>
|
22
|
+
|
23
|
+
<span class="ruby-identifier">options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
24
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{key}="</span>, <span class="ruby-identifier">value</span>)
|
25
|
+
<span class="ruby-keyword kw">end</span>
|
26
|
+
<span class="ruby-keyword kw">end</span></pre>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>private_key= (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 62</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">private_key=</span>(<span class="ruby-identifier">key</span>)
|
15
|
+
<span class="ruby-keyword kw">begin</span>
|
16
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>
|
17
|
+
<span class="ruby-ivar">@private_key</span> = <span class="ruby-identifier">key</span>
|
18
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">key</span>)
|
19
|
+
<span class="ruby-identifier">key_from_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">key</span>)
|
20
|
+
<span class="ruby-ivar">@private_key</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">key_from_file</span>)
|
21
|
+
<span class="ruby-keyword kw">else</span>
|
22
|
+
<span class="ruby-ivar">@private_key</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">key</span>)
|
23
|
+
<span class="ruby-keyword kw">end</span>
|
24
|
+
<span class="ruby-keyword kw">rescue</span>
|
25
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Not a valid private key."</span>
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
<span class="ruby-keyword kw">end</span></pre>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>sign_request! (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 79</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sign_request!</span>(<span class="ruby-identifier">request</span>)
|
15
|
+
<span class="ruby-identifier">header</span> = <span class="ruby-node">"AuthSub token=\"#{@token}\""</span>
|
16
|
+
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@private_key</span>
|
18
|
+
<span class="ruby-identifier">time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>
|
19
|
+
<span class="ruby-identifier">nonce</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">BN</span>.<span class="ruby-identifier">rand_range</span>(<span class="ruby-constant">BIG_INT_MAX</span>)
|
20
|
+
<span class="ruby-identifier">method</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>
|
21
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-node">"#{method} #{request.url} #{time} #{nonce}"</span>
|
22
|
+
<span class="ruby-identifier">sig</span> = <span class="ruby-ivar">@private_key</span>.<span class="ruby-identifier">sign</span>(<span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA1</span>.<span class="ruby-identifier">new</span>, <span class="ruby-identifier">data</span>)
|
23
|
+
<span class="ruby-identifier">sig</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">sig</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n/</span>, <span class="ruby-value str">''</span>)
|
24
|
+
<span class="ruby-identifier">header</span> = <span class="ruby-node">"#{header} sigalg=\"rsa-sha1\" data=\"#{data}\""</span>
|
25
|
+
<span class="ruby-identifier">header</span> = <span class="ruby-node">"#{header} sig=\"#{sig}\""</span>
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
|
28
|
+
<span class="ruby-identifier">request</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Authorization'</span>] = <span class="ruby-identifier">header</span>
|
29
|
+
<span class="ruby-keyword kw">end</span></pre>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>upgrade (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 97</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upgrade</span>
|
15
|
+
<span class="ruby-identifier">request</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">SESSION_HANDLER</span>)
|
16
|
+
<span class="ruby-identifier">sign_request!</span>(<span class="ruby-identifier">request</span>)
|
17
|
+
<span class="ruby-identifier">service</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultService</span>.<span class="ruby-identifier">new</span>
|
18
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">service</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-identifier">request</span>)
|
19
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status_code</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
|
20
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span><span class="ruby-operator">::</span><span class="ruby-constant">AuthorizationError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">response</span>)
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
|
23
|
+
<span class="ruby-ivar">@token</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>[<span class="ruby-regexp re">/Token=(.*)/</span>,<span class="ruby-value">1</span>]
|
24
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@token</span>
|
25
|
+
|
26
|
+
<span class="ruby-keyword kw">end</span></pre>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>info (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 113</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">info</span>
|
15
|
+
<span class="ruby-identifier">request</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">INFO_HANDLER</span>)
|
16
|
+
<span class="ruby-identifier">sign_request!</span>(<span class="ruby-identifier">request</span>)
|
17
|
+
<span class="ruby-identifier">service</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultService</span>.<span class="ruby-identifier">new</span>
|
18
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">service</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-identifier">request</span>)
|
19
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status_code</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
|
20
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span><span class="ruby-operator">::</span><span class="ruby-constant">AuthorizationError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">response</span>)
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
|
23
|
+
<span class="ruby-identifier">result</span> = {}
|
24
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-identifier">:target</span>] = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>[<span class="ruby-regexp re">/Target=(.*)/</span>,<span class="ruby-value">1</span>]
|
25
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-identifier">:scope</span>] = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>[<span class="ruby-regexp re">/Scope=(.*)/</span>,<span class="ruby-value">1</span>]
|
26
|
+
<span class="ruby-identifier">result</span>[<span class="ruby-identifier">:secure</span>] = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>[<span class="ruby-regexp re">/Secure=(.*)/</span>,<span class="ruby-value">1</span>]
|
27
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
28
|
+
|
29
|
+
<span class="ruby-keyword kw">end</span></pre>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>revoke (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 131</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revoke</span>
|
15
|
+
<span class="ruby-identifier">request</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">REVOKE_HANDLER</span>)
|
16
|
+
<span class="ruby-identifier">sign_request!</span>(<span class="ruby-identifier">request</span>)
|
17
|
+
<span class="ruby-identifier">service</span> = <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultService</span>.<span class="ruby-identifier">new</span>
|
18
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">service</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-identifier">request</span>)
|
19
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status_code</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
|
20
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">GData</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span><span class="ruby-operator">::</span><span class="ruby-constant">AuthorizationError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">response</span>)
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
|
23
|
+
<span class="ruby-keyword kw">end</span></pre>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>get_url (GData::Auth::AuthSub)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/gdata/auth/authsub.rb, line 145</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_url</span>(<span class="ruby-identifier">next_url</span>, <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">secure</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">session</span> = <span class="ruby-keyword kw">true</span>,
|
15
|
+
<span class="ruby-identifier">domain</span> = <span class="ruby-keyword kw">nil</span>)
|
16
|
+
<span class="ruby-identifier">next_url</span> = <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">next_url</span>)
|
17
|
+
<span class="ruby-identifier">scope</span> = <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">scope</span>)
|
18
|
+
<span class="ruby-identifier">secure</span> = <span class="ruby-identifier">secure</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
|
19
|
+
<span class="ruby-identifier">session</span> = <span class="ruby-identifier">session</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
|
20
|
+
<span class="ruby-identifier">body</span> = <span class="ruby-node">"next=#{next_url}&scope=#{scope}&session=#{session}"</span> <span class="ruby-operator">+</span>
|
21
|
+
<span class="ruby-node">"&secure=#{secure}"</span>
|
22
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">domain</span>
|
23
|
+
<span class="ruby-identifier">domain</span> = <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">domain</span>)
|
24
|
+
<span class="ruby-identifier">body</span> = <span class="ruby-node">"#{body}&hd=#{domain}"</span>
|
25
|
+
<span class="ruby-keyword kw">end</span>
|
26
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-node">"#{REQUEST_HANDLER}?#{body}"</span>
|
27
|
+
<span class="ruby-keyword kw">end</span></pre>
|
28
|
+
</body>
|
29
|
+
</html>
|