files.com 1.0.319 → 1.0.321
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_VERSION +1 -1
- data/docs/history_export_result.md +2 -0
- data/lib/files.com/models/file.rb +6 -6
- data/lib/files.com/models/history_export_result.rb +5 -0
- data/spec/models/file_spec.rb +19 -0
- 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: db677e5647c860d2251c3a38c8badd259dd8aaf0815e176699507168ca130b92
|
4
|
+
data.tar.gz: 0cb4ec739390153b427aa887cdfd555f01e1081f03925fd1a68f6948e58ca773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29a05dc34cc5d1328ff86fe48a1dfdd9cd3959ccd5e95d5756f2354a273e3e3a6fafab7649527797a7d1dc501385a204bd9e7a0e4885c25654599b8b294f0836
|
7
|
+
data.tar.gz: abcc39d31aaecbd1dd2dfd7baba45ac27e2618fadebd310f7f1e3133bb6a2b921f90871605506eaae7b95725884b87dcae249c4ea0b8ce7dc5240797135b4e81
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.321
|
@@ -6,6 +6,7 @@
|
|
6
6
|
{
|
7
7
|
"id": 1,
|
8
8
|
"created_at": 1,
|
9
|
+
"created_at_iso8601": 1,
|
9
10
|
"user_id": 1,
|
10
11
|
"file_id": 1,
|
11
12
|
"parent_id": 1,
|
@@ -32,6 +33,7 @@
|
|
32
33
|
|
33
34
|
* `id` (int64): Action ID
|
34
35
|
* `created_at` (int64): When the action happened
|
36
|
+
* `created_at_iso8601` (int64): When the action happened, in ISO8601 format.
|
35
37
|
* `user_id` (int64): User ID
|
36
38
|
* `file_id` (int64): File ID related to the action
|
37
39
|
* `parent_id` (int64): ID of the parent folder
|
@@ -134,11 +134,11 @@ module Files
|
|
134
134
|
paths.map { |p| delete(p) }
|
135
135
|
end
|
136
136
|
|
137
|
-
def self.upload_chunks(io, path, options, upload = nil, etags = [])
|
137
|
+
def self.upload_chunks(io, path, options, upload = nil, etags = [], params: {})
|
138
138
|
etags ||= []
|
139
139
|
bytes_written = 0
|
140
140
|
loop do
|
141
|
-
begin_upload = File.begin_upload(path,
|
141
|
+
begin_upload = File.begin_upload(path, params.merge(ref: upload&.ref, part: (upload&.part_number || 0) + 1), options)
|
142
142
|
upload = begin_upload.is_a?(Enumerable) ? begin_upload.first : begin_upload
|
143
143
|
buf = io.read(upload.partsize) || ""
|
144
144
|
bytes_written += buf.length
|
@@ -149,10 +149,10 @@ module Files
|
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
-
def self.upload_file(path, destination = nil, options = {})
|
152
|
+
def self.upload_file(path, destination = nil, options = {}, params: {})
|
153
153
|
local_file = ::File.open(path, 'r')
|
154
154
|
destination ||= File.basename(path)
|
155
|
-
upload, etags = upload_chunks(local_file, destination, options)
|
155
|
+
upload, etags = upload_chunks(local_file, destination, options, params: params)
|
156
156
|
|
157
157
|
params = {
|
158
158
|
action: "end",
|
@@ -348,7 +348,7 @@ module Files
|
|
348
348
|
if mode.include? "w"
|
349
349
|
@write_io.rewind if @write_io.is_a?(StringIO)
|
350
350
|
|
351
|
-
@upload, @etags, bytes_written = File.upload_chunks(@write_io, path, options, @upload, @etags)
|
351
|
+
@upload, @etags, bytes_written = File.upload_chunks(@write_io, path, options, @upload, @etags, params: @attributes)
|
352
352
|
@bytes_written += bytes_written
|
353
353
|
elsif mode.include? "a"
|
354
354
|
raise NotImplementedError
|
@@ -546,7 +546,7 @@ module Files
|
|
546
546
|
end
|
547
547
|
|
548
548
|
def upload_file(local_file)
|
549
|
-
File.upload_file(local_file.path)
|
549
|
+
File.upload_file(local_file.path, params: @attributes)
|
550
550
|
end
|
551
551
|
|
552
552
|
def write(*args)
|
data/spec/models/file_spec.rb
CHANGED
@@ -82,6 +82,25 @@ RSpec.describe Files::File, :with_test_folder, skip: ENV.fetch("GITLAB", nil) do
|
|
82
82
|
expect(file.read).to eq("I am a string via IO")
|
83
83
|
temp_file.close
|
84
84
|
end
|
85
|
+
|
86
|
+
it "will send with_rename" do
|
87
|
+
path = test_folder.join("with_rename_test.txt").to_s
|
88
|
+
io = StringIO.new("I am a string via IO")
|
89
|
+
file = Files::File.new({ path: path, with_rename: true }, options)
|
90
|
+
file.write(io)
|
91
|
+
file.close
|
92
|
+
|
93
|
+
io = StringIO.new("I am a string via IO")
|
94
|
+
file = Files::File.new({ path: path, with_rename: true }, options)
|
95
|
+
file.write(io)
|
96
|
+
file.close
|
97
|
+
|
98
|
+
file = Files::File.find(test_folder.join("with_rename_test.txt").to_s, {}, options)
|
99
|
+
expect(file.read).to eq("I am a string via IO")
|
100
|
+
|
101
|
+
file = Files::File.find(test_folder.join("with_rename_test_1.txt").to_s, {}, options)
|
102
|
+
expect(file.read).to eq("I am a string via IO")
|
103
|
+
end
|
85
104
|
end
|
86
105
|
|
87
106
|
describe "#download_content" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: files.com
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.321
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- files.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|