files.com 1.0.320 → 1.0.322
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 +4 -4
- data/_VERSION +1 -1
- data/docs/bundle_notification.md +1 -1
- data/lib/files.com/models/bundle_notification.rb +1 -2
- data/lib/files.com/models/file.rb +6 -6
- 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: 107fc72fca0d656c45f04b2b67b876f113ad1f8655550d9897b7b5ec61a28f19
|
4
|
+
data.tar.gz: 1fe0b3bc642c4580c4b7f3c9e1f23a8a5f56c14a63317c786d536b03a4f3549c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed6a254ca2185b3e921f182ca4aefe10f4f19ead3852748bcb7050ad92aef37caddd43884848c44af5803a9db86ebd6401561a7b090738df91f023dd4513ce29
|
7
|
+
data.tar.gz: bb5adb401323c6b682eda5902cbecbaa77a7765e525a3f1412d8d7dbdbe8df976e31b7b6b593c24b9fb0451ff841b8bb6daa6e2cc8da944837acfbedeba895d4
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.322
|
data/docs/bundle_notification.md
CHANGED
@@ -67,7 +67,7 @@ Files::BundleNotification.create(
|
|
67
67
|
|
68
68
|
### Parameters
|
69
69
|
|
70
|
-
* `user_id` (int64):
|
70
|
+
* `user_id` (int64): The id of the user to notify.
|
71
71
|
* `notify_on_registration` (boolean): Triggers bundle notification when a registration action occurs for it.
|
72
72
|
* `notify_on_upload` (boolean): Triggers bundle notification when a upload action occurs for it.
|
73
73
|
* `bundle_id` (int64): Required - Bundle ID to notify on
|
@@ -127,14 +127,13 @@ module Files
|
|
127
127
|
end
|
128
128
|
|
129
129
|
# Parameters:
|
130
|
-
# user_id
|
130
|
+
# user_id - int64 - The id of the user to notify.
|
131
131
|
# notify_on_registration - boolean - Triggers bundle notification when a registration action occurs for it.
|
132
132
|
# notify_on_upload - boolean - Triggers bundle notification when a upload action occurs for it.
|
133
133
|
# bundle_id (required) - int64 - Bundle ID to notify on
|
134
134
|
def self.create(params = {}, options = {})
|
135
135
|
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
|
136
136
|
raise InvalidParameterError.new("Bad parameter: bundle_id must be an Integer") if params[:bundle_id] and !params[:bundle_id].is_a?(Integer)
|
137
|
-
raise MissingParameterError.new("Parameter missing: user_id") unless params[:user_id]
|
138
137
|
raise MissingParameterError.new("Parameter missing: bundle_id") unless params[:bundle_id]
|
139
138
|
|
140
139
|
response, options = Api.send_request("/bundle_notifications", :post, params, options)
|
@@ -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.322
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|