Permalink
Browse files

Renaming GoogleSpreadsheet to GoogleDrive.

  • Loading branch information...
1 parent 73ead7a commit bf1cc394c2e71ca758ee944198c20651c4c53d9c @gimite committed Apr 29, 2012
Showing with 181 additions and 203 deletions.
  1. +1 −1 Gemfile
  2. +3 −3 doc_src/{google_spreadsheet → google_drive}/acl.rb
  3. +1 −1 doc_src/{google_spreadsheet → google_drive}/acl_entry.rb
  4. +0 −46 google-spreadsheet-ruby.gemspec
  5. +23 −0 google_drive.gemspec
  6. +10 −10 lib/{google_spreadsheet.rb → google_drive.rb}
  7. +7 −7 lib/{google_spreadsheet → google_drive}/acl.rb
  8. +2 −2 lib/{google_spreadsheet → google_drive}/acl_entry.rb
  9. +14 −0 lib/google_drive/authentication_error.rb
  10. +1 −1 lib/{google_spreadsheet → google_drive}/client_login_fetcher.rb
  11. +6 −6 lib/{google_spreadsheet → google_drive}/collection.rb
  12. +1 −1 lib/{google_spreadsheet → google_drive}/error.rb
  13. +8 −8 lib/{google_spreadsheet → google_drive}/file.rb
  14. +15 −15 lib/{google_spreadsheet → google_drive}/list.rb
  15. +4 −4 lib/{google_spreadsheet → google_drive}/list_row.rb
  16. +1 −1 lib/{google_spreadsheet → google_drive}/oauth1_fetcher.rb
  17. +1 −1 lib/{google_spreadsheet → google_drive}/oauth2_fetcher.rb
  18. +4 −4 lib/{google_spreadsheet → google_drive}/record.rb
  19. +36 −36 lib/{google_spreadsheet → google_drive}/session.rb
  20. +14 −14 lib/{google_spreadsheet → google_drive}/spreadsheet.rb
  21. +6 −6 lib/{google_spreadsheet → google_drive}/table.rb
  22. +1 −1 lib/{google_spreadsheet → google_drive}/util.rb
  23. +13 −13 lib/{google_spreadsheet → google_drive}/worksheet.rb
  24. +0 −14 lib/google_spreadsheet/authentication_error.rb
  25. +2 −1 script/gen-rdoc
  26. +7 −7 test/{test_google_spreadsheet.rb → test_google_drive.rb}
