I asked help from Ruby google_spreadsheet author Hiroshi Ichikawa. He was kindly responded with great pointers.
1. set environment variable in R1 t.rb script bash-3.00$ grep proxy t.rb ENV["http_proxy"] = "http://wwwproxy.test.com:2080" bash-3.00$ This will trigger a http connection via proxy 2. Use the latest version from github. http://rubygems.org/gems/google-spreadsheet-ruby is updated with version github sudo gem uninstall google-spreadsheet-ruby git clone git://github.com/gimite/google-spreadsheet-ruby.git cd google-spreadsheet-ruby.gemspec gem build google-spreadsheet-ruby.gemspec sudo gem install google-spreadsheet-ruby-0.1.2.gem tj On Mon, May 2, 2011 at 5:09 PM, TJ Yang <[email protected]> wrote: > I want to use ruby script language to create/modify google spreadsheet > behind firewall with the proxy of http://wwwproxy.test.com:2080 setting. > I am able to use Ruby's "google_spreadsheet" rubygem (see R1) to > create/query Google Spreadsheet using my personal and corporate Google > accounts from home network. The problem is how do I do the same for networks > behind corporate firewall ? > The hurdle I am facing is how do I configure the proxy setting in Ruby ? > Looking at Ruby's API guide in R2 but can't find out how to set http proxy > info. > I haven't read through all the online docs and forum discussion yet. > Please let me know if you have a pointer on how to have ruby interact with > Google spreadsheets behind a http proxy. > Thanks > tj > R1: ruby sample code > #! /usr/bin/ruby > require "rubygems" > require "google_spreadsheet" > # Logs in. > # > session = GoogleSpreadsheet.login("[email protected]", "mypassword") > # First worksheet of > http://spreadsheets.google.com/ccc?key=xxWlvmLseKRa2JV5CphdnZw&hl=en > ws = session.spreadsheet_by_key("xxWlvmLseKRa2JV5CphdnZw").worksheets[0] > # Gets content of A2 cell. > p ws[2, 1] #==> "hoge" > # Changes content of cells. Changes are not sent to the server until you > call ws.save(). > ws[2, 1] = "foo" > ws[2, 2] = "bar" > ws.save() > # Dumps all cells. > for row in 1..ws.num_rows > for col in 1..ws.num_cols > p ws[row, col] > end > end > R2: http://code.google.com/apis/gdata/articles/using_ruby.html > -- T.J. Yang
