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
data/gdata19.gemspec
ADDED
@@ -0,0 +1,294 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{gdata19}
|
8
|
+
s.version = "1.1.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jeff Fisher"]
|
12
|
+
s.date = %q{2010-09-02}
|
13
|
+
s.default_executable = %q{test_captcha.rb}
|
14
|
+
s.description = %q{This gem provides a set of wrappers designed to make it easy to work with
|
15
|
+
the Google Data APIs with 1.9 compat}
|
16
|
+
s.email = %q{jfisher@youtube.com}
|
17
|
+
s.executables = ["test_captcha.rb"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE",
|
20
|
+
"README"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".hgtags",
|
24
|
+
"LICENSE",
|
25
|
+
"README",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/test_captcha.rb",
|
29
|
+
"doc/classes/GData.html",
|
30
|
+
"doc/classes/GData/Auth.html",
|
31
|
+
"doc/classes/GData/Auth/AuthSub.html",
|
32
|
+
"doc/classes/GData/Auth/AuthSub.src/M000020.html",
|
33
|
+
"doc/classes/GData/Auth/AuthSub.src/M000021.html",
|
34
|
+
"doc/classes/GData/Auth/AuthSub.src/M000022.html",
|
35
|
+
"doc/classes/GData/Auth/AuthSub.src/M000023.html",
|
36
|
+
"doc/classes/GData/Auth/AuthSub.src/M000024.html",
|
37
|
+
"doc/classes/GData/Auth/AuthSub.src/M000025.html",
|
38
|
+
"doc/classes/GData/Auth/AuthSub.src/M000026.html",
|
39
|
+
"doc/classes/GData/Auth/AuthSub.src/M000038.html",
|
40
|
+
"doc/classes/GData/Auth/AuthSub.src/M000039.html",
|
41
|
+
"doc/classes/GData/Auth/AuthSub.src/M000040.html",
|
42
|
+
"doc/classes/GData/Auth/AuthSub.src/M000041.html",
|
43
|
+
"doc/classes/GData/Auth/AuthSub.src/M000042.html",
|
44
|
+
"doc/classes/GData/Auth/AuthSub.src/M000043.html",
|
45
|
+
"doc/classes/GData/Auth/AuthSub.src/M000044.html",
|
46
|
+
"doc/classes/GData/Auth/AuthSub.src/M000045.html",
|
47
|
+
"doc/classes/GData/Auth/AuthSub.src/M000046.html",
|
48
|
+
"doc/classes/GData/Auth/AuthSub.src/M000047.html",
|
49
|
+
"doc/classes/GData/Auth/AuthSub.src/M000048.html",
|
50
|
+
"doc/classes/GData/Auth/AuthSub.src/M000049.html",
|
51
|
+
"doc/classes/GData/Auth/AuthSub.src/M000050.html",
|
52
|
+
"doc/classes/GData/Auth/AuthSub.src/M000051.html",
|
53
|
+
"doc/classes/GData/Auth/AuthSub.src/M000052.html",
|
54
|
+
"doc/classes/GData/Auth/AuthSub.src/M000053.html",
|
55
|
+
"doc/classes/GData/Auth/ClientLogin.html",
|
56
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000027.html",
|
57
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000028.html",
|
58
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000029.html",
|
59
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000045.html",
|
60
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000046.html",
|
61
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000047.html",
|
62
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000050.html",
|
63
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000051.html",
|
64
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000052.html",
|
65
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000053.html",
|
66
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000054.html",
|
67
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000055.html",
|
68
|
+
"doc/classes/GData/Auth/ClientLogin.src/M000056.html",
|
69
|
+
"doc/classes/GData/Client.html",
|
70
|
+
"doc/classes/GData/Client/Apps.html",
|
71
|
+
"doc/classes/GData/Client/Apps.src/M000027.html",
|
72
|
+
"doc/classes/GData/Client/Apps.src/M000028.html",
|
73
|
+
"doc/classes/GData/Client/AuthorizationError.html",
|
74
|
+
"doc/classes/GData/Client/BadRequestError.html",
|
75
|
+
"doc/classes/GData/Client/Base.html",
|
76
|
+
"doc/classes/GData/Client/Base.src/M000002.html",
|
77
|
+
"doc/classes/GData/Client/Base.src/M000003.html",
|
78
|
+
"doc/classes/GData/Client/Base.src/M000004.html",
|
79
|
+
"doc/classes/GData/Client/Base.src/M000005.html",
|
80
|
+
"doc/classes/GData/Client/Base.src/M000006.html",
|
81
|
+
"doc/classes/GData/Client/Base.src/M000007.html",
|
82
|
+
"doc/classes/GData/Client/Base.src/M000008.html",
|
83
|
+
"doc/classes/GData/Client/Base.src/M000009.html",
|
84
|
+
"doc/classes/GData/Client/Base.src/M000010.html",
|
85
|
+
"doc/classes/GData/Client/Base.src/M000011.html",
|
86
|
+
"doc/classes/GData/Client/Base.src/M000012.html",
|
87
|
+
"doc/classes/GData/Client/Base.src/M000013.html",
|
88
|
+
"doc/classes/GData/Client/Base.src/M000014.html",
|
89
|
+
"doc/classes/GData/Client/Base.src/M000015.html",
|
90
|
+
"doc/classes/GData/Client/Base.src/M000016.html",
|
91
|
+
"doc/classes/GData/Client/Base.src/M000017.html",
|
92
|
+
"doc/classes/GData/Client/Base.src/M000018.html",
|
93
|
+
"doc/classes/GData/Client/Base.src/M000019.html",
|
94
|
+
"doc/classes/GData/Client/Base.src/M000020.html",
|
95
|
+
"doc/classes/GData/Client/Base.src/M000021.html",
|
96
|
+
"doc/classes/GData/Client/Base.src/M000022.html",
|
97
|
+
"doc/classes/GData/Client/Base.src/M000023.html",
|
98
|
+
"doc/classes/GData/Client/Base.src/M000024.html",
|
99
|
+
"doc/classes/GData/Client/Base.src/M000025.html",
|
100
|
+
"doc/classes/GData/Client/Blogger.html",
|
101
|
+
"doc/classes/GData/Client/Blogger.src/M000002.html",
|
102
|
+
"doc/classes/GData/Client/BookSearch.html",
|
103
|
+
"doc/classes/GData/Client/BookSearch.src/M000010.html",
|
104
|
+
"doc/classes/GData/Client/BookSearch.src/M000011.html",
|
105
|
+
"doc/classes/GData/Client/Calendar.html",
|
106
|
+
"doc/classes/GData/Client/Calendar.src/M000030.html",
|
107
|
+
"doc/classes/GData/Client/Calendar.src/M000031.html",
|
108
|
+
"doc/classes/GData/Client/Calendar.src/M000032.html",
|
109
|
+
"doc/classes/GData/Client/Calendar.src/M000033.html",
|
110
|
+
"doc/classes/GData/Client/Calendar.src/M000034.html",
|
111
|
+
"doc/classes/GData/Client/CaptchaError.html",
|
112
|
+
"doc/classes/GData/Client/CaptchaError.src/M000001.html",
|
113
|
+
"doc/classes/GData/Client/CaptchaError.src/M000005.html",
|
114
|
+
"doc/classes/GData/Client/Contacts.html",
|
115
|
+
"doc/classes/GData/Client/Contacts.src/M000003.html",
|
116
|
+
"doc/classes/GData/Client/DocList.html",
|
117
|
+
"doc/classes/GData/Client/DocList.src/M000006.html",
|
118
|
+
"doc/classes/GData/Client/DocList.src/M000007.html",
|
119
|
+
"doc/classes/GData/Client/Error.html",
|
120
|
+
"doc/classes/GData/Client/Finance.html",
|
121
|
+
"doc/classes/GData/Client/Finance.src/M000029.html",
|
122
|
+
"doc/classes/GData/Client/Finance.src/M000030.html",
|
123
|
+
"doc/classes/GData/Client/GBase.html",
|
124
|
+
"doc/classes/GData/Client/GBase.src/M000004.html",
|
125
|
+
"doc/classes/GData/Client/GMail.html",
|
126
|
+
"doc/classes/GData/Client/GMail.src/M000028.html",
|
127
|
+
"doc/classes/GData/Client/GMail.src/M000029.html",
|
128
|
+
"doc/classes/GData/Client/Health.html",
|
129
|
+
"doc/classes/GData/Client/Health.src/M000031.html",
|
130
|
+
"doc/classes/GData/Client/Health.src/M000034.html",
|
131
|
+
"doc/classes/GData/Client/Health.src/M000035.html",
|
132
|
+
"doc/classes/GData/Client/Notebook.html",
|
133
|
+
"doc/classes/GData/Client/Notebook.src/M000009.html",
|
134
|
+
"doc/classes/GData/Client/Notebook.src/M000010.html",
|
135
|
+
"doc/classes/GData/Client/Photos.html",
|
136
|
+
"doc/classes/GData/Client/Photos.src/M000008.html",
|
137
|
+
"doc/classes/GData/Client/Photos.src/M000009.html",
|
138
|
+
"doc/classes/GData/Client/RequestError.html",
|
139
|
+
"doc/classes/GData/Client/RequestError.src/M000006.html",
|
140
|
+
"doc/classes/GData/Client/ServerError.html",
|
141
|
+
"doc/classes/GData/Client/Spreadsheets.html",
|
142
|
+
"doc/classes/GData/Client/Spreadsheets.src/M000001.html",
|
143
|
+
"doc/classes/GData/Client/UnknownError.html",
|
144
|
+
"doc/classes/GData/Client/VersionConflictError.html",
|
145
|
+
"doc/classes/GData/Client/WebmasterTools.html",
|
146
|
+
"doc/classes/GData/Client/WebmasterTools.src/M000007.html",
|
147
|
+
"doc/classes/GData/Client/WebmasterTools.src/M000008.html",
|
148
|
+
"doc/classes/GData/Client/YouTube.html",
|
149
|
+
"doc/classes/GData/Client/YouTube.src/M000013.html",
|
150
|
+
"doc/classes/GData/Client/YouTube.src/M000014.html",
|
151
|
+
"doc/classes/GData/Client/YouTube.src/M000025.html",
|
152
|
+
"doc/classes/GData/Client/YouTube.src/M000026.html",
|
153
|
+
"doc/classes/GData/Client/YouTube.src/M000027.html",
|
154
|
+
"doc/classes/GData/HTTP.html",
|
155
|
+
"doc/classes/GData/HTTP/DefaultService.html",
|
156
|
+
"doc/classes/GData/HTTP/DefaultService.src/M000019.html",
|
157
|
+
"doc/classes/GData/HTTP/DefaultService.src/M000037.html",
|
158
|
+
"doc/classes/GData/HTTP/DefaultService.src/M000042.html",
|
159
|
+
"doc/classes/GData/HTTP/DefaultService.src/M000045.html",
|
160
|
+
"doc/classes/GData/HTTP/DefaultService.src/M000046.html",
|
161
|
+
"doc/classes/GData/HTTP/MimeBody.html",
|
162
|
+
"doc/classes/GData/HTTP/MimeBody.src/M000032.html",
|
163
|
+
"doc/classes/GData/HTTP/MimeBody.src/M000033.html",
|
164
|
+
"doc/classes/GData/HTTP/MimeBody.src/M000034.html",
|
165
|
+
"doc/classes/GData/HTTP/MimeBody.src/M000035.html",
|
166
|
+
"doc/classes/GData/HTTP/MimeBody.src/M000036.html",
|
167
|
+
"doc/classes/GData/HTTP/MimeBody.src/M000037.html",
|
168
|
+
"doc/classes/GData/HTTP/MimeBody.src/M000038.html",
|
169
|
+
"doc/classes/GData/HTTP/MimeBodyString.html",
|
170
|
+
"doc/classes/GData/HTTP/MimeBodyString.src/M000036.html",
|
171
|
+
"doc/classes/GData/HTTP/MimeBodyString.src/M000037.html",
|
172
|
+
"doc/classes/GData/HTTP/MimeBodyString.src/M000039.html",
|
173
|
+
"doc/classes/GData/HTTP/MimeBodyString.src/M000040.html",
|
174
|
+
"doc/classes/GData/HTTP/MimeBodyString.src/M000041.html",
|
175
|
+
"doc/classes/GData/HTTP/Request.html",
|
176
|
+
"doc/classes/GData/HTTP/Request.src/M000015.html",
|
177
|
+
"doc/classes/GData/HTTP/Request.src/M000016.html",
|
178
|
+
"doc/classes/GData/HTTP/Request.src/M000017.html",
|
179
|
+
"doc/classes/GData/HTTP/Request.src/M000018.html",
|
180
|
+
"doc/classes/GData/HTTP/Request.src/M000033.html",
|
181
|
+
"doc/classes/GData/HTTP/Request.src/M000034.html",
|
182
|
+
"doc/classes/GData/HTTP/Request.src/M000035.html",
|
183
|
+
"doc/classes/GData/HTTP/Request.src/M000036.html",
|
184
|
+
"doc/classes/GData/HTTP/Request.src/M000038.html",
|
185
|
+
"doc/classes/GData/HTTP/Request.src/M000039.html",
|
186
|
+
"doc/classes/GData/HTTP/Request.src/M000040.html",
|
187
|
+
"doc/classes/GData/HTTP/Request.src/M000041.html",
|
188
|
+
"doc/classes/GData/HTTP/Request.src/M000042.html",
|
189
|
+
"doc/classes/GData/HTTP/Request.src/M000043.html",
|
190
|
+
"doc/classes/GData/HTTP/Request.src/M000044.html",
|
191
|
+
"doc/classes/GData/HTTP/Request.src/M000045.html",
|
192
|
+
"doc/classes/GData/HTTP/Response.html",
|
193
|
+
"doc/classes/GData/HTTP/Response.src/M000032.html",
|
194
|
+
"doc/classes/GData/HTTP/Response.src/M000035.html",
|
195
|
+
"doc/classes/GData/HTTP/Response.src/M000038.html",
|
196
|
+
"doc/classes/GData/HTTP/Response.src/M000039.html",
|
197
|
+
"doc/created.rid",
|
198
|
+
"doc/files/README.html",
|
199
|
+
"doc/files/lib/gdata/auth/authsub_rb.html",
|
200
|
+
"doc/files/lib/gdata/auth/clientlogin_rb.html",
|
201
|
+
"doc/files/lib/gdata/auth_rb.html",
|
202
|
+
"doc/files/lib/gdata/client/apps_rb.html",
|
203
|
+
"doc/files/lib/gdata/client/base_rb.html",
|
204
|
+
"doc/files/lib/gdata/client/blogger_rb.html",
|
205
|
+
"doc/files/lib/gdata/client/booksearch_rb.html",
|
206
|
+
"doc/files/lib/gdata/client/calendar_rb.html",
|
207
|
+
"doc/files/lib/gdata/client/contacts_rb.html",
|
208
|
+
"doc/files/lib/gdata/client/doclist_rb.html",
|
209
|
+
"doc/files/lib/gdata/client/finance_rb.html",
|
210
|
+
"doc/files/lib/gdata/client/gbase_rb.html",
|
211
|
+
"doc/files/lib/gdata/client/gdata_rb.html",
|
212
|
+
"doc/files/lib/gdata/client/gmail_rb.html",
|
213
|
+
"doc/files/lib/gdata/client/health_rb.html",
|
214
|
+
"doc/files/lib/gdata/client/notebook_rb.html",
|
215
|
+
"doc/files/lib/gdata/client/photos_rb.html",
|
216
|
+
"doc/files/lib/gdata/client/spreadsheets_rb.html",
|
217
|
+
"doc/files/lib/gdata/client/webmaster_tools_rb.html",
|
218
|
+
"doc/files/lib/gdata/client/youtube_rb.html",
|
219
|
+
"doc/files/lib/gdata/client_rb.html",
|
220
|
+
"doc/files/lib/gdata/http/default_service_rb.html",
|
221
|
+
"doc/files/lib/gdata/http/mime_body_rb.html",
|
222
|
+
"doc/files/lib/gdata/http/request_rb.html",
|
223
|
+
"doc/files/lib/gdata/http/response_rb.html",
|
224
|
+
"doc/files/lib/gdata/http_rb.html",
|
225
|
+
"doc/files/lib/gdata_rb.html",
|
226
|
+
"doc/fr_class_index.html",
|
227
|
+
"doc/fr_file_index.html",
|
228
|
+
"doc/fr_method_index.html",
|
229
|
+
"doc/index.html",
|
230
|
+
"doc/rdoc-style.css",
|
231
|
+
"gdata19.gemspec",
|
232
|
+
"lib/gdata.rb",
|
233
|
+
"lib/gdata/auth.rb",
|
234
|
+
"lib/gdata/auth/authsub.rb",
|
235
|
+
"lib/gdata/auth/clientlogin.rb",
|
236
|
+
"lib/gdata/client.rb",
|
237
|
+
"lib/gdata/client/apps.rb",
|
238
|
+
"lib/gdata/client/base.rb",
|
239
|
+
"lib/gdata/client/blogger.rb",
|
240
|
+
"lib/gdata/client/booksearch.rb",
|
241
|
+
"lib/gdata/client/calendar.rb",
|
242
|
+
"lib/gdata/client/contacts.rb",
|
243
|
+
"lib/gdata/client/doclist.rb",
|
244
|
+
"lib/gdata/client/finance.rb",
|
245
|
+
"lib/gdata/client/gbase.rb",
|
246
|
+
"lib/gdata/client/gmail.rb",
|
247
|
+
"lib/gdata/client/health.rb",
|
248
|
+
"lib/gdata/client/notebook.rb",
|
249
|
+
"lib/gdata/client/photos.rb",
|
250
|
+
"lib/gdata/client/spreadsheets.rb",
|
251
|
+
"lib/gdata/client/webmaster_tools.rb",
|
252
|
+
"lib/gdata/client/youtube.rb",
|
253
|
+
"lib/gdata/http.rb",
|
254
|
+
"lib/gdata/http/default_service.rb",
|
255
|
+
"lib/gdata/http/mime_body.rb",
|
256
|
+
"lib/gdata/http/request.rb",
|
257
|
+
"lib/gdata/http/response.rb",
|
258
|
+
"pkg/gdata19-1.1.2.gem",
|
259
|
+
"test/tc_gdata_auth_authsub.rb",
|
260
|
+
"test/tc_gdata_auth_clientlogin.rb",
|
261
|
+
"test/tc_gdata_client_base.rb",
|
262
|
+
"test/tc_gdata_client_calendar.rb",
|
263
|
+
"test/tc_gdata_client_photos.rb",
|
264
|
+
"test/tc_gdata_client_youtube.rb",
|
265
|
+
"test/tc_gdata_http_mime_body.rb",
|
266
|
+
"test/tc_gdata_http_request.rb",
|
267
|
+
"test/test_config.yml.example",
|
268
|
+
"test/test_helper.rb",
|
269
|
+
"test/testimage.jpg",
|
270
|
+
"test/ts_gdata.rb",
|
271
|
+
"test/ts_gdata_auth.rb",
|
272
|
+
"test/ts_gdata_client.rb",
|
273
|
+
"test/ts_gdata_http.rb"
|
274
|
+
]
|
275
|
+
s.homepage = %q{http://github.com/tokumine/GData}
|
276
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
277
|
+
s.require_paths = ["lib"]
|
278
|
+
s.rubygems_version = %q{1.3.7}
|
279
|
+
s.summary = %q{Google Data APIs Ruby Utility Library}
|
280
|
+
s.test_files = [
|
281
|
+
"test/ts_gdata.rb"
|
282
|
+
]
|
283
|
+
|
284
|
+
if s.respond_to? :specification_version then
|
285
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
286
|
+
s.specification_version = 3
|
287
|
+
|
288
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
289
|
+
else
|
290
|
+
end
|
291
|
+
else
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
@@ -0,0 +1,162 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# Copyright (C) 2008 Google Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'cgi'
|
17
|
+
require 'openssl'
|
18
|
+
require 'base64'
|
19
|
+
|
20
|
+
module GData
|
21
|
+
module Auth
|
22
|
+
|
23
|
+
# This class implements AuthSub signatures for Data API requests.
|
24
|
+
# It can be used with a GData::Client::GData object.
|
25
|
+
class AuthSub
|
26
|
+
|
27
|
+
# The URL of AuthSubRequest.
|
28
|
+
REQUEST_HANDLER = 'https://www.google.com/accounts/AuthSubRequest'
|
29
|
+
# The URL of AuthSubSessionToken.
|
30
|
+
SESSION_HANDLER = 'https://www.google.com/accounts/AuthSubSessionToken'
|
31
|
+
# The URL of AuthSubRevokeToken.
|
32
|
+
REVOKE_HANDLER = 'https://www.google.com/accounts/AuthSubRevokeToken'
|
33
|
+
# The URL of AuthSubInfo.
|
34
|
+
INFO_HANDLER = 'https://www.google.com/accounts/AuthSubTokenInfo'
|
35
|
+
# 2 ** 64, the largest 64 bit unsigned integer
|
36
|
+
BIG_INT_MAX = 18446744073709551616
|
37
|
+
|
38
|
+
# AuthSub access token.
|
39
|
+
attr_accessor :token
|
40
|
+
# Private RSA key used to sign secure requests.
|
41
|
+
attr_reader :private_key
|
42
|
+
|
43
|
+
# Initialize the class with a new token. Optionally pass a private
|
44
|
+
# key or custom URLs.
|
45
|
+
def initialize(token, options = {})
|
46
|
+
if token.nil?
|
47
|
+
raise ArgumentError, "Token cannot be nil."
|
48
|
+
elsif token.class != String
|
49
|
+
raise ArgumentError, "Token must be a String."
|
50
|
+
end
|
51
|
+
|
52
|
+
@token = token
|
53
|
+
|
54
|
+
options.each do |key, value|
|
55
|
+
self.send("#{key}=", value)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Set the private key to use with this AuthSub token.
|
60
|
+
# The key can be an OpenSSL::PKey::RSA object, a string containing a
|
61
|
+
# private key in PEM format, or a string specifying a path to a PEM
|
62
|
+
# file that contains the private key.
|
63
|
+
def private_key=(key)
|
64
|
+
begin
|
65
|
+
if key.nil? or key.class == OpenSSL::PKey::RSA
|
66
|
+
@private_key = key
|
67
|
+
elsif File.exists?(key)
|
68
|
+
key_from_file = File.read(key)
|
69
|
+
@private_key = OpenSSL::PKey::RSA.new(key_from_file)
|
70
|
+
else
|
71
|
+
@private_key = OpenSSL::PKey::RSA.new(key)
|
72
|
+
end
|
73
|
+
rescue
|
74
|
+
raise ArgumentError, "Not a valid private key."
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Sign a GData::Http::Request object with a valid AuthSub Authorization
|
79
|
+
# header.
|
80
|
+
def sign_request!(request)
|
81
|
+
header = "AuthSub token=\"#{@token}\""
|
82
|
+
|
83
|
+
if @private_key
|
84
|
+
time = Time.now.to_i
|
85
|
+
nonce = OpenSSL::BN.rand_range(BIG_INT_MAX)
|
86
|
+
method = request.method.to_s.upcase
|
87
|
+
data = "#{method} #{request.url} #{time} #{nonce}"
|
88
|
+
sig = @private_key.sign(OpenSSL::Digest::SHA1.new, data)
|
89
|
+
sig = Base64.encode64(sig).gsub(/\n/, '')
|
90
|
+
header = "#{header} sigalg=\"rsa-sha1\" data=\"#{data}\""
|
91
|
+
header = "#{header} sig=\"#{sig}\""
|
92
|
+
end
|
93
|
+
|
94
|
+
request.headers['Authorization'] = header
|
95
|
+
end
|
96
|
+
|
97
|
+
# Upgrade the current token into a session token.
|
98
|
+
def upgrade
|
99
|
+
request = GData::HTTP::Request.new(SESSION_HANDLER)
|
100
|
+
sign_request!(request)
|
101
|
+
service = GData::HTTP::DefaultService.new
|
102
|
+
response = service.make_request(request)
|
103
|
+
if response.status_code != 200
|
104
|
+
raise GData::Client::AuthorizationError.new(response)
|
105
|
+
end
|
106
|
+
|
107
|
+
@token = response.body[/Token=(.*)/,1]
|
108
|
+
return @token
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
# Return some information about the current token. If the current token
|
113
|
+
# is a one-time use token, this operation will use it up!
|
114
|
+
def info
|
115
|
+
request = GData::HTTP::Request.new(INFO_HANDLER)
|
116
|
+
sign_request!(request)
|
117
|
+
service = GData::HTTP::DefaultService.new
|
118
|
+
response = service.make_request(request)
|
119
|
+
if response.status_code != 200
|
120
|
+
raise GData::Client::AuthorizationError.new(response)
|
121
|
+
end
|
122
|
+
|
123
|
+
result = {}
|
124
|
+
result[:target] = response.body[/Target=(.*)/,1]
|
125
|
+
result[:scope] = response.body[/Scope=(.*)/,1]
|
126
|
+
result[:secure] = response.body[/Secure=(.*)/,1]
|
127
|
+
return result
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
# Revoke the token.
|
132
|
+
def revoke
|
133
|
+
request = GData::HTTP::Request.new(REVOKE_HANDLER)
|
134
|
+
sign_request!(request)
|
135
|
+
service = GData::HTTP::DefaultService.new
|
136
|
+
response = service.make_request(request)
|
137
|
+
if response.status_code != 200
|
138
|
+
raise GData::Client::AuthorizationError.new(response)
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
# Return the proper URL for an AuthSub approval page with the requested
|
144
|
+
# scope. next_url should be a URL that points back to your code that
|
145
|
+
# will receive the token. domain is optionally a Google Apps domain.
|
146
|
+
def self.get_url(next_url, scope, secure = false, session = true,
|
147
|
+
domain = nil)
|
148
|
+
next_url = CGI.escape(next_url)
|
149
|
+
scope = CGI.escape(scope)
|
150
|
+
secure = secure ? 1 : 0
|
151
|
+
session = session ? 1 : 0
|
152
|
+
body = "next=#{next_url}&scope=#{scope}&session=#{session}" +
|
153
|
+
"&secure=#{secure}"
|
154
|
+
if domain
|
155
|
+
domain = CGI.escape(domain)
|
156
|
+
body = "#{body}&hd=#{domain}"
|
157
|
+
end
|
158
|
+
return "#{REQUEST_HANDLER}?#{body}"
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# Copyright (C) 2008 Google Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'cgi'
|
17
|
+
|
18
|
+
module GData
|
19
|
+
module Auth
|
20
|
+
|
21
|
+
# This class implements ClientLogin signatures for Data API requests.
|
22
|
+
# It can be used with a GData::Client::GData object.
|
23
|
+
class ClientLogin
|
24
|
+
|
25
|
+
# The ClientLogin authentication handler
|
26
|
+
attr_accessor :auth_url
|
27
|
+
# One of 'HOSTED_OR_GOOGLE', 'GOOGLE', or 'HOSTED'.
|
28
|
+
# See documentation here:
|
29
|
+
# http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html
|
30
|
+
attr_accessor :account_type
|
31
|
+
# The access token
|
32
|
+
attr_accessor :token
|
33
|
+
# The service name for the API you are working with
|
34
|
+
attr_accessor :service
|
35
|
+
|
36
|
+
# Initialize the class with the service name of an API that you wish
|
37
|
+
# to request a token for.
|
38
|
+
def initialize(service, options = {})
|
39
|
+
if service.nil?
|
40
|
+
raise ArgumentError, "Service name cannot be nil"
|
41
|
+
end
|
42
|
+
|
43
|
+
@service = service
|
44
|
+
|
45
|
+
options.each do |key, value|
|
46
|
+
self.send("#{key}=", value)
|
47
|
+
end
|
48
|
+
|
49
|
+
@auth_url ||= 'https://www.google.com/accounts/ClientLogin'
|
50
|
+
@account_type ||= 'HOSTED_OR_GOOGLE'
|
51
|
+
end
|
52
|
+
|
53
|
+
# Retrieves a token for the given username and password.
|
54
|
+
# source identifies your application.
|
55
|
+
# login_token and login_captcha are used only if you are responding
|
56
|
+
# to a previously issued CAPTCHA challenge.
|
57
|
+
def get_token(username, password, source, login_token = nil,
|
58
|
+
login_captcha = nil)
|
59
|
+
body = Hash.new
|
60
|
+
body['accountType'] = @account_type
|
61
|
+
body['Email'] = username
|
62
|
+
body['Passwd'] = password
|
63
|
+
body['service'] = @service
|
64
|
+
body['source'] = source
|
65
|
+
if login_token and login_captcha
|
66
|
+
body['logintoken'] = login_token
|
67
|
+
body['logincaptcha'] = login_captcha
|
68
|
+
end
|
69
|
+
|
70
|
+
request = GData::HTTP::Request.new(@auth_url, :body => body,
|
71
|
+
:method => :post)
|
72
|
+
service = GData::HTTP::DefaultService.new
|
73
|
+
response = service.make_request(request)
|
74
|
+
if response.status_code != 200
|
75
|
+
url = response.body[/Url=(.*)/,1]
|
76
|
+
error = response.body[/Error=(.*)/,1]
|
77
|
+
|
78
|
+
if error == "CaptchaRequired"
|
79
|
+
captcha_token = response.body[/CaptchaToken=(.*)/,1]
|
80
|
+
captcha_url = response.body[/CaptchaUrl=(.*)/,1]
|
81
|
+
raise GData::Client::CaptchaError.new(captcha_token, captcha_url),
|
82
|
+
"#{error} : #{url}"
|
83
|
+
end
|
84
|
+
|
85
|
+
raise GData::Client::AuthorizationError.new(response)
|
86
|
+
end
|
87
|
+
|
88
|
+
@token = response.body[/Auth=(.*)/,1]
|
89
|
+
return @token
|
90
|
+
end
|
91
|
+
|
92
|
+
# Creates an appropriate Authorization header on a GData::HTTP::Request
|
93
|
+
# object.
|
94
|
+
def sign_request!(request)
|
95
|
+
if @token == nil
|
96
|
+
raise GData::Client::Error, "Cannot sign request without credentials"
|
97
|
+
end
|
98
|
+
|
99
|
+
request.headers['Authorization'] = "GoogleLogin auth=#{@token}"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
data/lib/gdata/auth.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# Copyright (C) 2008 Google Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'gdata/auth/clientlogin'
|
17
|
+
require 'gdata/auth/authsub'
|
18
|
+
|
19
|
+
module GData
|
20
|
+
module Auth
|
21
|
+
SOURCE_LIB_STRING = 'GoogleDataRubyUtil-'
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# Copyright (C) 2008 Google Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module GData
|
17
|
+
module Client
|
18
|
+
|
19
|
+
# Client class to wrap working with the Apps Provisioning API.
|
20
|
+
class Apps < Base
|
21
|
+
|
22
|
+
def initialize(options = {})
|
23
|
+
options[:clientlogin_service] ||= 'apps'
|
24
|
+
super(options)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|