gdata19 0.1.9.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.
Files changed (43) hide show
  1. data/LICENSE +202 -0
  2. data/README +97 -0
  3. data/Rakefile +64 -0
  4. data/lib/gdata.rb +26 -0
  5. data/lib/gdata/auth.rb +22 -0
  6. data/lib/gdata/auth/authsub.rb +161 -0
  7. data/lib/gdata/auth/clientlogin.rb +102 -0
  8. data/lib/gdata/client.rb +84 -0
  9. data/lib/gdata/client/apps.rb +27 -0
  10. data/lib/gdata/client/base.rb +182 -0
  11. data/lib/gdata/client/blogger.rb +28 -0
  12. data/lib/gdata/client/booksearch.rb +28 -0
  13. data/lib/gdata/client/calendar.rb +58 -0
  14. data/lib/gdata/client/contacts.rb +28 -0
  15. data/lib/gdata/client/doclist.rb +28 -0
  16. data/lib/gdata/client/finance.rb +28 -0
  17. data/lib/gdata/client/gbase.rb +28 -0
  18. data/lib/gdata/client/gmail.rb +28 -0
  19. data/lib/gdata/client/health.rb +28 -0
  20. data/lib/gdata/client/notebook.rb +28 -0
  21. data/lib/gdata/client/photos.rb +29 -0
  22. data/lib/gdata/client/spreadsheets.rb +28 -0
  23. data/lib/gdata/client/webmaster_tools.rb +28 -0
  24. data/lib/gdata/client/youtube.rb +47 -0
  25. data/lib/gdata/http.rb +18 -0
  26. data/lib/gdata/http/default_service.rb +82 -0
  27. data/lib/gdata/http/mime_body.rb +95 -0
  28. data/lib/gdata/http/request.rb +74 -0
  29. data/lib/gdata/http/response.rb +44 -0
  30. data/test/tc_gdata_auth_authsub.rb +53 -0
  31. data/test/tc_gdata_auth_clientlogin.rb +59 -0
  32. data/test/tc_gdata_client_base.rb +37 -0
  33. data/test/tc_gdata_client_calendar.rb +40 -0
  34. data/test/tc_gdata_client_photos.rb +65 -0
  35. data/test/tc_gdata_client_youtube.rb +77 -0
  36. data/test/tc_gdata_http_mime_body.rb +47 -0
  37. data/test/tc_gdata_http_request.rb +36 -0
  38. data/test/test_helper.rb +47 -0
  39. data/test/ts_gdata.rb +42 -0
  40. data/test/ts_gdata_auth.rb +25 -0
  41. data/test/ts_gdata_client.rb +29 -0
  42. data/test/ts_gdata_http.rb +25 -0
  43. metadata +109 -0
