gdata_19 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.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,65 @@
|
|
1
|
+
# Copyright (C) 2008 Google Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
$:.unshift(File.dirname(__FILE__))
|
16
|
+
require 'test_helper'
|
17
|
+
|
18
|
+
class TC_GData_Client_Photos < Test::Unit::TestCase
|
19
|
+
|
20
|
+
include TestHelper
|
21
|
+
|
22
|
+
def setup
|
23
|
+
@gp = GData::Client::Photos.new
|
24
|
+
@gp.source = 'Ruby Client Unit Tests'
|
25
|
+
@gp.clientlogin(self.get_username(), self.get_password())
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_authenticated_dropbox_feed
|
29
|
+
feed = @gp.get('http://picasaweb.google.com/data/feed/api/user/default/albumid/default?max-results=1').to_xml
|
30
|
+
self.assert_not_nil(feed, 'feed can not be nil')
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_photo_upload
|
34
|
+
test_image = File.join(File.dirname(__FILE__), 'testimage.jpg')
|
35
|
+
mime_type = 'image/jpeg'
|
36
|
+
|
37
|
+
response = @gp.post_file('http://picasaweb.google.com/data/feed/api/user/default/albumid/default',
|
38
|
+
test_image, mime_type).to_xml
|
39
|
+
|
40
|
+
edit_uri = response.elements["link[@rel='edit']"].attributes['href']
|
41
|
+
|
42
|
+
@gp.delete(edit_uri)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_photo_upload_with_metadata
|
46
|
+
test_image = File.join(File.dirname(__FILE__), 'testimage.jpg')
|
47
|
+
mime_type = 'image/jpeg'
|
48
|
+
|
49
|
+
entry = <<-EOF
|
50
|
+
<entry xmlns='http://www.w3.org/2005/Atom'>
|
51
|
+
<title>ruby-client-testing.jpg</title>
|
52
|
+
<summary>Test case for Ruby Client Library.</summary>
|
53
|
+
<category scheme="http://schemas.google.com/g/2005#kind"
|
54
|
+
term="http://schemas.google.com/photos/2007#photo"/>
|
55
|
+
</entry>
|
56
|
+
EOF
|
57
|
+
|
58
|
+
response = @gp.post_file('http://picasaweb.google.com/data/feed/api/user/default/albumid/default',
|
59
|
+
test_image, mime_type, entry).to_xml
|
60
|
+
|
61
|
+
edit_uri = response.elements["link[@rel='edit']"].attributes['href']
|
62
|
+
|
63
|
+
@gp.delete(edit_uri)
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright (C) 2008 Google Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
$:.unshift(File.dirname(__FILE__))
|
16
|
+
require 'test_helper'
|
17
|
+
|
18
|
+
class TC_GData_Client_YouTube < Test::Unit::TestCase
|
19
|
+
|
20
|
+
include TestHelper
|
21
|
+
|
22
|
+
def setup
|
23
|
+
@yt = GData::Client::YouTube.new
|
24
|
+
self.assert(@yt.headers.empty?, 'headers should be empty.')
|
25
|
+
@yt.clientlogin(self.get_username(), self.get_password())
|
26
|
+
@yt.client_id = 'ytapi-Google-GDataUnitTests-lcqr3u89-1'
|
27
|
+
@yt.developer_key = 'AI39si4vwXwDLR5MrtsdR1ULUD8__EnEccla-0bnqV40KpeFDIyCwEv0VJqZKHUsO3MvVM_bXHp3cAr55HmMYMhqfxzLMUgDXA'
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_authenticated_uploads_feed
|
31
|
+
|
32
|
+
|
33
|
+
feed = @yt.get('http://gdata.youtube.com/feeds/api/users/default/uploads?max-results=1').to_xml
|
34
|
+
self.assert_not_nil(feed, 'feed can not be nil')
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_favorites
|
38
|
+
|
39
|
+
video_id = 'zlfKdbWwruY'
|
40
|
+
|
41
|
+
entry = <<-EOF
|
42
|
+
<entry xmlns="http://www.w3.org/2005/Atom">
|
43
|
+
<id>#{video_id}</id>
|
44
|
+
</entry>
|
45
|
+
EOF
|
46
|
+
|
47
|
+
response = @yt.post('http://gdata.youtube.com/feeds/api/users/default/favorites', entry).to_xml
|
48
|
+
|
49
|
+
edit_uri = response.elements["link[@rel='edit']"].attributes['href']
|
50
|
+
|
51
|
+
@yt.delete(edit_uri)
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_playlist
|
56
|
+
entry = <<-EOF
|
57
|
+
<entry xmlns="http://www.w3.org/2005/Atom"
|
58
|
+
xmlns:yt="http://gdata.youtube.com/schemas/2007">
|
59
|
+
<title type="text">Ruby Utility Unit Test</title>
|
60
|
+
<summary>This is a test playlist.</summary>
|
61
|
+
</entry>
|
62
|
+
EOF
|
63
|
+
|
64
|
+
response = @yt.post('http://gdata.youtube.com/feeds/api/users/default/playlists', entry).to_xml
|
65
|
+
|
66
|
+
edit_uri = response.elements["link[@rel='edit']"].attributes['href']
|
67
|
+
|
68
|
+
response.elements["summary"].text = "Updated description"
|
69
|
+
|
70
|
+
response = @yt.put(edit_uri, response.to_s).to_xml
|
71
|
+
|
72
|
+
self.assert_equal("Updated description", response.elements["summary"].text)
|
73
|
+
|
74
|
+
@yt.delete(edit_uri)
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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
|
+
$:.unshift(File.dirname(__FILE__))
|
17
|
+
require 'test_helper'
|
18
|
+
|
19
|
+
class TC_GData_HTTP_MimeBody < Test::Unit::TestCase
|
20
|
+
|
21
|
+
include TestHelper
|
22
|
+
|
23
|
+
def test_mime_body_string
|
24
|
+
stream = GData::HTTP::MimeBodyString.new('testing 1 2 3')
|
25
|
+
|
26
|
+
self.assert_equal('t', stream.read(1))
|
27
|
+
self.assert_equal('esting', stream.read(6))
|
28
|
+
self.assert_equal(' 1 2 ', stream.read(5))
|
29
|
+
self.assert_equal('3', stream.read(50))
|
30
|
+
self.assert_equal(false, stream.read(10))
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_mime_body_string_large_read
|
34
|
+
stream = GData::HTTP::MimeBodyString.new('test string')
|
35
|
+
|
36
|
+
self.assert_equal('test string', stream.read(1024))
|
37
|
+
self.assert_equal(false, stream.read(1024))
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_mime_body_string_unicode
|
41
|
+
stream = GData::HTTP::MimeBodyString.new('λ')
|
42
|
+
self.assert(stream.read(1), 'Greek character should be two bytes')
|
43
|
+
self.assert(stream.read(1), 'Greek character should be two full bytes')
|
44
|
+
self.assert_equal(false, stream.read(1))
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Copyright (C) 2008 Google Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
$:.unshift(File.dirname(__FILE__))
|
16
|
+
require 'test_helper'
|
17
|
+
|
18
|
+
class TC_GData_HTTP_Request < Test::Unit::TestCase
|
19
|
+
|
20
|
+
include TestHelper
|
21
|
+
|
22
|
+
def test_world_is_sane
|
23
|
+
assert(true, 'World is not sane.')
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_google_is_live
|
27
|
+
request = GData::HTTP::Request.new('http://www.google.com')
|
28
|
+
|
29
|
+
service = GData::HTTP::DefaultService.new
|
30
|
+
|
31
|
+
response = service.make_request(request)
|
32
|
+
|
33
|
+
assert_equal(200, response.status_code)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright (C) 2008 Google Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'yaml'
|
16
|
+
require 'test/unit'
|
17
|
+
require 'test/unit/ui/console/testrunner'
|
18
|
+
|
19
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
20
|
+
require 'gdata'
|
21
|
+
|
22
|
+
module TestHelper
|
23
|
+
|
24
|
+
def get_config()
|
25
|
+
if not defined?(@config_file)
|
26
|
+
@config_file = YAML::load_file(File.join(File.dirname(__FILE__), 'test_config.yml'))
|
27
|
+
end
|
28
|
+
return @config_file
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_username()
|
32
|
+
return self.get_config()['username']
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_password()
|
36
|
+
return self.get_config()['password']
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_authsub_token()
|
40
|
+
return self.get_config()['authsub_token']
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_authsub_private_key()
|
44
|
+
return self.get_config()['authsub_private_key']
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/test/testimage.jpg
ADDED
Binary file
|
data/test/ts_gdata.rb
ADDED
@@ -0,0 +1,48 @@
|
|
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
|
+
$:.unshift(File.dirname(__FILE__))
|
17
|
+
require 'test_helper'
|
18
|
+
require 'ts_gdata_http'
|
19
|
+
require 'ts_gdata_client'
|
20
|
+
require 'ts_gdata_auth'
|
21
|
+
|
22
|
+
class TS_GData
|
23
|
+
def self.suite
|
24
|
+
suite = Test::Unit::TestSuite.new("GData Test Suite")
|
25
|
+
suite << UnicodeStringTest.suite
|
26
|
+
suite << TS_GData_HTTP.suite
|
27
|
+
suite << TS_GData_Client.suite
|
28
|
+
suite << TS_GData_Auth.suite
|
29
|
+
return suite
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class UnicodeStringTest < Test::Unit::TestCase
|
34
|
+
def test_jlength
|
35
|
+
s = "Καλημέρα κόσμε!"
|
36
|
+
if RUBY_VERSION < '1.9'
|
37
|
+
assert_equal(15, s.jlength) # Note the 'j'
|
38
|
+
assert_not_equal(15, s.length) # Normal, non unicode length
|
39
|
+
assert_equal(28, s.length) # Greek letters happen to take two-bytes
|
40
|
+
else
|
41
|
+
assert_equal(15, s.length) # Normal, non unicode length
|
42
|
+
assert_equal(28, s.bytesize) # Greek letters happen to take two-bytes
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
Test::Unit::UI::Console::TestRunner.run(TS_GData)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright (C) 2008 Google Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'tc_gdata_auth_clientlogin'
|
16
|
+
require 'tc_gdata_auth_authsub'
|
17
|
+
|
18
|
+
class TS_GData_Auth
|
19
|
+
def self.suite
|
20
|
+
suite = Test::Unit::TestSuite.new
|
21
|
+
suite << TC_GData_Auth_ClientLogin.suite
|
22
|
+
suite << TC_GData_Auth_AuthSub.suite
|
23
|
+
return suite
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright (C) 2008 Google Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'tc_gdata_client_base'
|
16
|
+
require 'tc_gdata_client_calendar'
|
17
|
+
require 'tc_gdata_client_photos'
|
18
|
+
require 'tc_gdata_client_youtube'
|
19
|
+
|
20
|
+
class TS_GData_Client
|
21
|
+
def self.suite
|
22
|
+
suite = Test::Unit::TestSuite.new
|
23
|
+
suite << TC_GData_Client_Base.suite
|
24
|
+
suite << TC_GData_Client_Calendar.suite
|
25
|
+
suite << TC_GData_Client_Photos.suite
|
26
|
+
suite << TC_GData_Client_YouTube.suite
|
27
|
+
return suite
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright (C) 2008 Google Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'tc_gdata_http_request'
|
16
|
+
require 'tc_gdata_http_mime_body'
|
17
|
+
|
18
|
+
class TS_GData_HTTP
|
19
|
+
def self.suite
|
20
|
+
suite = Test::Unit::TestSuite.new
|
21
|
+
suite << TC_GData_HTTP_Request.suite
|
22
|
+
suite << TC_GData_HTTP_MimeBody.suite
|
23
|
+
return suite
|
24
|
+
end
|
25
|
+
end
|