google_drive 1.0.0.pre1 → 1.0.0.pre2

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +9 -2
  3. data/lib/google_drive/api_client_fetcher.rb +3 -0
  4. data/lib/google_drive/authentication_error.rb +2 -2
  5. data/lib/google_drive/error.rb +1 -1
  6. data/lib/google_drive/response_code_error.rb +24 -0
  7. data/lib/google_drive/session.rb +4 -5
  8. data/lib/google_drive/worksheet.rb +39 -45
  9. data/lib/{google_drive_v1.rb → google_drive_v0.rb} +9 -9
  10. data/lib/{google_drive_v1 → google_drive_v0}/acl.rb +7 -7
  11. data/lib/{google_drive_v1 → google_drive_v0}/acl_entry.rb +3 -3
  12. data/lib/{google_drive_v1 → google_drive_v0}/api_client_fetcher.rb +1 -1
  13. data/lib/google_drive_v0/authentication_error.rb +14 -0
  14. data/lib/{google_drive_v1 → google_drive_v0}/basic_fetcher.rb +1 -1
  15. data/lib/{google_drive_v1 → google_drive_v0}/client_login_fetcher.rb +2 -2
  16. data/lib/{google_drive_v1 → google_drive_v0}/collection.rb +12 -12
  17. data/lib/{google_drive_v1 → google_drive_v0}/error.rb +1 -1
  18. data/lib/{google_drive_v1 → google_drive_v0}/file.rb +9 -9
  19. data/lib/{google_drive_v1 → google_drive_v0}/list.rb +15 -15
  20. data/lib/{google_drive_v1 → google_drive_v0}/list_row.rb +4 -4
  21. data/lib/{google_drive_v1 → google_drive_v0}/oauth1_fetcher.rb +1 -1
  22. data/lib/{google_drive_v1 → google_drive_v0}/oauth2_fetcher.rb +2 -2
  23. data/lib/{google_drive_v1 → google_drive_v0}/record.rb +4 -4
  24. data/lib/{google_drive_v1 → google_drive_v0}/session.rb +45 -45
  25. data/lib/{google_drive_v1 → google_drive_v0}/spreadsheet.rb +17 -17
  26. data/lib/{google_drive_v1 → google_drive_v0}/table.rb +6 -6
  27. data/lib/{google_drive_v1 → google_drive_v0}/util.rb +1 -1
  28. data/lib/{google_drive_v1 → google_drive_v0}/worksheet.rb +13 -13
  29. metadata +23 -22
  30. data/lib/google_drive_v1/authentication_error.rb +0 -14
@@ -3,20 +3,20 @@
3
3
 
4
4
  require "time"
5
5
 
6
- require "google_drive_v1/util"
7
- require "google_drive_v1/error"
8
- require "google_drive_v1/worksheet"
9
- require "google_drive_v1/table"
10
- require "google_drive_v1/acl"
11
- require "google_drive_v1/file"
6
+ require "google_drive_v0/util"
7
+ require "google_drive_v0/error"
8
+ require "google_drive_v0/worksheet"
9
+ require "google_drive_v0/table"
10
+ require "google_drive_v0/acl"
11
+ require "google_drive_v0/file"
12
12
 
13
13
 
14
- module GoogleDriveV1
14
+ module GoogleDriveV0
15
15
 
16
16
  # A spreadsheet.
17
17
  #
18
- # Use methods in GoogleDriveV1::Session to get GoogleDriveV1::Spreadsheet object.
19
- class Spreadsheet < GoogleDriveV1::File
18
+ # Use methods in GoogleDriveV0::Session to get GoogleDriveV0::Spreadsheet object.
19
+ class Spreadsheet < GoogleDriveV0::File
20
20
 
21
21
  include(Util)
22
22
 
@@ -45,7 +45,7 @@ module GoogleDriveV1
45
45
  def key