@@ -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
+
3
+ # Copyright (C) 2008 Google Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ $:.unshift(File.dirname(__FILE__))
18
+ require 'test_helper'
19
+
20
+ class TC_GData_HTTP_MimeBody < Test::Unit::TestCase
21
+
22
+ include TestHelper
23
+
24
+ def test_mime_body_string
25
+ stream = GData::HTTP::MimeBodyString.new('testing 1 2 3')
26
+
27
+ self.assert_equal('t', stream.read(1))
28
+ self.assert_equal('esting', stream.read(6))
29
+ self.assert_equal(' 1 2 ', stream.read(5))
30
+ self.assert_equal('3', stream.read(50))
31
+ self.assert_equal(false, stream.read(10))
32
+ end
33
+
34
+ def test_mime_body_string_large_read
35
+ stream = GData::HTTP::MimeBodyString.new('test string')
36
+
37
+ self.assert_equal('test string', stream.read(1024))
38
+ self.assert_equal(false, stream.read(1024))
39
+ end
40
+
41
+ def test_mime_body_string_unicode
42
+ stream = GData::HTTP::MimeBodyString.new('λ')
43
+ self.assert(stream.read(1), 'Greek character should be two 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
@@ -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
@@ -0,0 +1,42 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright (C) 2008 Google Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ $:.unshift(File.dirname(__FILE__))
18
+ require 'test_helper'
19
+ require 'ts_gdata_http'
20
+ require 'ts_gdata_client'
21
+ require 'ts_gdata_auth'
22
+
23
+ class TS_GData
24
+ def self.suite
25
+ suite = Test::Unit::TestSuite.new("GData Test Suite")
26
+ suite << UnicodeStringTest.suite
27
+ suite << TS_GData_HTTP.suite
28
+ suite << TS_GData_Client.suite
29
+ suite << TS_GData_Auth.suite
30
+ return suite
31
+ end
32
+ end
33
+
34
+ class UnicodeStringTest < Test::Unit::TestCase
35
+ def test_jlength
36
+ s = "Καλημέρα κόσμε!"
37
+ assert_equal(15, s.length) # in 1.9 - unicde characters are the same length
38
+ end
39
+ end
40
+
41
+
42
+ 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
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gdata19
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 9
9
+ - 2
10
+ version: 0.1.9.2
11
+ platform: ruby
12
+ authors:
13
+ - PP
14
+ autorequire: builder
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-02 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Clone of Gdata gem designed to work for Ruby version 1.9
23
+ email: gordon@paperlesspost.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - LICENSE
30
+ - Rakefile
31
+ - README
32
+ files:
33
+ - lib/gdata/auth/authsub.rb
34
+ - lib/gdata/auth/clientlogin.rb
35
+ - lib/gdata/auth.rb
36
+ - lib/gdata/client/apps.rb
37
+ - lib/gdata/client/base.rb
38
+ - lib/gdata/client/blogger.rb
39
+ - lib/gdata/client/booksearch.rb
40
+ - lib/gdata/client/calendar.rb
41
+ - lib/gdata/client/contacts.rb
42
+ - lib/gdata/client/doclist.rb
43
+ - lib/gdata/client/finance.rb
44
+ - lib/gdata/client/gbase.rb
45
+ - lib/gdata/client/gmail.rb
46
+ - lib/gdata/client/health.rb
47
+ - lib/gdata/client/notebook.rb
48
+ - lib/gdata/client/photos.rb
49
+ - lib/gdata/client/spreadsheets.rb
50
+ - lib/gdata/client/webmaster_tools.rb
51
+ - lib/gdata/client/youtube.rb
52
+ - lib/gdata/client.rb
53
+ - lib/gdata/http/default_service.rb
54
+ - lib/gdata/http/mime_body.rb
55
+ - lib/gdata/http/request.rb
56
+ - lib/gdata/http/response.rb
57
+ - lib/gdata/http.rb
58
+ - lib/gdata.rb
59
+ - test/tc_gdata_auth_authsub.rb
60
+ - test/tc_gdata_auth_clientlogin.rb
61
+ - test/tc_gdata_client_base.rb
62
+ - test/tc_gdata_client_calendar.rb
63
+ - test/tc_gdata_client_photos.rb
64
+ - test/tc_gdata_client_youtube.rb
65
+ - test/tc_gdata_http_mime_body.rb
66
+ - test/tc_gdata_http_request.rb
67
+ - test/test_helper.rb
68
+ - test/ts_gdata.rb
69
+ - test/ts_gdata_auth.rb
70
+ - test/ts_gdata_client.rb
71
+ - test/ts_gdata_http.rb
72
+ - LICENSE
73
+ - Rakefile
74
+ - README
75
+ has_rdoc: true
76
+ homepage: http://github.com/paperlesspost/gdata
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options:
81
+ - --title
82
+ - Builder -- Easy XML Building
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ segments:
99
+ - 0
100
+ version: "0"
101
+ requirements: []
102
+
103
+ rubyforge_project:
104
+ rubygems_version: 1.3.7
105
+ signing_key:
106
+ specification_version: 3
107
+ summary: Clone of Gdata gem designed to work for Ruby version 1.9
108
+ test_files: []
109
+