files.com 1.0.175 → 1.0.180

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: ee791002e91935366fbf1fa1f7066c02b5fb8744590032d639866084d0db0662
4
- data.tar.gz: c26e40bc5b99edf103e353059a0b36d66f99c3d266f4b78eefbed062ce30bc38
3
+ metadata.gz: 63d792817bc5dda505fbbb43345568f676002d923ceacdcd57077c92807740fb
4
+ data.tar.gz: 96e5ab20cef1cd119fc00bcb067fdca15cf1998920d0c8e48934eb2fbaa1d883
5
5
  SHA512:
6
- metadata.gz: 0e019254873803c9fcd319b48715351edc199c2f542b0a977c69c0d0cf19847b9370a0e3ce8253d17ee8625223ff71114efc103fef3dfc0999b6a66551e337ce
7
- data.tar.gz: 186ff191d13f344fe00cdce69aa1ecde1e17bbd6a98e5f985b7aee8875bb8800d2b0bc91e81285fa0b26b62ee80d2935ba21179ad7495acdeb7e969fc451d454
6
+ metadata.gz: 2d861ef902119b67bd307d797f911ce605f9e5f5b0374b9e4436c2ae5e8c898a43a4589f9a869d57ce0ef0b8c8ad24dd196a80b7da4a6557965697d9f8a71579
7
+ data.tar.gz: 4876b0348fbc069e36d4f9004cf33e004ffc1986a9b8779d2d0b4128961a6c82426d45d7a7e5a1da07492f5b1bebaf7e24aeb81fd6aa1443ea688b0b0674e669
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.175
1
+ 1.0.180
@@ -8,7 +8,8 @@
8
8
  "event_type": "",
9
9
  "status": "",
10
10
  "body": "",
11
- "created_at": "2000-01-01T01:00:00Z"
11
+ "created_at": "2000-01-01T01:00:00Z",
12
+ "body_url": ""
12
13
  }
13
14
  ```
14
15
 
@@ -17,6 +18,7 @@
17
18
  * `status` (string): Status of event.
18
19
  * `body` (string): Event body
19
20
  * `created_at` (date-time): External event create date/time
21
+ * `body_url` (string): Link to log file.
20
22
 
21
23
 
22
24
  ---
@@ -53,3 +55,20 @@ Files::ExternalEvent.find(id)
53
55
  ### Parameters
54
56
 
55
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
@@ -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": "us-west-1",
26
- "wasabi_region": "my-bucket",
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 region
58
- * `wasabi_region` (string): Wasabi Bucket name
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: "us-west-1",
135
- wasabi_region: "my-bucket",
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 region
176
- * `wasabi_region` (string): Wasabi Bucket name
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: "us-west-1",
208
- wasabi_region: "my-bucket",
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 region
250
- * `wasabi_region` (string): Wasabi Bucket name
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: "us-west-1",
297
- wasabi_region: "my-bucket",
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 region
339
- * `wasabi_region` (string): Wasabi Bucket name
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
  ---
@@ -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
@@ -14,26 +14,60 @@ 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]
35
51
  end
36
52
 
53
+ # string - Link to log file.
54
+ def body_url
55
+ @attributes[:body_url]
56
+ end
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
+
37
71
  # Parameters:
38
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.
39
73
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
@@ -79,5 +113,18 @@ module Files
79
113
  def self.get(id, params = {}, options = {})
80
114
  find(id, params, options)
81
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
82
129
  end
83
130
  end
@@ -396,7 +396,7 @@ module Files
396
396
  ensure
397
397
  w.close
398
398
  end
399
- r
399
+ r.wait!(5)
400
400
  end
401
401
  end
402
402
 
@@ -171,7 +171,7 @@ module Files
171
171
  @attributes[:backblaze_b2_bucket] = value
172
172
  end
173
173
 
174
- # string - Wasabi region
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 Bucket name
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 region
420
- # wasabi_region - string - Wasabi Bucket name
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 region
557
- # wasabi_region - string - Wasabi Bucket name
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 region
635
- # wasabi_region - string - Wasabi Bucket name
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)
@@ -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
@@ -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
- xdescribe "#read" do
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
- xdescribe "#read_io" do
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
- xdescribe "#write" do
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.175
4
+ version: 1.0.180
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-06-03 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable