files.com 1.0.320 → 1.0.321

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 838645d8ae2133a64f6236b3f41e5bd31e60745fa2fac8c8d89763f74410959b
4
- data.tar.gz: 41b4c99699a4e57a0060bcefcd50f20e4ddf977270029d06ace53f41c8b74b91
3
+ metadata.gz: db677e5647c860d2251c3a38c8badd259dd8aaf0815e176699507168ca130b92
4
+ data.tar.gz: 0cb4ec739390153b427aa887cdfd555f01e1081f03925fd1a68f6948e58ca773
5
5
  SHA512:
6
- metadata.gz: 61764026c8ca7d5c29018ea55ecdc8faf180fe82d86a41ed74b461bfdc5dec20e33791bbdcbae55a13ef9034c98e1eedb3f52107bec16cd2c2a9790ee0d702a8
7
- data.tar.gz: 0a918e1e0276c6ffc26624b760547b980e31bf7d1afd6c442db1e848db947c45e5edf7b825ec4bf933702d8c31a66e4183262dd199b744f962af600ae49efa90
6
+ metadata.gz: 29a05dc34cc5d1328ff86fe48a1dfdd9cd3959ccd5e95d5756f2354a273e3e3a6fafab7649527797a7d1dc501385a204bd9e7a0e4885c25654599b8b294f0836
7
+ data.tar.gz: abcc39d31aaecbd1dd2dfd7baba45ac27e2618fadebd310f7f1e3133bb6a2b921f90871605506eaae7b95725884b87dcae249c4ea0b8ce7dc5240797135b4e81
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.320
1
+ 1.0.321
@@ -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)
@@ -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.320
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-24 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