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.
- checksums.yaml +4 -4
- data/README.rdoc +9 -2
- data/lib/google_drive/api_client_fetcher.rb +3 -0
- data/lib/google_drive/authentication_error.rb +2 -2
- data/lib/google_drive/error.rb +1 -1
- data/lib/google_drive/response_code_error.rb +24 -0
- data/lib/google_drive/session.rb +4 -5
- data/lib/google_drive/worksheet.rb +39 -45
- data/lib/{google_drive_v1.rb → google_drive_v0.rb} +9 -9
- data/lib/{google_drive_v1 → google_drive_v0}/acl.rb +7 -7
- data/lib/{google_drive_v1 → google_drive_v0}/acl_entry.rb +3 -3
- data/lib/{google_drive_v1 → google_drive_v0}/api_client_fetcher.rb +1 -1
- data/lib/google_drive_v0/authentication_error.rb +14 -0
- data/lib/{google_drive_v1 → google_drive_v0}/basic_fetcher.rb +1 -1
- data/lib/{google_drive_v1 → google_drive_v0}/client_login_fetcher.rb +2 -2
- data/lib/{google_drive_v1 → google_drive_v0}/collection.rb +12 -12
- data/lib/{google_drive_v1 → google_drive_v0}/error.rb +1 -1
- data/lib/{google_drive_v1 → google_drive_v0}/file.rb +9 -9
- data/lib/{google_drive_v1 → google_drive_v0}/list.rb +15 -15
- data/lib/{google_drive_v1 → google_drive_v0}/list_row.rb +4 -4
- data/lib/{google_drive_v1 → google_drive_v0}/oauth1_fetcher.rb +1 -1
- data/lib/{google_drive_v1 → google_drive_v0}/oauth2_fetcher.rb +2 -2
- data/lib/{google_drive_v1 → google_drive_v0}/record.rb +4 -4
- data/lib/{google_drive_v1 → google_drive_v0}/session.rb +45 -45
- data/lib/{google_drive_v1 → google_drive_v0}/spreadsheet.rb +17 -17
- data/lib/{google_drive_v1 → google_drive_v0}/table.rb +6 -6
- data/lib/{google_drive_v1 → google_drive_v0}/util.rb +1 -1
- data/lib/{google_drive_v1 → google_drive_v0}/worksheet.rb +13 -13
- metadata +23 -22
- data/lib/google_drive_v1/authentication_error.rb +0 -14
@@ -3,20 +3,20 @@
|
|
3
3
|
|
4
4
|
require "time"
|
5
5
|
|
6
|
-
require "
|
7
|
-
require "
|
8
|
-
require "
|
9
|
-
require "
|
10
|
-
require "
|
11
|
-
require "
|
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
|
14
|
+
module GoogleDriveV0
|
15
15
|
|
16
16
|
# A spreadsheet.
|
17
17
|
#
|
18
|
-
# Use methods in
|
19
|
-
class Spreadsheet <
|
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(
|
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:
|
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:
|
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
|
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
|
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(
|
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
|
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
|
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 "
|
5
|
-
require "
|
6
|
-
require "
|
4
|
+
require "google_drive_v0/util"
|
5
|
+
require "google_drive_v0/error"
|
6
|
+
require "google_drive_v0/record"
|
7
7
|
|
8
8
|
|
9
|
-
module
|
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
|
15
|
-
# Use
|
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)
|
@@ -3,16 +3,16 @@
|
|
3
3
|
|
4
4
|
require "set"
|
5
5
|
|
6
|
-
require "
|
7
|
-
require "
|
8
|
-
require "
|
9
|
-
require "
|
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
|
12
|
+
module GoogleDriveV0
|
13
13
|
|
14
14
|
# A worksheet (i.e. a tab) in a spreadsheet.
|
15
|
-
# Use
|
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(
|
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
|
-
#
|
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(
|
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(
|
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(
|
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
|
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
|
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.
|
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-
|
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/
|
123
|
-
- lib/
|
124
|
-
- lib/
|
125
|
-
- lib/
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/
|
131
|
-
- lib/
|
132
|
-
- lib/
|
133
|
-
- lib/
|
134
|
-
- lib/
|
135
|
-
- lib/
|
136
|
-
- lib/
|
137
|
-
- lib/
|
138
|
-
- lib/
|
139
|
-
- lib/
|
140
|
-
- lib/
|
141
|
-
- lib/
|
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
|