appwrite 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +17 -5
- data/lib/appwrite/services/functions.rb +3 -1
- data/lib/appwrite/services/storage.rb +2 -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: 9ccc9454e05eee3806e9bcb29e95ef8202b0fc617215e837e52a2cff52199bfd
|
4
|
+
data.tar.gz: 739353c7c628f0711f3c466c3d35f6db829bec9362415a735cf9ac3b72273a41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 483f458ce6e1b4abdeaeb96e60fabeb4f778fe775e39a1999abf19725f461a2db190b8b2b31f15d32d838436ac8b0e58bf6f1ce4f183e4a019d4fab75f0e8773
|
7
|
+
data.tar.gz: 91b5993ca7e9186e65150daf278751a510155d2d15a0de54169d9b6efdee376b93a99f512f75a649b32e04a389fe9ca8224e144c6905ccca4b11639930995478
|
data/lib/appwrite/client.rb
CHANGED
@@ -12,7 +12,7 @@ module Appwrite
|
|
12
12
|
@chunk_size = 5*1024*1024
|
13
13
|
@headers = {
|
14
14
|
'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION,
|
15
|
-
'x-sdk-version' => 'appwrite:ruby:4.
|
15
|
+
'x-sdk-version' => 'appwrite:ruby:4.1.0',
|
16
16
|
'X-Appwrite-Response-Format' => '0.13.0'
|
17
17
|
}
|
18
18
|
@endpoint = 'https://HOSTNAME/v1'
|
@@ -129,6 +129,7 @@ module Appwrite
|
|
129
129
|
headers:,
|
130
130
|
params:,
|
131
131
|
param_name: '',
|
132
|
+
id_param_name: nil,
|
132
133
|
on_progress: nil,
|
133
134
|
response_type: nil
|
134
135
|
)
|
@@ -147,11 +148,22 @@ module Appwrite
|
|
147
148
|
)
|
148
149
|
end
|
149
150
|
|
150
|
-
input = ::File.open(file_path)
|
151
151
|
offset = 0
|
152
|
+
id_param_name = id_param_name.to_sym if id_param_name
|
153
|
+
if id_param_name&.empty? == false && params[id_param_name] != "unique()"
|
154
|
+
# Make a request to check if a file already exists
|
155
|
+
current = call(
|
156
|
+
method: "GET",
|
157
|
+
path: "#{path}/#{params[id_param_name]}",
|
158
|
+
headers: headers,
|
159
|
+
params: {}
|
160
|
+
)
|
161
|
+
chunks_uploaded = current['chunksUploaded'].to_i
|
162
|
+
offset = [size, (chunks_uploaded * @chunk_size)].min
|
163
|
+
end
|
152
164
|
|
153
165
|
while offset < size
|
154
|
-
slice =
|
166
|
+
slice = IO.read(file_path, @chunk_size, offset)
|
155
167
|
|
156
168
|
params[param_name] = File.new(file_path, slice)
|
157
169
|
headers['content-range'] = "bytes #{offset}-#{[offset + @chunk_size - 1, size].min}/#{size}"
|
@@ -173,8 +185,8 @@ module Appwrite
|
|
173
185
|
id: result['$id'],
|
174
186
|
progress: ([offset, size].min).to_f/size.to_f * 100.0,
|
175
187
|
size_uploaded: [offset, size].min,
|
176
|
-
chunks_total: result['
|
177
|
-
chunks_uploaded: result['
|
188
|
+
chunks_total: result['chunksTotal'],
|
189
|
+
chunks_uploaded: result['chunksUploaded']
|
178
190
|
}) unless on_progress.nil?
|
179
191
|
end
|
180
192
|
|
@@ -96,7 +96,7 @@ module Appwrite
|
|
96
96
|
)
|
97
97
|
end
|
98
98
|
|
99
|
-
# Get a list of all runtimes that are currently active
|
99
|
+
# Get a list of all runtimes that are currently active on your instance.
|
100
100
|
#
|
101
101
|
#
|
102
102
|
# @return [RuntimeList]
|
@@ -314,6 +314,7 @@ module Appwrite
|
|
314
314
|
"content-type": 'multipart/form-data',
|
315
315
|
}
|
316
316
|
|
317
|
+
id_param_name = nil
|
317
318
|
param_name = 'code'
|
318
319
|
|
319
320
|
@client.chunked_upload(
|
@@ -321,6 +322,7 @@ module Appwrite
|
|
321
322
|
headers: headers,
|
322
323
|
params: params,
|
323
324
|
param_name: param_name,
|
325
|
+
id_param_name: id_param_name,
|
324
326
|
on_progress: on_progress,
|
325
327
|
response_type: Models::Deployment
|
326
328
|
)
|
@@ -303,6 +303,7 @@ module Appwrite
|
|
303
303
|
"content-type": 'multipart/form-data',
|
304
304
|
}
|
305
305
|
|
306
|
+
id_param_name = "fileId"
|
306
307
|
param_name = 'file'
|
307
308
|
|
308
309
|
@client.chunked_upload(
|
@@ -310,6 +311,7 @@ module Appwrite
|
|
310
311
|
headers: headers,
|
311
312
|
params: params,
|
312
313
|
param_name: param_name,
|
314
|
+
id_param_name: id_param_name,
|
313
315
|
on_progress: on_progress,
|
314
316
|
response_type: Models::File
|
315
317
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appwrite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Appwrite Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|