46
46
  if !(@worksheets_feed_url =~
47
47
  %r{^https?://spreadsheets.google.com/feeds/worksheets/(.*)/private/.*$})
48
- raise(GoogleDriveV1::Error,
48
+ raise(GoogleDriveV0::Error,
49
49
  "Worksheets feed URL is in unknown format: #{@worksheets_feed_url}")
50
50
  end
51
51
  return $1
@@ -85,7 +85,7 @@ module GoogleDriveV1
85
85
  # Set <tt>params[:reload]</tt> to true to force reloading the feed.
86
86
  def spreadsheet_feed_entry(params = {})
87
87
  warn(
88
- "WARNING: GoogleDriveV1::Spreadsheet\#spreadsheet_feed_entry is deprecated and will be removed " +
88
+ "WARNING: GoogleDriveV0::Spreadsheet\#spreadsheet_feed_entry is deprecated and will be removed " +
89
89
  "in the next version.")
90
90
  return spreadsheet_feed_entry_internal(params)
91
91
  end
@@ -103,7 +103,7 @@ module GoogleDriveV1
103
103
  # Set <tt>params[:reload]</tt> to true to force reloading the feed.
104
104
  def document_feed_entry(params = {})
105
105
  warn(
106
- "WARNING: GoogleDriveV1::Spreadsheet\#document_feed_entry is deprecated and will be removed " +
106
+ "WARNING: GoogleDriveV0::Spreadsheet\#document_feed_entry is deprecated and will be removed " +
107
107
  "in the next version.")
108
108
  if !@document_feed_entry || params[:reload]
109
109
  @document_feed_entry =
@@ -179,14 +179,14 @@ module GoogleDriveV1
179
179
  # authorization token, and it has a bug that it downloads PDF when text/html is
180
180
  # requested.
181
181
  raise(NotImplementedError,
182
- "Use export_as_file or export_as_string instead for GoogleDriveV1::Spreadsheet.")
182
+ "Use export_as_file or export_as_string instead for GoogleDriveV0::Spreadsheet.")
183
183
  end
184
184
 
185
- # Returns worksheets of the spreadsheet as array of GoogleDriveV1::Worksheet.
185
+ # Returns worksheets of the spreadsheet as array of GoogleDriveV0::Worksheet.
186
186
  def worksheets
187
187
  doc = @session.request(:get, @worksheets_feed_url)
188
188
  if doc.root.name != "feed"
189
- raise(GoogleDriveV1::Error,
189
+ raise(GoogleDriveV0::Error,
190
190
  "%s doesn't look like a worksheets feed URL because its root is not <feed>." %
191
191
  @worksheets_feed_url)
192
192
  end
@@ -201,7 +201,7 @@ module GoogleDriveV1
201
201
  return result.freeze()
202
202
  end
203
203
 
204
- # Returns a GoogleDriveV1::Worksheet with the given title in the spreadsheet.
204
+ # Returns a GoogleDriveV0::Worksheet with the given title in the spreadsheet.
205
205
  #
206
206
  # Returns nil if not found. Returns the first one when multiple worksheets with the
207
207
  # title are found.
@@ -209,7 +209,7 @@ module GoogleDriveV1
209
209
  return self.worksheets.find(){ |ws| ws.title == title }
210
210
  end
211
211
 
212
- # Adds a new worksheet to the spreadsheet. Returns added GoogleDriveV1::Worksheet.
212
+ # Adds a new worksheet to the spreadsheet. Returns added GoogleDriveV0::Worksheet.
213
213
  def add_worksheet(title, max_rows = 100, max_cols = 20)
214
214
  xml = <<-"EOS"
215
215
  <entry xmlns='http://www.w3.org/2005/Atom'
@@ -1,18 +1,18 @@
1
1
  # Author: Hiroshi Ichikawa <http://gimite.net/>
2
2
  # The license of this source is "New BSD Licence"
3
3
 
4
- require "google_drive_v1/util"
5
- require "google_drive_v1/error"
6
- require "google_drive_v1/record"
4
+ require "google_drive_v0/util"
5
+ require "google_drive_v0/error"
6
+ require "google_drive_v0/record"
7
7
 
8
8
 
9
- module GoogleDriveV1
9
+ module GoogleDriveV0
10
10
 
11
11
  # DEPRECATED: Table and Record feeds are deprecated and they will not be available after
12
12
  # March 2012.
13
13
  #
14
- # Use GoogleDriveV1::Worksheet#add_table to create table.
15
- # Use GoogleDriveV1::Worksheet#tables to get GoogleDriveV1::Table objects.
14
+ # Use GoogleDriveV0::Worksheet#add_table to create table.
15
+ # Use GoogleDriveV0::Worksheet#tables to get GoogleDriveV0::Table objects.
16
16
  class Table
17
17
 
18
18
  include(Util)
@@ -4,7 +4,7 @@
4
4
  require "cgi"
5
5
 
6
6
 
7
- module GoogleDriveV1
7
+ module GoogleDriveV0
8
8
 
9
9
  module Util #:nodoc:
10
10
 
@@ -3,16 +3,16 @@
3
3
 
4
4
  require "set"
5
5
 
6
- require "google_drive_v1/util"
7
- require "google_drive_v1/error"
8
- require "google_drive_v1/table"
9
- require "google_drive_v1/list"
6
+ require "google_drive_v0/util"
7
+ require "google_drive_v0/error"
8
+ require "google_drive_v0/table"
9
+ require "google_drive_v0/list"
10
10
 
11
11
 
12
- module GoogleDriveV1
12
+ module GoogleDriveV0
13
13
 
14
14
  # A worksheet (i.e. a tab) in a spreadsheet.
15
- # Use GoogleDriveV1::Spreadsheet#worksheets to get GoogleDriveV1::Worksheet object.
15
+ # Use GoogleDriveV0::Spreadsheet#worksheets to get GoogleDriveV0::Worksheet object.
16
16
  class Worksheet
17
17
 
18
18
  include(Util)
@@ -43,18 +43,18 @@ module GoogleDriveV1
43
43
  # from it.
44
44
  if !(@cells_feed_url =~
45
45
  %r{^https?://spreadsheets.google.com/feeds/cells/(.*)/(.*)/private/full((\?.*)?)$})
46
- raise(GoogleDriveV1::Error,
46
+ raise(GoogleDriveV0::Error,
47
47
  "Cells feed URL is in unknown format: #{@cells_feed_url}")
48
48
  end
49
49
  return "https://spreadsheets.google.com/feeds/worksheets/#{$1}/private/full/#{$2}#{$3}"
50
50
  end
51
51
 
52
- # GoogleDriveV1::Spreadsheet which this worksheet belongs to.
52
+ # GoogleDriveV0::Spreadsheet which this worksheet belongs to.
53
53
  def spreadsheet
54
54
  if !@spreadsheet
55
55
  if !(@cells_feed_url =~
56
56
  %r{^https?://spreadsheets.google.com/feeds/cells/(.*)/(.*)/private/full(\?.*)?$})
57
- raise(GoogleDriveV1::Error,
57
+ raise(GoogleDriveV0::Error,
58
58
  "Cells feed URL is in unknown format: #{@cells_feed_url}")
59
59
  end
60
60
  @spreadsheet = @session.spreadsheet_by_key($1)
@@ -336,11 +336,11 @@ module GoogleDriveV1
336
336
  for entry in result.css("atom|entry")
337
337
  interrupted = entry.css("batch|interrupted")[0]
338
338
  if interrupted
339
- raise(GoogleDriveV1::Error, "Update has failed: %s" %
339
+ raise(GoogleDriveV0::Error, "Update has failed: %s" %
340
340
  interrupted["reason"])
341
341
  end
342
342
  if !(entry.css("batch|status").first["code"] =~ /^2/)
343
- raise(GoogleDriveV1::Error, "Updating cell %s has failed: %s" %
343
+ raise(GoogleDriveV0::Error, "Updating cell %s has failed: %s" %
344
344
  [entry.css("atom|id").text, entry.css("batch|status")[0]["reason"]])
345
345
  end
346
346
  end
@@ -377,7 +377,7 @@ module GoogleDriveV1
377
377
  # DEPRECATED: Table and Record feeds are deprecated and they will not be available after
378
378
  # March 2012.
379
379
  #
380
- # Creates table for the worksheet and returns GoogleDriveV1::Table.
380
+ # Creates table for the worksheet and returns GoogleDriveV0::Table.
381
381
  # See this document for details:
382
382
  # http://code.google.com/intl/en/apis/spreadsheets/docs/3.0/developers_guide_protocol.html#TableFeeds
383
383
  def add_table(table_title, summary, columns, options)
@@ -433,7 +433,7 @@ module GoogleDriveV1
433
433
  end
434
434
 
435
435
  # Provides access to cells using column names, assuming the first row contains column
436
- # names. Returned object is GoogleDriveV1::List which you can use mostly as
436
+ # names. Returned object is GoogleDriveV0::List which you can use mostly as
437
437
  # Array of Hash.
438
438
  #
439
439
  # e.g. Assuming the first row is ["x", "y"]:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_drive
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre1
4
+ version: 1.0.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Ichikawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-22 00:00:00.000000000 Z
11
+ date: 2014-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -114,31 +114,32 @@ files:
114
114
  - lib/google_drive/list.rb
115
115
  - lib/google_drive/list_row.rb
116
116
  - lib/google_drive/record.rb
117
+ - lib/google_drive/response_code_error.rb
117
118
  - lib/google_drive/session.rb
118
119
  - lib/google_drive/spreadsheet.rb
119
120
  - lib/google_drive/table.rb
120
121
  - lib/google_drive/util.rb
121
122
  - lib/google_drive/worksheet.rb
122
- - lib/google_drive_v1.rb
123
- - lib/google_drive_v1/acl.rb
124
- - lib/google_drive_v1/acl_entry.rb
125
- - lib/google_drive_v1/api_client_fetcher.rb
126
- - lib/google_drive_v1/authentication_error.rb
127
- - lib/google_drive_v1/basic_fetcher.rb
128
- - lib/google_drive_v1/client_login_fetcher.rb
129
- - lib/google_drive_v1/collection.rb
130
- - lib/google_drive_v1/error.rb
131
- - lib/google_drive_v1/file.rb
132
- - lib/google_drive_v1/list.rb
133
- - lib/google_drive_v1/list_row.rb
134
- - lib/google_drive_v1/oauth1_fetcher.rb
135
- - lib/google_drive_v1/oauth2_fetcher.rb
136
- - lib/google_drive_v1/record.rb
137
- - lib/google_drive_v1/session.rb
138
- - lib/google_drive_v1/spreadsheet.rb
139
- - lib/google_drive_v1/table.rb
140
- - lib/google_drive_v1/util.rb
141
- - lib/google_drive_v1/worksheet.rb
123
+ - lib/google_drive_v0.rb
124
+ - lib/google_drive_v0/acl.rb
125
+ - lib/google_drive_v0/acl_entry.rb
126
+ - lib/google_drive_v0/api_client_fetcher.rb
127
+ - lib/google_drive_v0/authentication_error.rb
128
+ - lib/google_drive_v0/basic_fetcher.rb
129
+ - lib/google_drive_v0/client_login_fetcher.rb
130
+ - lib/google_drive_v0/collection.rb
131
+ - lib/google_drive_v0/error.rb
132
+ - lib/google_drive_v0/file.rb
133
+ - lib/google_drive_v0/list.rb
134
+ - lib/google_drive_v0/list_row.rb
135
+ - lib/google_drive_v0/oauth1_fetcher.rb
136
+ - lib/google_drive_v0/oauth2_fetcher.rb
137
+ - lib/google_drive_v0/record.rb
138
+ - lib/google_drive_v0/session.rb
139
+ - lib/google_drive_v0/spreadsheet.rb
140
+ - lib/google_drive_v0/table.rb
141
+ - lib/google_drive_v0/util.rb
142
+ - lib/google_drive_v0/worksheet.rb
142
143
  homepage: https://github.com/gimite/google-drive-ruby
143
144
  licenses:
144
145
  - New BSD
@@ -1,14 +0,0 @@
1
- # Author: Hiroshi Ichikawa <http://gimite.net/>
2
- # The license of this source is "New BSD Licence"
3
-
4
- require "google_drive_v1/error"
5
-
6
-
7
- module GoogleDriveV1
8
-
9
- # Raised when GoogleDriveV1.login has failed.
10
- class AuthenticationError < GoogleDriveV1::Error
11
-
12
- end
13
-
14
- end