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.
Files changed (49) hide show
  1. data/.gitignore +8 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +202 -0
  4. data/README +97 -0
  5. data/Rakefile +2 -0
  6. data/gdata.gemspec +44 -0
  7. data/lib/gdata.rb +24 -0
  8. data/lib/gdata/auth.rb +22 -0
  9. data/lib/gdata/auth/authsub.rb +161 -0
  10. data/lib/gdata/auth/clientlogin.rb +102 -0
  11. data/lib/gdata/client.rb +84 -0
  12. data/lib/gdata/client/apps.rb +27 -0
  13. data/lib/gdata/client/base.rb +182 -0
  14. data/lib/gdata/client/blogger.rb +28 -0
  15. data/lib/gdata/client/booksearch.rb +28 -0
  16. data/lib/gdata/client/calendar.rb +58 -0
  17. data/lib/gdata/client/contacts.rb +28 -0
  18. data/lib/gdata/client/doclist.rb +28 -0
  19. data/lib/gdata/client/finance.rb +28 -0
  20. data/lib/gdata/client/gbase.rb +28 -0
  21. data/lib/gdata/client/gmail.rb +28 -0
  22. data/lib/gdata/client/health.rb +28 -0
  23. data/lib/gdata/client/notebook.rb +28 -0
  24. data/lib/gdata/client/photos.rb +29 -0
  25. data/lib/gdata/client/spreadsheets.rb +28 -0
  26. data/lib/gdata/client/webmaster_tools.rb +28 -0
  27. data/lib/gdata/client/youtube.rb +47 -0
  28. data/lib/gdata/http.rb +18 -0
  29. data/lib/gdata/http/default_service.rb +82 -0
  30. data/lib/gdata/http/mime_body.rb +95 -0
  31. data/lib/gdata/http/request.rb +74 -0
  32. data/lib/gdata/http/response.rb +44 -0
  33. data/lib/gdata/version.rb +3 -0
  34. data/test/tc_gdata_auth_authsub.rb +54 -0
  35. data/test/tc_gdata_auth_clientlogin.rb +60 -0
  36. data/test/tc_gdata_client_base.rb +38 -0
  37. data/test/tc_gdata_client_calendar.rb +41 -0
  38. data/test/tc_gdata_client_photos.rb +66 -0
  39. data/test/tc_gdata_client_youtube.rb +78 -0
  40. data/test/tc_gdata_http_mime_body.rb +47 -0
  41. data/test/tc_gdata_http_request.rb +37 -0
  42. data/test/test_config.yml.example +7 -0
  43. data/test/test_helper.rb +47 -0
  44. data/test/testimage.jpg +0 -0
  45. data/test/ts_gdata.rb +44 -0
  46. data/test/ts_gdata_auth.rb +26 -0
  47. data/test/ts_gdata_client.rb +30 -0
  48. data/test/ts_gdata_http.rb +25 -0
  49. metadata +129 -0
