Ruby 1.9

4 views
Skip to first unread message

David King

unread,
Jul 14, 2010, 6:51:26 PM7/14/10
to gcal4ruby
Mike -- thanks for contributing this great Gem to the community.

I noticed, like Scott mentioned in an earlier post (http://
groups.google.com/group/gcal4ruby/msg/78240409464f3bad), a problem in
the GData4Module::Service class when using Ruby 1.9.

Here's a simple fix, based on Jame's Gray's post (http://
blog.grayproductions.net/articles/getting_code_ready_for_ruby_19), so
it will support Ruby 1.8 & Ruby 1.9.

--- a/gdata4ruby-0.1.2/lib/gdata4ruby/service.rb
+++ b/gdata4ruby/lib/gdata4ruby/service.rb
@@ -43,7 +43,9 @@ module GData4Ruby
ret = nil
ret = send_request(Request.new(:post, AUTH_URL,
"Email=#{username}&Passwd
if ret.class == Net::HTTPOK
- @auth_token = ret.read_body.lines.to_a[2].gsub("Auth=",
"").strip
+ body = ret.read_body
+ lines = body.send(body.respond_to?
(:lines) ? :lines : :to_s).to_a
+ @auth_token = lines.to_a[2].gsub("Auth=", "").strip
@account = username
@password = password
return true

Thanks again.

Dave

Mike Reich

unread,
Jul 23, 2010, 8:57:54 AM7/23/10
to gcal...@googlegroups.com
Hi Dave, sorry for the delay in getting back to you. Thanks for the fix - I'll get it integrated into the next release.

-Mike

Mike Reich
Seabourne Consulting
mi...@seabourneconsulting.com
425-296-2440

Reply all
Reply to author
Forward
0 new messages