View
@@ -1,3 +1,3 @@
source "http://rubygems.org"
-gemspec :name => "google-spreadsheet-ruby"
+gemspec :name => "google_drive"
gem "highline", ">= 1.5.1", :group => :test
@@ -1,16 +1,16 @@
-module GoogleSpreadsheet
+module GoogleDrive
class Acl
# Returns the number of entries.
def size
end
- # Returns GoogleSpreadsheet::AclEntry object at +index+.
+ # Returns GoogleDrive::AclEntry object at +index+.
def [](index)
end
- # Iterates over GoogleSpreadsheet::AclEntry objects.
+ # Iterates over GoogleDrive::AclEntry objects.
def each(&block)
yield(entry)
end
@@ -1,4 +1,4 @@
-module GoogleSpreadsheet
+module GoogleDrive
class AclEntry
@@ -1,46 +0,0 @@
-Gem::Specification.new do |s|
-
- s.name = "google-spreadsheet-ruby"
- s.version = "0.2.1"
- s.authors = ["Hiroshi Ichikawa"]
- s.email = ["gimite+github@gmail.com"]
- s.summary = "This is a library to read/write Google Spreadsheet."
- s.description = "This is a library to read/write Google Spreadsheet."
- s.homepage = "https://github.com/gimite/google-spreadsheet-ruby"
- s.rubygems_version = "1.2.0"
-
- s.files = [
- "README.rdoc",
- "lib/google_spreadsheet.rb",
- "lib/google_spreadsheet/acl.rb",
- "lib/google_spreadsheet/acl_entry.rb",
- "lib/google_spreadsheet/authentication_error.rb",
- "lib/google_spreadsheet/client_login_fetcher.rb",
- "lib/google_spreadsheet/collection.rb",
- "lib/google_spreadsheet/error.rb",
- "lib/google_spreadsheet/list.rb",
- "lib/google_spreadsheet/list_row.rb",
- "lib/google_spreadsheet/oauth1_fetcher.rb",
- "lib/google_spreadsheet/oauth2_fetcher.rb",
- "lib/google_spreadsheet/record.rb",
- "lib/google_spreadsheet/session.rb",
- "lib/google_spreadsheet/spreadsheet.rb",
- "lib/google_spreadsheet/table.rb",
- "lib/google_spreadsheet/util.rb",
- "lib/google_spreadsheet/worksheet.rb",
- ]
- s.require_paths = ["lib"]
- s.has_rdoc = true
- s.extra_rdoc_files = [
- "README.rdoc",
- "doc_src/google_spreadsheet/acl.rb",
- "doc_src/google_spreadsheet/acl_entry.rb",
- ]
- s.rdoc_options = ["--main", "README.rdoc"]
-
- s.add_dependency("nokogiri", [">= 1.4.4", "!= 1.5.1", "!= 1.5.2"])
- s.add_dependency("oauth", [">= 0.3.6"])
- s.add_dependency("oauth2", [">= 0.5.0"])
- s.add_development_dependency("rake", [">= 0.8.0"])
-
-end
View
@@ -0,0 +1,23 @@
+Gem::Specification.new do |s|
+
+ s.name = "google_drive"
+ s.version = "0.3.0"
+ s.authors = ["Hiroshi Ichikawa"]
+ s.email = ["gimite+github@gmail.com"]
+ s.summary = "A library to read/write files/spreadsheets in Google Drive/Docs."
+ s.description = "A library to read/write files/spreadsheets in Google Drive/Docs."
+ s.homepage = "https://github.com/gimite/google-drive-ruby"
+ s.rubygems_version = "1.2.0"
+
+ s.files = ["README.rdoc"] + Dir["lib/**/*"]
+ s.require_paths = ["lib"]
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README.rdoc"] + Dir["doc_src/**/*"]
+ s.rdoc_options = ["--main", "README.rdoc"]
+
+ s.add_dependency("nokogiri", [">= 1.4.4", "!= 1.5.1", "!= 1.5.2"])
+ s.add_dependency("oauth", [">= 0.3.6"])
+ s.add_dependency("oauth2", [">= 0.5.0"])
+ s.add_development_dependency("rake", [">= 0.8.0"])
+
+end
@@ -1,13 +1,13 @@
# Author: Hiroshi Ichikawa <http://gimite.net/>
# The license of this source is "New BSD Licence"
-require "google_spreadsheet/session"
+require "google_drive/session"
-module GoogleSpreadsheet
+module GoogleDrive
- # Authenticates with given +mail+ and +password+, and returns GoogleSpreadsheet::Session
- # if succeeds. Raises GoogleSpreadsheet::AuthenticationError if fails.
+ # Authenticates with given +mail+ and +password+, and returns GoogleDrive::Session
+ # if succeeds. Raises GoogleDrive::AuthenticationError if fails.
# Google Apps account is supported.
#
# +proxy+ can be nil or return value of Net::HTTP.Proxy. If +proxy+ is specified, all
@@ -33,14 +33,14 @@ def self.login(mail, password, proxy = nil)
# # Redirect the user to auth_url and get authorization code from redirect URL.
# auth_token = client.auth_code.get_token(
# authorization_code, :redirect_uri => "http://example.com/")
- # session = GoogleSpreadsheet.login_with_oauth(auth_token)
+ # session = GoogleDrive.login_with_oauth(auth_token)
#
# Or, from existing refresh token:
#
# access_token = OAuth2::AccessToken.from_hash(client,
# {:refresh_token => refresh_token, :expires_at => expires_at})
# access_token = access_token.refresh!
- # session = GoogleSpreadsheet.login_with_oauth(access_token)
+ # session = GoogleDrive.login_with_oauth(access_token)
#
# OAuth1 code example:
#
@@ -68,19 +68,19 @@ def self.login_with_oauth(oauth_token)
# Restores session using return value of auth_tokens method of previous session.
#
- # See GoogleSpreadsheet.login for description of parameter +proxy+.
+ # See GoogleDrive.login for description of parameter +proxy+.
def self.restore_session(auth_tokens, proxy = nil)
return Session.restore_session(auth_tokens, proxy)
end
- # Restores GoogleSpreadsheet::Session from +path+ and returns it.
+ # Restores GoogleDrive::Session from +path+ and returns it.
# If +path+ doesn't exist or authentication has failed, prompts mail and password on console,
# authenticates with them, stores the session to +path+ and returns it.
#
# See login for description of parameter +proxy+.
#
# This method requires Highline library: http://rubyforge.org/projects/highline/
- def self.saved_session(path = ENV["HOME"] + "/.ruby_google_spreadsheet.token", proxy = nil)
+ def self.saved_session(path = ENV["HOME"] + "/.ruby_google_drive.token", proxy = nil)
tokens = {}
if ::File.exist?(path)
open(path) do |f|
@@ -96,7 +96,7 @@ def self.saved_session(path = ENV["HOME"] + "/.ruby_google_spreadsheet.token", p
require "highline"
rescue LoadError
raise(LoadError,
- "GoogleSpreadsheet.saved_session requires Highline library.\n" +
+ "GoogleDrive.saved_session requires Highline library.\n" +
"Run\n" +
" \$ sudo gem install highline\n" +
"to install it.")
@@ -3,15 +3,15 @@
# Author: Hiroshi Ichikawa <http://gimite.net/>
# The license of this source is "New BSD Licence"
-require "google_spreadsheet/acl_entry"
+require "google_drive/acl_entry"
-module GoogleSpreadsheet
+module GoogleDrive
# ACL (access control list) of a spreadsheet.
#
- # Use GoogleSpreadsheet::Spreadsheet#acl to get GoogleSpreadsheet::Acl object.
- # See GoogleSpreadsheet::Spreadsheet#acl for usage example.
+ # Use GoogleDrive::Spreadsheet#acl to get GoogleDrive::Acl object.
+ # See GoogleDrive::Spreadsheet#acl for usage example.
#
# This code is based on https://github.com/guyboertje/gdata-spreadsheet-ruby .
class Acl
@@ -29,9 +29,9 @@ def initialize(session, acls_feed_url) #:nodoc:
def_delegators(:@acls, :size, :[], :each)
- # Adds a new entry. +entry+ is either a GoogleSpreadsheet::AclEntry or a Hash with keys
- # :scope_type, :scope and :role. See GoogleSpreadsheet::AclEntry#scope_type and
- # GoogleSpreadsheet::AclEntry#role for the document of the fields.
+ # Adds a new entry. +entry+ is either a GoogleDrive::AclEntry or a Hash with keys
+ # :scope_type, :scope and :role. See GoogleDrive::AclEntry#scope_type and
+ # GoogleDrive::AclEntry#role for the document of the fields.
#
# NOTE: This sends email to the new people.
#
@@ -6,11 +6,11 @@
# acl.rb, derived from https://github.com/guyboertje/gdata-spreadsheet-ruby/blob/master/lib/document.rb
# more frankensteining of the original library
-module GoogleSpreadsheet
+module GoogleDrive
# An entry of an ACL (access control list) of a spreadsheet.
#
- # Use GoogleSpreadsheet::Acl#[] to get GoogleSpreadsheet::AclEntry object.
+ # Use GoogleDrive::Acl#[] to get GoogleDrive::AclEntry object.
#
# This code is based on https://github.com/guyboertje/gdata-spreadsheet-ruby .
class AclEntry
@@ -0,0 +1,14 @@
+# Author: Hiroshi Ichikawa <http://gimite.net/>
+# The license of this source is "New BSD Licence"
+
+require "google_drive/error"
+
+
+module GoogleDrive
+
+ # Raised when GoogleDrive.login has failed.
+ class AuthenticationError < GoogleDrive::Error
+
+ end
+
+end
@@ -6,7 +6,7 @@
Net::HTTP.version_1_2
-module GoogleSpreadsheet
+module GoogleDrive
class ClientLoginFetcher #:nodoc:
@@ -1,14 +1,14 @@
# Author: Hiroshi Ichikawa <http://gimite.net/>
# The license of this source is "New BSD Licence"
-require "google_spreadsheet/util"
-require "google_spreadsheet/error"
-require "google_spreadsheet/spreadsheet"
+require "google_drive/util"
+require "google_drive/error"
+require "google_drive/spreadsheet"
-module GoogleSpreadsheet
+module GoogleDrive
- # Use GoogleSpreadsheet::Session#collection_by_url to get GoogleSpreadsheet::Collection object.
+ # Use GoogleDrive::Session#collection_by_url to get GoogleDrive::Collection object.
class Collection
include(Util)
@@ -20,7 +20,7 @@ def initialize(session, collection_feed_url) #:nodoc:
attr_reader(:collection_feed_url)
- # Adds the given GoogleSpreadsheet::File to the collection.
+ # Adds the given GoogleDrive::File to the collection.
def add(file)
contents_url = concat_url(@collection_feed_url, "/contents")
header = {"GData-Version" => "3.0", "Content-Type" => "application/atom+xml"}
@@ -2,7 +2,7 @@
# The license of this source is "New BSD Licence"
-module GoogleSpreadsheet
+module GoogleDrive
# Raised when spreadsheets.google.com has returned error.
class Error < RuntimeError
@@ -3,15 +3,15 @@
require "stringio"
-require "google_spreadsheet/util"
-require "google_spreadsheet/acl"
+require "google_drive/util"
+require "google_drive/acl"
-module GoogleSpreadsheet
+module GoogleDrive
# A file in Google Drive, including Google Docs document/spreadsheet/presentation.
#
- # Use GoogleSpreadsheet::Session#files or GoogleSpreadsheet::Session#file_by_title to
+ # Use GoogleDrive::Session#files or GoogleDrive::Session#file_by_title to
# get this object.
class File
@@ -52,7 +52,7 @@ def acl_feed_url
# URL of old API version. Converts to v3 URL.
return "https://docs.google.com/feeds/default/private/full/#{$1}/acl"
else
- raise(GoogleSpreadsheet::Error,
+ raise(GoogleDrive::Error,
"ACL feed URL is in unknown format: #{orig_acl_feed_url}")
end
end
@@ -102,12 +102,12 @@ def download_to_io(io, params = {})
url = contents[0]["src"]
else
if contents.empty?
- raise(GoogleSpreadsheet::Error,
+ raise(GoogleDrive::Error,
("Downloading with content type %p not supported for this file. " +
"Specify one of these to content_type: %p") %
[params[:content_type], self.available_content_types])
else
- raise(GoogleSpreadsheet::Error,
+ raise(GoogleDrive::Error,
("Multiple content types are available for this file. " +
"Specify one of these to content_type: %p") %
[self.available_content_types])
@@ -175,7 +175,7 @@ def rename(title)
alias title= rename
- # Returns GoogleSpreadsheet::Acl object for the file.
+ # Returns GoogleDrive::Acl object for the file.
#
# With the object, you can see and modify people who can access the file.
# Modifications take effect immediately.
Oops, something went wrong.

0 comments on commit bf1cc39

Please sign in to comment.