@@ -0,0 +1,78 @@
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_Client_YouTube < Test::Unit::TestCase
20
+
21
+ include TestHelper
22
+
23
+ def setup
24
+ @yt = GData::Client::YouTube.new
25
+ self.assert(@yt.headers.empty?, 'headers should be empty.')
26
+ @yt.clientlogin(self.get_username(), self.get_password())
27
+ @yt.client_id = 'ytapi-Google-GDataUnitTests-lcqr3u89-1'
28
+ @yt.developer_key = 'AI39si4vwXwDLR5MrtsdR1ULUD8__EnEccla-0bnqV40KpeFDIyCwEv0VJqZKHUsO3MvVM_bXHp3cAr55HmMYMhqfxzLMUgDXA'
29
+ end
30
+
31
+ def test_authenticated_uploads_feed
32
+
33
+
34
+ feed = @yt.get('http://gdata.youtube.com/feeds/api/users/default/uploads?max-results=1').to_xml
35
+ self.assert_not_nil(feed, 'feed can not be nil')
36
+ end
37
+
38
+ def test_favorites
39
+
40
+ video_id = 'zlfKdbWwruY'
41
+
42
+ entry = <<-EOF
43
+ <entry xmlns="http://www.w3.org/2005/Atom">
44
+ <id>#{video_id}</id>
45
+ </entry>
46
+ EOF
47
+
48
+ response = @yt.post('http://gdata.youtube.com/feeds/api/users/default/favorites', entry).to_xml
49
+
50
+ edit_uri = response.elements["link[@rel='edit']"].attributes['href']
51
+
52
+ @yt.delete(edit_uri)
53
+
54
+ end
55
+
56
+ def test_playlist
57
+ entry = <<-EOF
58
+ <entry xmlns="http://www.w3.org/2005/Atom"
59
+ xmlns:yt="http://gdata.youtube.com/schemas/2007">
60
+ <title type="text">Ruby Utility Unit Test</title>
61
+ <summary>This is a test playlist.</summary>
62
+ </entry>
63
+ EOF
64
+
65
+ response = @yt.post('http://gdata.youtube.com/feeds/api/users/default/playlists', entry).to_xml
66
+
67
+ edit_uri = response.elements["link[@rel='edit']"].attributes['href']
68
+
69
+ response.elements["summary"].text = "Updated description"
70
+
71
+ response = @yt.put(edit_uri, response.to_s).to_xml
72
+
73
+ self.assert_equal("Updated description", response.elements["summary"].text)
74
+
75
+ @yt.delete(edit_uri)
76
+ end
77
+
78
+ 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,37 @@
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_Request < Test::Unit::TestCase
20
+
21
+ include TestHelper
22
+
23
+ def test_world_is_sane
24
+ assert(true, 'World is not sane.')
25
+ end
26
+
27
+ def test_google_is_live
28
+ request = GData::HTTP::Request.new('http://www.google.com')
29
+
30
+ service = GData::HTTP::DefaultService.new
31
+
32
+ response = service.make_request(request)
33
+
34
+ assert_equal(200, response.status_code)
35
+ end
36
+
37
+ end
@@ -0,0 +1,7 @@
1
+ ---
2
+ username: myaccount
3
+ password: mypassword
4
+ # uncomment to test authsub
5
+ #authsub_token: someauthsubtoken
6
+ # uncomment to test secure authsub
7
+ #authsub_private_key: /path/to/private/key
@@ -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
Binary file
data/test/ts_gdata.rb ADDED
@@ -0,0 +1,44 @@
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
+
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.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
+ end
41
+ end
42
+
43
+
44
+ Test::Unit::UI::Console::TestRunner.run(TS_GData)
@@ -0,0 +1,26 @@
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 'tc_gdata_auth_clientlogin'
17
+ require 'tc_gdata_auth_authsub'
18
+
19
+ class TS_GData_Auth
20
+ def self.suite
21
+ suite = Test::Unit::TestSuite.new
22
+ suite << TC_GData_Auth_ClientLogin.suite
23
+ suite << TC_GData_Auth_AuthSub.suite
24
+ return suite
25
+ end
26
+ end
@@ -0,0 +1,30 @@
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 'tc_gdata_client_base'
17
+ require 'tc_gdata_client_calendar'
18
+ require 'tc_gdata_client_photos'
19
+ require 'tc_gdata_client_youtube'
20
+
21
+ class TS_GData_Client
22
+ def self.suite
23
+ suite = Test::Unit::TestSuite.new
24
+ suite << TC_GData_Client_Base.suite
25
+ suite << TC_GData_Client_Calendar.suite
26
+ suite << TC_GData_Client_Photos.suite
27
+ suite << TC_GData_Client_YouTube.suite
28
+ return suite
29
+ end
30
+ 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,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gdata-19
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.1.2
6
+ platform: ruby
7
+ authors:
8
+ - This is the gdata ruby gem. Minor updates for Ruby 1.9.
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-28 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: test-unit
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :development
25
+ version_requirements: *id001
26
+ description: A Ruby gem designed to assist Ruby developers in working with Google Data APIs
27
+ email:
28
+ - bridgeutopia@gmail.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files: []
34
+
35
+ files:
36
+ - ._Rakefile
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE
40
+ - README
41
+ - Rakefile
42
+ - gdata.gemspec
43
+ - lib/._gdata.rb
44
+ - lib/gdata.rb
45
+ - lib/gdata/auth.rb
46
+ - lib/gdata/auth/authsub.rb
47
+ - lib/gdata/auth/clientlogin.rb
48
+ - lib/gdata/client.rb
49
+ - lib/gdata/client/apps.rb
50
+ - lib/gdata/client/base.rb
51
+ - lib/gdata/client/blogger.rb
52
+ - lib/gdata/client/booksearch.rb
53
+ - lib/gdata/client/calendar.rb
54
+ - lib/gdata/client/contacts.rb
55
+ - lib/gdata/client/doclist.rb
56
+ - lib/gdata/client/finance.rb
57
+ - lib/gdata/client/gbase.rb
58
+ - lib/gdata/client/gmail.rb
59
+ - lib/gdata/client/health.rb
60
+ - lib/gdata/client/notebook.rb
61
+ - lib/gdata/client/photos.rb
62
+ - lib/gdata/client/spreadsheets.rb
63
+ - lib/gdata/client/webmaster_tools.rb
64
+ - lib/gdata/client/youtube.rb
65
+ - lib/gdata/http.rb
66
+ - lib/gdata/http/default_service.rb
67
+ - lib/gdata/http/mime_body.rb
68
+ - lib/gdata/http/request.rb
69
+ - lib/gdata/http/response.rb
70
+ - lib/gdata/version.rb
71
+ - test/._tc_gdata_auth_authsub.rb
72
+ - test/tc_gdata_auth_authsub.rb
73
+ - test/tc_gdata_auth_clientlogin.rb
74
+ - test/tc_gdata_client_base.rb
75
+ - test/tc_gdata_client_calendar.rb
76
+ - test/tc_gdata_client_photos.rb
77
+ - test/tc_gdata_client_youtube.rb
78
+ - test/tc_gdata_http_mime_body.rb
79
+ - test/tc_gdata_http_request.rb
80
+ - test/test_config.yml.example
81
+ - test/test_helper.rb
82
+ - test/testimage.jpg
83
+ - test/ts_gdata.rb
84
+ - test/ts_gdata_auth.rb
85
+ - test/ts_gdata_client.rb
86
+ - test/ts_gdata_http.rb
87
+ homepage: ""
88
+ licenses: []
89
+
90
+ post_install_message:
91
+ rdoc_options: []
92
+
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: "0"
107
+ requirements: []
108
+
109
+ rubyforge_project: gdata
110
+ rubygems_version: 1.7.2
111
+ signing_key:
112
+ specification_version: 3
113
+ summary: A Ruby gem designed to assist Ruby developers in working with Google Data APIs
114
+ test_files:
115
+ - test/tc_gdata_auth_authsub.rb
116
+ - test/tc_gdata_auth_clientlogin.rb
117
+ - test/tc_gdata_client_base.rb
118
+ - test/tc_gdata_client_calendar.rb
119
+ - test/tc_gdata_client_photos.rb
120
+ - test/tc_gdata_client_youtube.rb
121
+ - test/tc_gdata_http_mime_body.rb
122
+ - test/tc_gdata_http_request.rb
123
+ - test/test_config.yml.example
124
+ - test/test_helper.rb
125
+ - test/testimage.jpg
126
+ - test/ts_gdata.rb
127
+ - test/ts_gdata_auth.rb
128
+ - test/ts_gdata_client.rb
129
+ - test/ts_gdata_http.rb