google_drive 0.3.6 → 0.3.7
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.
- data/lib/google_drive/session.rb +11 -13
- metadata +2 -2
data/lib/google_drive/session.rb
CHANGED
@@ -151,17 +151,14 @@ module GoogleDrive
|
|
151
151
|
# session.spreadsheets("title" => "hoge")
|
152
152
|
# session.spreadsheets("title" => "hoge", "title-exact" => "true")
|
153
153
|
def spreadsheets(params = {})
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
result.push(Spreadsheet.new(self, url, title))
|
163
|
-
end
|
164
|
-
return result
|
154
|
+
url = concat_url(
|
155
|
+
"#{DOCS_BASE_URL}/-/spreadsheet?v=3", "?" + encode_query(params))
|
156
|
+
doc = request(:get, url, :auth => :writely)
|
157
|
+
# The API may return non-spreadsheets too when title-exact is specified.
|
158
|
+
# Probably a bug. For workaround, only returns Spreadsheet instances.
|
159
|
+
return doc.css("feed > entry").
|
160
|
+
map(){ |e| entry_element_to_file(e) }.
|
161
|
+
select(){ |f| f.is_a?(Spreadsheet) }
|
165
162
|
end
|
166
163
|
|
167
164
|
# Returns GoogleDrive::Spreadsheet with given +key+.
|
@@ -335,7 +332,8 @@ module GoogleDrive
|
|
335
332
|
:auth => :writely)
|
336
333
|
initial_url = doc.css(
|
337
334
|
"link[rel='http://schemas.google.com/g/2005#resumable-create-media']")[0]["href"]
|
338
|
-
|
335
|
+
entry = upload_raw(:post, initial_url, io, title, params)
|
336
|
+
return entry_element_to_file(entry)
|
339
337
|
end
|
340
338
|
|
341
339
|
def upload_raw(method, url, io, title = "Untitled", params = {}) #:nodoc:
|
@@ -397,7 +395,7 @@ module GoogleDrive
|
|
397
395
|
:put, upload_url, :header => upload_header, :data => "", :auth => :writely)
|
398
396
|
end
|
399
397
|
|
400
|
-
return
|
398
|
+
return doc.root
|
401
399
|
|
402
400
|
end
|
403
401
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_drive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|