googledrive-easy 0.0.2 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/googledrive-easy.rb +8 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2e510a7a4388feec9cbfffcbf6095e2b90f73cd882b81558014b9bc9147d4ed
|
4
|
+
data.tar.gz: 5940d24cf857bd29da87277dfcf0135a47890b3d37b087eddc5cbeb19084c464
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f934c27d0bc9014b1f8f514e036bcfe2e22355a3e4125a11aaa287cfbec935fdef49eae7372ef18e11f76765dbb22e7b95ac466e2f432647459b7d0e8441bae
|
7
|
+
data.tar.gz: b5bf2997933c7e475e8f5d254a49ed029c52ec910b9653042f59661dccd6516bb4419962a35582b466b646da1aad4c4cea2c43e637e696d2048152b0641cf577
|
data/lib/googledrive-easy.rb
CHANGED
@@ -283,25 +283,21 @@ class GoogleDrive
|
|
283
283
|
def find_directory_id(directory_name, parentfolderid: nil)
|
284
284
|
|
285
285
|
file_list = get_all_files(justfolders: true, name: directory_name, parentfolderid: parentfolderid)
|
286
|
-
|
286
|
+
|
287
|
+
if !file_list || (file_list.count == 0)
|
288
|
+
if @raise_error; raise "Directory not found." end
|
287
289
|
return false
|
288
290
|
end
|
289
291
|
|
290
|
-
file_list.
|
291
|
-
|
292
|
-
end
|
293
|
-
|
294
|
-
if @raise_error; raise "Directory not found." end
|
295
|
-
|
296
|
-
return false
|
297
|
-
end
|
292
|
+
return file_list.first[:id]
|
293
|
+
end
|
298
294
|
|
299
|
-
def upload_file(file, directory_id
|
295
|
+
def upload_file(file, directory_id: nil)
|
300
296
|
|
301
297
|
file_basename = File.basename(file)
|
302
298
|
|
303
299
|
# see if file exists on Drive
|
304
|
-
file_list =
|
300
|
+
file_list = self.get_all_files(justfiles: true, parentfolderid: directory_id, name: file_basename)
|
305
301
|
if file_list.count > 0
|
306
302
|
if @raise_error; raise "ERROR: File '#{file_basename}' already exists." end
|
307
303
|
return false
|
@@ -348,7 +344,6 @@ class GoogleDrive
|
|
348
344
|
# "mimeType": "application/gzip"
|
349
345
|
# }
|
350
346
|
|
351
|
-
|
352
347
|
# check that name = filename
|
353
348
|
# check that kind = drive#file
|
354
349
|
if !response.key?("name") # name key does not exist
|
@@ -386,7 +381,7 @@ class GoogleDrive
|
|
386
381
|
file_path = file_path.gsub(/\/$/, '') + "/"
|
387
382
|
|
388
383
|
# 1) assume file_name_or_id is a filename
|
389
|
-
files = find_files(
|
384
|
+
files = find_files(file_name_or_id, parentfolderid: parentfolderid)
|
390
385
|
if files && (files.count == 1)
|
391
386
|
file_info = files.first
|
392
387
|
elsif files && (files.count > 1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googledrive-easy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Bullock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Easy File interface to Google Drive
|
14
14
|
email: jmb@rgnets.com
|