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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4170d70ab8de41d40023daac58c91d7b4d21118f0abcfb95a14cad9bfac4abf
4
- data.tar.gz: 034b0ca6ea4d5c3f99f026afbb877c7b0f64c34aaa41733c77c92aac42afc54d
3
+ metadata.gz: db677e5647c860d2251c3a38c8badd259dd8aaf0815e176699507168ca130b92
4
+ data.tar.gz: 0cb4ec739390153b427aa887cdfd555f01e1081f03925fd1a68f6948e58ca773
5
5
  SHA512:
6
- metadata.gz: 7a58fcec5b74ce9024bb6c014c54319afc0060bdae5ede1bc9a52a40dd4db98b2d77d38300d3f292a573417faaae5f089d0e624ee5b364e0c5c5fd5fda65c232
7
- data.tar.gz: 037cf71c3023a5adc436f4b3e599cd450daaca2592c9f61a890b3fdf4c737d9a040c6fb18746eeebb8784e9bdb8a7a36b219b56f2ba93b869487bc60624c1919
6
+ metadata.gz: 29a05dc34cc5d1328ff86fe48a1dfdd9cd3959ccd5e95d5756f2354a273e3e3a6fafab7649527797a7d1dc501385a204bd9e7a0e4885c25654599b8b294f0836
7
+ data.tar.gz: abcc39d31aaecbd1dd2dfd7baba45ac27e2618fadebd310f7f1e3133bb6a2b921f90871605506eaae7b95725884b87dcae249c4ea0b8ce7dc5240797135b4e81
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.319
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, { ref: upload&.ref, part: (upload&.part_number || 0) + 1 }, options)
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)
@@ -19,6 +19,11 @@ module Files
19
19
  @attributes[:created_at]
20
20
  end
21
21
 
22
+ # int64 - When the action happened, in ISO8601 format.
23
+ def created_at_iso8601
24
+ @attributes[:created_at_iso8601]
25
+ end
26
+
22
27
  # int64 - User ID
23
28
  def user_id
24
29
  @attributes[:user_id]
@@ -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.319
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-12 00:00:00.000000000 Z
11
+ date: 2023-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable