files.com 1.0.176 → 1.0.181
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/app.md +2 -0
- data/docs/external_event.md +17 -0
- data/docs/remote_server.md +52 -20
- data/lib/files.com/api_client.rb +5 -0
- data/lib/files.com/models/app.rb +5 -0
- data/lib/files.com/models/external_event.rb +42 -0
- data/lib/files.com/models/file.rb +1 -1
- data/lib/files.com/models/remote_server.rb +83 -8
- data/lib/files.com/sizable_io.rb +29 -1
- data/spec/models/file_spec.rb +36 -4
- 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: 8384d32f0a992c1cb7f64673a76eeeca09eb2e3e9269ece0c939aa29f124fbdf
|
4
|
+
data.tar.gz: 9e40763863df161e61fc54f45aff05adaee282515fd923509379a579f3e63a9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65217858737112f06f00c4f25e67494eea4ef8c2a0b801e506c248963d0d5ccac4f1f3916819a1768fd1505a89bd9a26eb6707fe8b04ea6127610384d941fae9
|
7
|
+
data.tar.gz: 49782c8c69889c8bc8f3777d0571bea1dc839b8f9760fde4960275ac3db504ef06f5632ffb7096ef0a9432c6ce6dae93484dd0eed1941b3f6cbe8a6e9a6ff413
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.181
|
data/docs/app.md
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
{
|
7
7
|
"name": "",
|
8
8
|
"extended_description": "",
|
9
|
+
"short_description": "",
|
9
10
|
"documentation_links": "Important Info => http://files.test/learn-more",
|
10
11
|
"icon_url": "",
|
11
12
|
"logo_url": "",
|
@@ -26,6 +27,7 @@
|
|
26
27
|
|
27
28
|
* `name` (string): Name of the App
|
28
29
|
* `extended_description` (string): Long form description of the App
|
30
|
+
* `short_description` (string): Short description of the App
|
29
31
|
* `documentation_links` (string): Collection of named links to documentation
|
30
32
|
* `icon_url` (string): App icon
|
31
33
|
* `logo_url` (string): Full size logo for the App
|
data/docs/external_event.md
CHANGED
@@ -55,3 +55,20 @@ Files::ExternalEvent.find(id)
|
|
55
55
|
### Parameters
|
56
56
|
|
57
57
|
* `id` (int64): Required - External Event ID.
|
58
|
+
|
59
|
+
|
60
|
+
---
|
61
|
+
|
62
|
+
## Create External Event
|
63
|
+
|
64
|
+
```
|
65
|
+
Files::ExternalEvent.create(
|
66
|
+
status: "status",
|
67
|
+
body: "body"
|
68
|
+
)
|
69
|
+
```
|
70
|
+
|
71
|
+
### Parameters
|
72
|
+
|
73
|
+
* `status` (string): Required - Status of event.
|
74
|
+
* `body` (string): Required - Event body
|
data/docs/remote_server.md
CHANGED
@@ -22,8 +22,8 @@
|
|
22
22
|
"google_cloud_storage_project_id": "my-project",
|
23
23
|
"backblaze_b2_s3_endpoint": "s3.us-west-001.backblazeb2.com",
|
24
24
|
"backblaze_b2_bucket": "my-bucket",
|
25
|
-
"wasabi_bucket": "
|
26
|
-
"wasabi_region": "
|
25
|
+
"wasabi_bucket": "my-bucket",
|
26
|
+
"wasabi_region": "us-west-1",
|
27
27
|
"rackspace_username": "rackspaceuser",
|
28
28
|
"rackspace_region": "dfw",
|
29
29
|
"rackspace_container": "my-container",
|
@@ -32,7 +32,10 @@
|
|
32
32
|
"auth_account_name": "me@example.com",
|
33
33
|
"one_drive_account_type": "personal",
|
34
34
|
"azure_blob_storage_account": "storage-account-name",
|
35
|
-
"azure_blob_storage_container": "container-name"
|
35
|
+
"azure_blob_storage_container": "container-name",
|
36
|
+
"s3_compatible_bucket": "my-bucket",
|
37
|
+
"s3_compatible_region": "us-east-1",
|
38
|
+
"s3_compatible_endpoint": "mys3platform.com"
|
36
39
|
}
|
37
40
|
```
|
38
41
|
|
@@ -54,8 +57,8 @@
|
|
54
57
|
* `google_cloud_storage_project_id` (string): Google Cloud Project ID
|
55
58
|
* `backblaze_b2_s3_endpoint` (string): Backblaze B2 Cloud Storage S3 Endpoint
|
56
59
|
* `backblaze_b2_bucket` (string): Backblaze B2 Cloud Storage Bucket name
|
57
|
-
* `wasabi_bucket` (string): Wasabi
|
58
|
-
* `wasabi_region` (string): Wasabi
|
60
|
+
* `wasabi_bucket` (string): Wasabi Bucket name
|
61
|
+
* `wasabi_region` (string): Wasabi region
|
59
62
|
* `rackspace_username` (string): Rackspace username used to login to the Rackspace Cloud Control Panel.
|
60
63
|
* `rackspace_region` (string): Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
|
61
64
|
* `rackspace_container` (string): The name of the container (top level directory) where files will sync.
|
@@ -65,6 +68,9 @@
|
|
65
68
|
* `one_drive_account_type` (string): Either personal or business_other account types
|
66
69
|
* `azure_blob_storage_account` (string): Azure Blob Storage Account name
|
67
70
|
* `azure_blob_storage_container` (string): Azure Blob Storage Container name
|
71
|
+
* `s3_compatible_bucket` (string): S3-compatible Bucket name
|
72
|
+
* `s3_compatible_region` (string): S3-compatible Bucket name
|
73
|
+
* `s3_compatible_endpoint` (string): S3-compatible endpoint
|
68
74
|
* `aws_access_key` (string): AWS Access Key.
|
69
75
|
* `aws_secret_key` (string): AWS secret key.
|
70
76
|
* `password` (string): Password if needed.
|
@@ -78,6 +84,8 @@
|
|
78
84
|
* `rackspace_api_key` (string): Rackspace API key from the Rackspace Cloud Control Panel.
|
79
85
|
* `reset_authentication` (boolean): Reset authenticated account
|
80
86
|
* `azure_blob_storage_access_key` (string): Azure Blob Storage secret key.
|
87
|
+
* `s3_compatible_access_key` (string): S3-compatible access key
|
88
|
+
* `s3_compatible_secret_key` (string): S3-compatible secret key
|
81
89
|
|
82
90
|
|
83
91
|
---
|
@@ -131,14 +139,17 @@ Files::RemoteServer.create(
|
|
131
139
|
google_cloud_storage_project_id: "my-project",
|
132
140
|
backblaze_b2_bucket: "my-bucket",
|
133
141
|
backblaze_b2_s3_endpoint: "s3.us-west-001.backblazeb2.com",
|
134
|
-
wasabi_bucket: "
|
135
|
-
wasabi_region: "
|
142
|
+
wasabi_bucket: "my-bucket",
|
143
|
+
wasabi_region: "us-west-1",
|
136
144
|
rackspace_username: "rackspaceuser",
|
137
145
|
rackspace_region: "dfw",
|
138
146
|
rackspace_container: "my-container",
|
139
147
|
one_drive_account_type: "personal",
|
140
148
|
azure_blob_storage_account: "storage-account-name",
|
141
|
-
azure_blob_storage_container: "container-name"
|
149
|
+
azure_blob_storage_container: "container-name",
|
150
|
+
s3_compatible_bucket: "my-bucket",
|
151
|
+
s3_compatible_region: "us-east-1",
|
152
|
+
s3_compatible_endpoint: "mys3platform.com"
|
142
153
|
)
|
143
154
|
```
|
144
155
|
|
@@ -172,14 +183,19 @@ Files::RemoteServer.create(
|
|
172
183
|
* `google_cloud_storage_project_id` (string): Google Cloud Project ID
|
173
184
|
* `backblaze_b2_bucket` (string): Backblaze B2 Cloud Storage Bucket name
|
174
185
|
* `backblaze_b2_s3_endpoint` (string): Backblaze B2 Cloud Storage S3 Endpoint
|
175
|
-
* `wasabi_bucket` (string): Wasabi
|
176
|
-
* `wasabi_region` (string): Wasabi
|
186
|
+
* `wasabi_bucket` (string): Wasabi Bucket name
|
187
|
+
* `wasabi_region` (string): Wasabi region
|
177
188
|
* `rackspace_username` (string): Rackspace username used to login to the Rackspace Cloud Control Panel.
|
178
189
|
* `rackspace_region` (string): Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
|
179
190
|
* `rackspace_container` (string): The name of the container (top level directory) where files will sync.
|
180
191
|
* `one_drive_account_type` (string): Either personal or business_other account types
|
181
192
|
* `azure_blob_storage_account` (string): Azure Blob Storage Account name
|
182
193
|
* `azure_blob_storage_container` (string): Azure Blob Storage Container name
|
194
|
+
* `s3_compatible_bucket` (string): S3-compatible Bucket name
|
195
|
+
* `s3_compatible_region` (string): S3-compatible Bucket name
|
196
|
+
* `s3_compatible_endpoint` (string): S3-compatible endpoint
|
197
|
+
* `s3_compatible_access_key` (string): S3-compatible access key
|
198
|
+
* `s3_compatible_secret_key` (string): S3-compatible secret key
|
183
199
|
|
184
200
|
|
185
201
|
---
|
@@ -204,14 +220,17 @@ Files::RemoteServer.update(id,
|
|
204
220
|
google_cloud_storage_project_id: "my-project",
|
205
221
|
backblaze_b2_bucket: "my-bucket",
|
206
222
|
backblaze_b2_s3_endpoint: "s3.us-west-001.backblazeb2.com",
|
207
|
-
wasabi_bucket: "
|
208
|
-
wasabi_region: "
|
223
|
+
wasabi_bucket: "my-bucket",
|
224
|
+
wasabi_region: "us-west-1",
|
209
225
|
rackspace_username: "rackspaceuser",
|
210
226
|
rackspace_region: "dfw",
|
211
227
|
rackspace_container: "my-container",
|
212
228
|
one_drive_account_type: "personal",
|
213
229
|
azure_blob_storage_account: "storage-account-name",
|
214
|
-
azure_blob_storage_container: "container-name"
|
230
|
+
azure_blob_storage_container: "container-name",
|
231
|
+
s3_compatible_bucket: "my-bucket",
|
232
|
+
s3_compatible_region: "us-east-1",
|
233
|
+
s3_compatible_endpoint: "mys3platform.com"
|
215
234
|
)
|
216
235
|
```
|
217
236
|
|
@@ -246,14 +265,19 @@ Files::RemoteServer.update(id,
|
|
246
265
|
* `google_cloud_storage_project_id` (string): Google Cloud Project ID
|
247
266
|
* `backblaze_b2_bucket` (string): Backblaze B2 Cloud Storage Bucket name
|
248
267
|
* `backblaze_b2_s3_endpoint` (string): Backblaze B2 Cloud Storage S3 Endpoint
|
249
|
-
* `wasabi_bucket` (string): Wasabi
|
250
|
-
* `wasabi_region` (string): Wasabi
|
268
|
+
* `wasabi_bucket` (string): Wasabi Bucket name
|
269
|
+
* `wasabi_region` (string): Wasabi region
|
251
270
|
* `rackspace_username` (string): Rackspace username used to login to the Rackspace Cloud Control Panel.
|
252
271
|
* `rackspace_region` (string): Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
|
253
272
|
* `rackspace_container` (string): The name of the container (top level directory) where files will sync.
|
254
273
|
* `one_drive_account_type` (string): Either personal or business_other account types
|
255
274
|
* `azure_blob_storage_account` (string): Azure Blob Storage Account name
|
256
275
|
* `azure_blob_storage_container` (string): Azure Blob Storage Container name
|
276
|
+
* `s3_compatible_bucket` (string): S3-compatible Bucket name
|
277
|
+
* `s3_compatible_region` (string): S3-compatible Bucket name
|
278
|
+
* `s3_compatible_endpoint` (string): S3-compatible endpoint
|
279
|
+
* `s3_compatible_access_key` (string): S3-compatible access key
|
280
|
+
* `s3_compatible_secret_key` (string): S3-compatible secret key
|
257
281
|
|
258
282
|
|
259
283
|
---
|
@@ -293,14 +317,17 @@ remote_server.update(
|
|
293
317
|
google_cloud_storage_project_id: "my-project",
|
294
318
|
backblaze_b2_bucket: "my-bucket",
|
295
319
|
backblaze_b2_s3_endpoint: "s3.us-west-001.backblazeb2.com",
|
296
|
-
wasabi_bucket: "
|
297
|
-
wasabi_region: "
|
320
|
+
wasabi_bucket: "my-bucket",
|
321
|
+
wasabi_region: "us-west-1",
|
298
322
|
rackspace_username: "rackspaceuser",
|
299
323
|
rackspace_region: "dfw",
|
300
324
|
rackspace_container: "my-container",
|
301
325
|
one_drive_account_type: "personal",
|
302
326
|
azure_blob_storage_account: "storage-account-name",
|
303
|
-
azure_blob_storage_container: "container-name"
|
327
|
+
azure_blob_storage_container: "container-name",
|
328
|
+
s3_compatible_bucket: "my-bucket",
|
329
|
+
s3_compatible_region: "us-east-1",
|
330
|
+
s3_compatible_endpoint: "mys3platform.com"
|
304
331
|
)
|
305
332
|
```
|
306
333
|
|
@@ -335,14 +362,19 @@ remote_server.update(
|
|
335
362
|
* `google_cloud_storage_project_id` (string): Google Cloud Project ID
|
336
363
|
* `backblaze_b2_bucket` (string): Backblaze B2 Cloud Storage Bucket name
|
337
364
|
* `backblaze_b2_s3_endpoint` (string): Backblaze B2 Cloud Storage S3 Endpoint
|
338
|
-
* `wasabi_bucket` (string): Wasabi
|
339
|
-
* `wasabi_region` (string): Wasabi
|
365
|
+
* `wasabi_bucket` (string): Wasabi Bucket name
|
366
|
+
* `wasabi_region` (string): Wasabi region
|
340
367
|
* `rackspace_username` (string): Rackspace username used to login to the Rackspace Cloud Control Panel.
|
341
368
|
* `rackspace_region` (string): Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
|
342
369
|
* `rackspace_container` (string): The name of the container (top level directory) where files will sync.
|
343
370
|
* `one_drive_account_type` (string): Either personal or business_other account types
|
344
371
|
* `azure_blob_storage_account` (string): Azure Blob Storage Account name
|
345
372
|
* `azure_blob_storage_container` (string): Azure Blob Storage Container name
|
373
|
+
* `s3_compatible_bucket` (string): S3-compatible Bucket name
|
374
|
+
* `s3_compatible_region` (string): S3-compatible Bucket name
|
375
|
+
* `s3_compatible_endpoint` (string): S3-compatible endpoint
|
376
|
+
* `s3_compatible_access_key` (string): S3-compatible access key
|
377
|
+
* `s3_compatible_secret_key` (string): S3-compatible secret key
|
346
378
|
|
347
379
|
|
348
380
|
---
|
data/lib/files.com/api_client.rb
CHANGED
@@ -154,7 +154,12 @@ module Files
|
|
154
154
|
http.request request do |response|
|
155
155
|
io.fulfill_content_length(response.content_length) if io.respond_to?(:fulfill_content_length)
|
156
156
|
response.read_body do |chunk|
|
157
|
+
response.error! if response.code.to_i >= 300
|
158
|
+
io.ready! if io.respond_to?(:ready!)
|
157
159
|
io << chunk
|
160
|
+
rescue => e
|
161
|
+
io.set_error(e) if io.respond_to?(:set_error)
|
162
|
+
io.close
|
158
163
|
end
|
159
164
|
end
|
160
165
|
end
|
data/lib/files.com/models/app.rb
CHANGED
@@ -19,6 +19,11 @@ module Files
|
|
19
19
|
@attributes[:extended_description]
|
20
20
|
end
|
21
21
|
|
22
|
+
# string - Short description of the App
|
23
|
+
def short_description
|
24
|
+
@attributes[:short_description]
|
25
|
+
end
|
26
|
+
|
22
27
|
# string - Collection of named links to documentation
|
23
28
|
def documentation_links
|
24
29
|
@attributes[:documentation_links]
|
@@ -14,21 +14,37 @@ module Files
|
|
14
14
|
@attributes[:id]
|
15
15
|
end
|
16
16
|
|
17
|
+
def id=(value)
|
18
|
+
@attributes[:id] = value
|
19
|
+
end
|
20
|
+
|
17
21
|
# string - Type of event being recorded.
|
18
22
|
def event_type
|
19
23
|
@attributes[:event_type]
|
20
24
|
end
|
21
25
|
|
26
|
+
def event_type=(value)
|
27
|
+
@attributes[:event_type] = value
|
28
|
+
end
|
29
|
+
|
22
30
|
# string - Status of event.
|
23
31
|
def status
|
24
32
|
@attributes[:status]
|
25
33
|
end
|
26
34
|
|
35
|
+
def status=(value)
|
36
|
+
@attributes[:status] = value
|
37
|
+
end
|
38
|
+
|
27
39
|
# string - Event body
|
28
40
|
def body
|
29
41
|
@attributes[:body]
|
30
42
|
end
|
31
43
|
|
44
|
+
def body=(value)
|
45
|
+
@attributes[:body] = value
|
46
|
+
end
|
47
|
+
|
32
48
|
# date-time - External event create date/time
|
33
49
|
def created_at
|
34
50
|
@attributes[:created_at]
|
@@ -39,6 +55,19 @@ module Files
|
|
39
55
|
@attributes[:body_url]
|
40
56
|
end
|
41
57
|
|
58
|
+
def body_url=(value)
|
59
|
+
@attributes[:body_url] = value
|
60
|
+
end
|
61
|
+
|
62
|
+
def save
|
63
|
+
if @attributes[:id]
|
64
|
+
raise NotImplementedError.new("The ExternalEvent object doesn't support updates.")
|
65
|
+
else
|
66
|
+
new_obj = ExternalEvent.create(@attributes, @options)
|
67
|
+
@attributes = new_obj.attributes
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
42
71
|
# Parameters:
|
43
72
|
# cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
|
44
73
|
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
@@ -84,5 +113,18 @@ module Files
|
|
84
113
|
def self.get(id, params = {}, options = {})
|
85
114
|
find(id, params, options)
|
86
115
|
end
|
116
|
+
|
117
|
+
# Parameters:
|
118
|
+
# status (required) - string - Status of event.
|
119
|
+
# body (required) - string - Event body
|
120
|
+
def self.create(params = {}, options = {})
|
121
|
+
raise InvalidParameterError.new("Bad parameter: status must be an String") if params.dig(:status) and !params.dig(:status).is_a?(String)
|
122
|
+
raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
|
123
|
+
raise MissingParameterError.new("Parameter missing: status") unless params.dig(:status)
|
124
|
+
raise MissingParameterError.new("Parameter missing: body") unless params.dig(:body)
|
125
|
+
|
126
|
+
response, options = Api.send_request("/external_events", :post, params, options)
|
127
|
+
ExternalEvent.new(response.data, options)
|
128
|
+
end
|
87
129
|
end
|
88
130
|
end
|
@@ -171,7 +171,7 @@ module Files
|
|
171
171
|
@attributes[:backblaze_b2_bucket] = value
|
172
172
|
end
|
173
173
|
|
174
|
-
# string - Wasabi
|
174
|
+
# string - Wasabi Bucket name
|
175
175
|
def wasabi_bucket
|
176
176
|
@attributes[:wasabi_bucket]
|
177
177
|
end
|
@@ -180,7 +180,7 @@ module Files
|
|
180
180
|
@attributes[:wasabi_bucket] = value
|
181
181
|
end
|
182
182
|
|
183
|
-
# string - Wasabi
|
183
|
+
# string - Wasabi region
|
184
184
|
def wasabi_region
|
185
185
|
@attributes[:wasabi_region]
|
186
186
|
end
|
@@ -270,6 +270,33 @@ module Files
|
|
270
270
|
@attributes[:azure_blob_storage_container] = value
|
271
271
|
end
|
272
272
|
|
273
|
+
# string - S3-compatible Bucket name
|
274
|
+
def s3_compatible_bucket
|
275
|
+
@attributes[:s3_compatible_bucket]
|
276
|
+
end
|
277
|
+
|
278
|
+
def s3_compatible_bucket=(value)
|
279
|
+
@attributes[:s3_compatible_bucket] = value
|
280
|
+
end
|
281
|
+
|
282
|
+
# string - S3-compatible Bucket name
|
283
|
+
def s3_compatible_region
|
284
|
+
@attributes[:s3_compatible_region]
|
285
|
+
end
|
286
|
+
|
287
|
+
def s3_compatible_region=(value)
|
288
|
+
@attributes[:s3_compatible_region] = value
|
289
|
+
end
|
290
|
+
|
291
|
+
# string - S3-compatible endpoint
|
292
|
+
def s3_compatible_endpoint
|
293
|
+
@attributes[:s3_compatible_endpoint]
|
294
|
+
end
|
295
|
+
|
296
|
+
def s3_compatible_endpoint=(value)
|
297
|
+
@attributes[:s3_compatible_endpoint] = value
|
298
|
+
end
|
299
|
+
|
273
300
|
# string - AWS Access Key.
|
274
301
|
def aws_access_key
|
275
302
|
@attributes[:aws_access_key]
|
@@ -387,6 +414,24 @@ module Files
|
|
387
414
|
@attributes[:azure_blob_storage_access_key] = value
|
388
415
|
end
|
389
416
|
|
417
|
+
# string - S3-compatible access key
|
418
|
+
def s3_compatible_access_key
|
419
|
+
@attributes[:s3_compatible_access_key]
|
420
|
+
end
|
421
|
+
|
422
|
+
def s3_compatible_access_key=(value)
|
423
|
+
@attributes[:s3_compatible_access_key] = value
|
424
|
+
end
|
425
|
+
|
426
|
+
# string - S3-compatible secret key
|
427
|
+
def s3_compatible_secret_key
|
428
|
+
@attributes[:s3_compatible_secret_key]
|
429
|
+
end
|
430
|
+
|
431
|
+
def s3_compatible_secret_key=(value)
|
432
|
+
@attributes[:s3_compatible_secret_key] = value
|
433
|
+
end
|
434
|
+
|
390
435
|
# Parameters:
|
391
436
|
# aws_access_key - string - AWS Access Key.
|
392
437
|
# aws_secret_key - string - AWS secret key.
|
@@ -416,14 +461,19 @@ module Files
|
|
416
461
|
# google_cloud_storage_project_id - string - Google Cloud Project ID
|
417
462
|
# backblaze_b2_bucket - string - Backblaze B2 Cloud Storage Bucket name
|
418
463
|
# backblaze_b2_s3_endpoint - string - Backblaze B2 Cloud Storage S3 Endpoint
|
419
|
-
# wasabi_bucket - string - Wasabi
|
420
|
-
# wasabi_region - string - Wasabi
|
464
|
+
# wasabi_bucket - string - Wasabi Bucket name
|
465
|
+
# wasabi_region - string - Wasabi region
|
421
466
|
# rackspace_username - string - Rackspace username used to login to the Rackspace Cloud Control Panel.
|
422
467
|
# rackspace_region - string - Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
|
423
468
|
# rackspace_container - string - The name of the container (top level directory) where files will sync.
|
424
469
|
# one_drive_account_type - string - Either personal or business_other account types
|
425
470
|
# azure_blob_storage_account - string - Azure Blob Storage Account name
|
426
471
|
# azure_blob_storage_container - string - Azure Blob Storage Container name
|
472
|
+
# s3_compatible_bucket - string - S3-compatible Bucket name
|
473
|
+
# s3_compatible_region - string - S3-compatible Bucket name
|
474
|
+
# s3_compatible_endpoint - string - S3-compatible endpoint
|
475
|
+
# s3_compatible_access_key - string - S3-compatible access key
|
476
|
+
# s3_compatible_secret_key - string - S3-compatible secret key
|
427
477
|
def update(params = {})
|
428
478
|
params ||= {}
|
429
479
|
params[:id] = @attributes[:id]
|
@@ -464,6 +514,11 @@ module Files
|
|
464
514
|
raise InvalidParameterError.new("Bad parameter: one_drive_account_type must be an String") if params.dig(:one_drive_account_type) and !params.dig(:one_drive_account_type).is_a?(String)
|
465
515
|
raise InvalidParameterError.new("Bad parameter: azure_blob_storage_account must be an String") if params.dig(:azure_blob_storage_account) and !params.dig(:azure_blob_storage_account).is_a?(String)
|
466
516
|
raise InvalidParameterError.new("Bad parameter: azure_blob_storage_container must be an String") if params.dig(:azure_blob_storage_container) and !params.dig(:azure_blob_storage_container).is_a?(String)
|
517
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_bucket must be an String") if params.dig(:s3_compatible_bucket) and !params.dig(:s3_compatible_bucket).is_a?(String)
|
518
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_region must be an String") if params.dig(:s3_compatible_region) and !params.dig(:s3_compatible_region).is_a?(String)
|
519
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_endpoint must be an String") if params.dig(:s3_compatible_endpoint) and !params.dig(:s3_compatible_endpoint).is_a?(String)
|
520
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_access_key must be an String") if params.dig(:s3_compatible_access_key) and !params.dig(:s3_compatible_access_key).is_a?(String)
|
521
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_secret_key must be an String") if params.dig(:s3_compatible_secret_key) and !params.dig(:s3_compatible_secret_key).is_a?(String)
|
467
522
|
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
468
523
|
|
469
524
|
Api.send_request("/remote_servers/#{@attributes[:id]}", :patch, params, @options)
|
@@ -553,14 +608,19 @@ module Files
|
|
553
608
|
# google_cloud_storage_project_id - string - Google Cloud Project ID
|
554
609
|
# backblaze_b2_bucket - string - Backblaze B2 Cloud Storage Bucket name
|
555
610
|
# backblaze_b2_s3_endpoint - string - Backblaze B2 Cloud Storage S3 Endpoint
|
556
|
-
# wasabi_bucket - string - Wasabi
|
557
|
-
# wasabi_region - string - Wasabi
|
611
|
+
# wasabi_bucket - string - Wasabi Bucket name
|
612
|
+
# wasabi_region - string - Wasabi region
|
558
613
|
# rackspace_username - string - Rackspace username used to login to the Rackspace Cloud Control Panel.
|
559
614
|
# rackspace_region - string - Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
|
560
615
|
# rackspace_container - string - The name of the container (top level directory) where files will sync.
|
561
616
|
# one_drive_account_type - string - Either personal or business_other account types
|
562
617
|
# azure_blob_storage_account - string - Azure Blob Storage Account name
|
563
618
|
# azure_blob_storage_container - string - Azure Blob Storage Container name
|
619
|
+
# s3_compatible_bucket - string - S3-compatible Bucket name
|
620
|
+
# s3_compatible_region - string - S3-compatible Bucket name
|
621
|
+
# s3_compatible_endpoint - string - S3-compatible endpoint
|
622
|
+
# s3_compatible_access_key - string - S3-compatible access key
|
623
|
+
# s3_compatible_secret_key - string - S3-compatible secret key
|
564
624
|
def self.create(params = {}, options = {})
|
565
625
|
raise InvalidParameterError.new("Bad parameter: aws_access_key must be an String") if params.dig(:aws_access_key) and !params.dig(:aws_access_key).is_a?(String)
|
566
626
|
raise InvalidParameterError.new("Bad parameter: aws_secret_key must be an String") if params.dig(:aws_secret_key) and !params.dig(:aws_secret_key).is_a?(String)
|
@@ -597,6 +657,11 @@ module Files
|
|
597
657
|
raise InvalidParameterError.new("Bad parameter: one_drive_account_type must be an String") if params.dig(:one_drive_account_type) and !params.dig(:one_drive_account_type).is_a?(String)
|
598
658
|
raise InvalidParameterError.new("Bad parameter: azure_blob_storage_account must be an String") if params.dig(:azure_blob_storage_account) and !params.dig(:azure_blob_storage_account).is_a?(String)
|
599
659
|
raise InvalidParameterError.new("Bad parameter: azure_blob_storage_container must be an String") if params.dig(:azure_blob_storage_container) and !params.dig(:azure_blob_storage_container).is_a?(String)
|
660
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_bucket must be an String") if params.dig(:s3_compatible_bucket) and !params.dig(:s3_compatible_bucket).is_a?(String)
|
661
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_region must be an String") if params.dig(:s3_compatible_region) and !params.dig(:s3_compatible_region).is_a?(String)
|
662
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_endpoint must be an String") if params.dig(:s3_compatible_endpoint) and !params.dig(:s3_compatible_endpoint).is_a?(String)
|
663
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_access_key must be an String") if params.dig(:s3_compatible_access_key) and !params.dig(:s3_compatible_access_key).is_a?(String)
|
664
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_secret_key must be an String") if params.dig(:s3_compatible_secret_key) and !params.dig(:s3_compatible_secret_key).is_a?(String)
|
600
665
|
|
601
666
|
response, options = Api.send_request("/remote_servers", :post, params, options)
|
602
667
|
RemoteServer.new(response.data, options)
|
@@ -631,14 +696,19 @@ module Files
|
|
631
696
|
# google_cloud_storage_project_id - string - Google Cloud Project ID
|
632
697
|
# backblaze_b2_bucket - string - Backblaze B2 Cloud Storage Bucket name
|
633
698
|
# backblaze_b2_s3_endpoint - string - Backblaze B2 Cloud Storage S3 Endpoint
|
634
|
-
# wasabi_bucket - string - Wasabi
|
635
|
-
# wasabi_region - string - Wasabi
|
699
|
+
# wasabi_bucket - string - Wasabi Bucket name
|
700
|
+
# wasabi_region - string - Wasabi region
|
636
701
|
# rackspace_username - string - Rackspace username used to login to the Rackspace Cloud Control Panel.
|
637
702
|
# rackspace_region - string - Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
|
638
703
|
# rackspace_container - string - The name of the container (top level directory) where files will sync.
|
639
704
|
# one_drive_account_type - string - Either personal or business_other account types
|
640
705
|
# azure_blob_storage_account - string - Azure Blob Storage Account name
|
641
706
|
# azure_blob_storage_container - string - Azure Blob Storage Container name
|
707
|
+
# s3_compatible_bucket - string - S3-compatible Bucket name
|
708
|
+
# s3_compatible_region - string - S3-compatible Bucket name
|
709
|
+
# s3_compatible_endpoint - string - S3-compatible endpoint
|
710
|
+
# s3_compatible_access_key - string - S3-compatible access key
|
711
|
+
# s3_compatible_secret_key - string - S3-compatible secret key
|
642
712
|
def self.update(id, params = {}, options = {})
|
643
713
|
params ||= {}
|
644
714
|
params[:id] = id
|
@@ -678,6 +748,11 @@ module Files
|
|
678
748
|
raise InvalidParameterError.new("Bad parameter: one_drive_account_type must be an String") if params.dig(:one_drive_account_type) and !params.dig(:one_drive_account_type).is_a?(String)
|
679
749
|
raise InvalidParameterError.new("Bad parameter: azure_blob_storage_account must be an String") if params.dig(:azure_blob_storage_account) and !params.dig(:azure_blob_storage_account).is_a?(String)
|
680
750
|
raise InvalidParameterError.new("Bad parameter: azure_blob_storage_container must be an String") if params.dig(:azure_blob_storage_container) and !params.dig(:azure_blob_storage_container).is_a?(String)
|
751
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_bucket must be an String") if params.dig(:s3_compatible_bucket) and !params.dig(:s3_compatible_bucket).is_a?(String)
|
752
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_region must be an String") if params.dig(:s3_compatible_region) and !params.dig(:s3_compatible_region).is_a?(String)
|
753
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_endpoint must be an String") if params.dig(:s3_compatible_endpoint) and !params.dig(:s3_compatible_endpoint).is_a?(String)
|
754
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_access_key must be an String") if params.dig(:s3_compatible_access_key) and !params.dig(:s3_compatible_access_key).is_a?(String)
|
755
|
+
raise InvalidParameterError.new("Bad parameter: s3_compatible_secret_key must be an String") if params.dig(:s3_compatible_secret_key) and !params.dig(:s3_compatible_secret_key).is_a?(String)
|
681
756
|
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
682
757
|
|
683
758
|
response, options = Api.send_request("/remote_servers/#{params[:id]}", :patch, params, options)
|
data/lib/files.com/sizable_io.rb
CHANGED
@@ -12,26 +12,54 @@ module Files
|
|
12
12
|
read_io.content_length_promise.wait.value
|
13
13
|
end
|
14
14
|
|
15
|
+
def wait!(timeout=nil)
|
16
|
+
read_io.ready_promise.wait(timeout)
|
17
|
+
error!
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
15
21
|
def fulfill_content_length(length)
|
16
22
|
read_io.content_length = length
|
17
23
|
read_io.content_length_promise.execute
|
18
24
|
end
|
19
25
|
|
26
|
+
def ready!
|
27
|
+
read_io.ready_promise.execute
|
28
|
+
end
|
29
|
+
|
20
30
|
def close
|
31
|
+
raise @with_error if @with_error
|
21
32
|
super
|
22
33
|
read_io.content_length_promise.try_set(nil)
|
34
|
+
read_io.ready_promise.try_set(true)
|
35
|
+
end
|
36
|
+
|
37
|
+
def error!
|
38
|
+
raise read_io.with_error if read_io.with_error
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_error(e)
|
42
|
+
read_io.with_error = e
|
23
43
|
end
|
24
44
|
|
25
45
|
protected
|
26
46
|
|
27
|
-
attr_accessor :content_length
|
47
|
+
attr_accessor :content_length, :with_error
|
28
48
|
|
29
49
|
def content_length_promise
|
30
50
|
@content_length_promise ||= Concurrent::Promise.new { content_length }
|
31
51
|
end
|
32
52
|
|
53
|
+
def ready_promise
|
54
|
+
@ready_promise ||= Concurrent::Promise.new { true }
|
55
|
+
end
|
56
|
+
|
33
57
|
def read_io
|
34
58
|
@read_io || self
|
35
59
|
end
|
60
|
+
|
61
|
+
def read_io?
|
62
|
+
read_io == self
|
63
|
+
end
|
36
64
|
end
|
37
65
|
end
|
data/spec/models/file_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "tempfile"
|
3
3
|
|
4
|
-
RSpec.describe Files::File, :with_test_folder do
|
5
|
-
|
4
|
+
RSpec.describe Files::File, :with_test_folder, skip: ENV["GITLAB"] do
|
5
|
+
describe "#read" do
|
6
6
|
before do
|
7
7
|
Files::File.open(test_folder.join("[[strange stuff]]#yes.text").to_s, 'w', options) do |f|
|
8
8
|
f.write("contents")
|
@@ -13,9 +13,19 @@ RSpec.describe Files::File, :with_test_folder do
|
|
13
13
|
file = Files::File.find(test_folder.join("[[strange stuff]]#yes.text").to_s, {}, options)
|
14
14
|
expect(file.read).to eq("contents")
|
15
15
|
end
|
16
|
+
|
17
|
+
context "stream failure" do
|
18
|
+
let(:expired_download) { "https://s3.amazonaws.com/objects.brickftp.com/metadata/37868/52f55a21-1685-46aa-aaff-99ca8b172c00?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEWLY3MN4YGZQOWA%2F20210621%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210621T202802Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&response-cache-control=no-cache%2C%20no-store&response-content-disposition=attachment%3B%20filename%3D%22write-as-io.txt%22&response-content-type=text%2Fplain&X-Amz-Signature=83d5b5789cbd2282bfea6e560e4319385135204dc0df3217930f96905c9cb18f" }
|
19
|
+
|
20
|
+
it "waits for io to be ready" do
|
21
|
+
file = Files::File.new
|
22
|
+
allow(file).to receive(:download_uri_with_load).and_return(expired_download)
|
23
|
+
expect { file.read_io }.to raise_error('403 "Forbidden"')
|
24
|
+
end
|
25
|
+
end
|
16
26
|
end
|
17
27
|
|
18
|
-
|
28
|
+
describe "#read_io" do
|
19
29
|
before do
|
20
30
|
Files::File.open(test_folder.join("read.txt").to_s, 'w', options) do |f|
|
21
31
|
f.write("contents")
|
@@ -28,9 +38,17 @@ RSpec.describe Files::File, :with_test_folder do
|
|
28
38
|
expect(file.read_io.read).to eq("contents")
|
29
39
|
expect(file.read_io.size).to eq("contents".length)
|
30
40
|
end
|
41
|
+
|
42
|
+
it "works for file with zero bytes" do
|
43
|
+
file = Files::File.open("zero-byte.txt", 'w', options)
|
44
|
+
file.write("")
|
45
|
+
file.close
|
46
|
+
file = Files::File.find("zero-byte.txt", {}, options)
|
47
|
+
expect(file.read_io.read).to eq("")
|
48
|
+
end
|
31
49
|
end
|
32
50
|
|
33
|
-
|
51
|
+
describe "#write" do
|
34
52
|
it "can take string" do
|
35
53
|
Files::File.open(test_folder.join("write-as-string.txt").to_s, 'w', options) do |f|
|
36
54
|
f.write("I am a string")
|
@@ -65,4 +83,18 @@ RSpec.describe Files::File, :with_test_folder do
|
|
65
83
|
temp_file.close
|
66
84
|
end
|
67
85
|
end
|
86
|
+
|
87
|
+
describe "#download_content" do
|
88
|
+
let(:file) {
|
89
|
+
Files::File.open(test_folder.join("write-as-string.txt").to_s, 'w', options) do |f|
|
90
|
+
f.write("I am a string")
|
91
|
+
end
|
92
|
+
}
|
93
|
+
|
94
|
+
it "can take arbitrary IO" do
|
95
|
+
file.download_content(io = StringIO.new)
|
96
|
+
|
97
|
+
expect(io.tap(&:rewind).read).to eq("I am a string")
|
98
|
+
end
|
99
|
+
end
|
68
100
|
end
|
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.181
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- files.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|