files.com 1.0.109 → 1.0.114
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/api_key.md +1 -1
- data/docs/bundle.md +2 -0
- data/docs/file_upload_part.md +39 -0
- data/docs/history_export.md +3 -3
- data/docs/history_export_result.md +1 -1
- data/docs/site.md +4 -0
- data/docs/sso_strategy.md +2 -0
- data/docs/user.md +17 -7
- data/lib/files.com.rb +2 -1
- data/lib/files.com/api_client.rb +3 -2
- data/lib/files.com/models/api_key.rb +1 -1
- data/lib/files.com/models/bundle.rb +9 -0
- data/lib/files.com/models/file_action.rb +1 -1
- data/lib/files.com/models/{file_part_upload.rb → file_upload_part.rb} +12 -12
- data/lib/files.com/models/history_export.rb +3 -3
- data/lib/files.com/models/history_export_result.rb +1 -1
- data/lib/files.com/models/site.rb +7 -0
- data/lib/files.com/models/sso_strategy.rb +5 -0
- data/lib/files.com/models/user.rb +31 -7
- data/lib/files.com/uri.rb +70 -0
- data/spec/uri_spec.rb +11 -0
- metadata +6 -4
- data/docs/file_part_upload.md +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0140009d9239b550428a77cf0b980aafe955f6d4af1b070006b37f429862cdc2'
|
4
|
+
data.tar.gz: a75744cf9cfa245c436809bcbefc6f6304f4761fb18781b42cf893558009d4ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1662972d5f44f7169d8a74beff8f232b686832a8e4af6f8dacbc452b294363b652ba45f2bacba8c3ef7df6856c6dda675197b21e0db908d5284b4c69a31add67
|
7
|
+
data.tar.gz: a1407444578059eddc21287416770218c3420b3246bd7eb220dc4e1c487014807c47be050b54379793e13157217f1d33f4ea2e8e7e941ec1c621421818b1ce2e
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.114
|
data/docs/api_key.md
CHANGED
data/docs/bundle.md
CHANGED
@@ -20,6 +20,7 @@
|
|
20
20
|
"username": "user",
|
21
21
|
"clickwrap_id": 1,
|
22
22
|
"inbox_id": 1,
|
23
|
+
"has_inbox": true,
|
23
24
|
"paths": [
|
24
25
|
|
25
26
|
]
|
@@ -42,6 +43,7 @@
|
|
42
43
|
* `username` (string): Bundle creator username
|
43
44
|
* `clickwrap_id` (int64): ID of the clickwrap to use with this bundle.
|
44
45
|
* `inbox_id` (int64): ID of the associated inbox, if available.
|
46
|
+
* `has_inbox` (boolean): Does this bundle have an associated inbox?
|
45
47
|
* `paths` (array): A list of paths in this bundle
|
46
48
|
* `password` (string): Password for this bundle.
|
47
49
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# FileUploadPart
|
2
|
+
|
3
|
+
## Example FileUploadPart Object
|
4
|
+
|
5
|
+
```
|
6
|
+
{
|
7
|
+
"send": "",
|
8
|
+
"action": "multipart",
|
9
|
+
"ask_about_overwrites": true,
|
10
|
+
"available_parts": 1,
|
11
|
+
"expires": "",
|
12
|
+
"headers": "",
|
13
|
+
"http_method": "PUT",
|
14
|
+
"next_partsize": 1,
|
15
|
+
"parallel_parts": true,
|
16
|
+
"parameters": "{}",
|
17
|
+
"part_number": 1,
|
18
|
+
"partsize": 1,
|
19
|
+
"path": "",
|
20
|
+
"ref": "upload-1",
|
21
|
+
"upload_uri": ""
|
22
|
+
}
|
23
|
+
```
|
24
|
+
|
25
|
+
* `send` (object): Content-Type and File to send
|
26
|
+
* `action` (string): Type of upload
|
27
|
+
* `ask_about_overwrites` (boolean): If `true`, this file exists and you may wish to ask the user for overwrite confirmation
|
28
|
+
* `available_parts` (int64): Number of parts in the upload
|
29
|
+
* `expires` (string): Date/time of when this Upload part expires and the URL cannot be used any more
|
30
|
+
* `headers` (object): Additional upload headers to provide as part of the upload
|
31
|
+
* `http_method` (string): HTTP Method to use for uploading the part, usually `PUT`
|
32
|
+
* `next_partsize` (int64): Size in bytes for this part
|
33
|
+
* `parallel_parts` (boolean): If `true`, multiple parts may be uploaded in parallel. If `false`, be sure to only upload one part at a time, in order.
|
34
|
+
* `parameters` (object): Additional HTTP parameters to send with the upload
|
35
|
+
* `part_number` (int64): Number of this upload part
|
36
|
+
* `partsize` (int64): Size in bytes for the next upload part
|
37
|
+
* `path` (string): New file path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
38
|
+
* `ref` (string): Reference name for this upload part
|
39
|
+
* `upload_uri` (string): URI to upload this part to
|
data/docs/history_export.md
CHANGED
@@ -34,9 +34,9 @@
|
|
34
34
|
* `id` (int64): History Export ID
|
35
35
|
* `start_at` (date-time): Start date/time of export range.
|
36
36
|
* `end_at` (date-time): End date/time of export range.
|
37
|
-
* `status` (string): Status of export. Will be: `building` or `
|
37
|
+
* `status` (string): Status of export. Will be: `building`, `ready`, or `failed`
|
38
38
|
* `query_action` (string): Filter results by this this action type. Valid values: `create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_update`, `user_destroy`, `group_create`, `group_update`, `group_destroy`, `permission_create`, `permission_destroy`, `api_key_create`, `api_key_update`, `api_key_destroy`
|
39
|
-
* `query_interface` (string): Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
|
39
|
+
* `query_interface` (string): Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`
|
40
40
|
* `query_user_id` (string): Return results that are actions performed by the user indiciated by this User ID
|
41
41
|
* `query_file_id` (string): Return results that are file actions related to the file indicated by this File ID
|
42
42
|
* `query_parent_id` (string): Return results that are file actions inside the parent folder specified by this folder ID
|
@@ -108,7 +108,7 @@ Files::HistoryExport.create(
|
|
108
108
|
* `start_at` (string): Start date/time of export range.
|
109
109
|
* `end_at` (string): End date/time of export range.
|
110
110
|
* `query_action` (string): Filter results by this this action type. Valid values: `create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_update`, `user_destroy`, `group_create`, `group_update`, `group_destroy`, `permission_create`, `permission_destroy`, `api_key_create`, `api_key_update`, `api_key_destroy`
|
111
|
-
* `query_interface` (string): Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
|
111
|
+
* `query_interface` (string): Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`
|
112
112
|
* `query_user_id` (string): Return results that are actions performed by the user indiciated by this User ID
|
113
113
|
* `query_file_id` (string): Return results that are file actions related to the file indicated by this File ID
|
114
114
|
* `query_parent_id` (string): Return results that are file actions inside the parent folder specified by this folder ID
|
@@ -43,7 +43,7 @@
|
|
43
43
|
* `username` (string): Username of the user that performed the action
|
44
44
|
* `action` (string): What action was taken. Valid values: `create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_update`, `user_destroy`, `group_create`, `group_update`, `group_destroy`, `permission_create`, `permission_destroy`, `api_key_create`, `api_key_update`, `api_key_destroy`
|
45
45
|
* `failure_type` (string): The type of login failure, if applicable. Valid values: `expired_trial`, `account_overdue`, `locked_out`, `ip_mismatch`, `password_mismatch`, `site_mismatch`, `username_not_found`, `none`, `no_ftp_permission`, `no_web_permission`, `no_directory`, `errno_enoent`, `no_sftp_permission`, `no_dav_permission`, `no_restapi_permission`, `key_mismatch`, `region_mismatch`, `expired_access`, `desktop_ip_mismatch`, `desktop_api_key_not_used_quickly_enough`, `disabled`
|
46
|
-
* `interface` (string): Inteface through which the action was taken. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
|
46
|
+
* `interface` (string): Inteface through which the action was taken. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`
|
47
47
|
* `target_id` (int64): ID of the object (such as Users, or API Keys) on which the action was taken
|
48
48
|
* `target_name` (string): Name of the User, Group or other object with a name related to this action
|
49
49
|
* `target_permission` (string): Permission level of the action
|
data/docs/site.md
CHANGED
@@ -32,6 +32,7 @@
|
|
32
32
|
"disable_password_reset": true,
|
33
33
|
"domain": "my-custom-domain.com",
|
34
34
|
"email": "john.doe@files.com",
|
35
|
+
"reply_to_email": "jane.doe@files.com",
|
35
36
|
"non_sso_groups_allowed": true,
|
36
37
|
"non_sso_users_allowed": true,
|
37
38
|
"folder_permissions_groups_only": true,
|
@@ -145,6 +146,7 @@
|
|
145
146
|
* `disable_password_reset` (boolean): Is password reset disabled?
|
146
147
|
* `domain` (string): Custom domain
|
147
148
|
* `email` (email): Main email for this site
|
149
|
+
* `reply_to_email` (email): Reply-to email for this site
|
148
150
|
* `non_sso_groups_allowed` (boolean): If true, groups can be manually created / modified / deleted by Site Admins. Otherwise, groups can only be managed via your SSO provider.
|
149
151
|
* `non_sso_users_allowed` (boolean): If true, users can be manually created / modified / deleted by Site Admins. Otherwise, users can only be managed via your SSO provider.
|
150
152
|
* `folder_permissions_groups_only` (boolean): If true, permissions for this site must be bound to a group (not a user). Otherwise, permissions must be bound to a user.
|
@@ -273,6 +275,7 @@ Files::Site.update(
|
|
273
275
|
subdomain: "mysite",
|
274
276
|
domain: "my-custom-domain.com",
|
275
277
|
email: "john.doe@files.com",
|
278
|
+
reply_to_email: "jane.doe@files.com",
|
276
279
|
allow_bundle_names: true,
|
277
280
|
bundle_expiration: 1,
|
278
281
|
overage_notify: true,
|
@@ -364,6 +367,7 @@ Files::Site.update(
|
|
364
367
|
* `subdomain` (string): Site subdomain
|
365
368
|
* `domain` (string): Custom domain
|
366
369
|
* `email` (string): Main email for this site
|
370
|
+
* `reply_to_email` (string): Reply-to email for this site
|
367
371
|
* `allow_bundle_names` (boolean): Are manual Bundle names allowed?
|
368
372
|
* `bundle_expiration` (int64): Site-wide Bundle expiration in days
|
369
373
|
* `overage_notify` (boolean): Notify site email of overages?
|
data/docs/sso_strategy.md
CHANGED
@@ -34,6 +34,7 @@
|
|
34
34
|
"provision_ftp_permission": true,
|
35
35
|
"provision_sftp_permission": true,
|
36
36
|
"provision_time_zone": "Eastern Time (US & Canada)",
|
37
|
+
"provision_company": "ACME Corp.",
|
37
38
|
"ldap_base_dn": "",
|
38
39
|
"ldap_domain": "mysite.com",
|
39
40
|
"enabled": true,
|
@@ -75,6 +76,7 @@
|
|
75
76
|
* `provision_ftp_permission` (boolean): Auto-provisioned users get FTP permission?
|
76
77
|
* `provision_sftp_permission` (boolean): Auto-provisioned users get SFTP permission?
|
77
78
|
* `provision_time_zone` (string): Default time zone for auto provisioned users.
|
79
|
+
* `provision_company` (string): Default company for auto provisioned users.
|
78
80
|
* `ldap_base_dn` (string): Base DN for looking up users in LDAP server
|
79
81
|
* `ldap_domain` (string): Domain name that will be appended to LDAP usernames
|
80
82
|
* `enabled` (boolean): Is strategy enabled?
|
data/docs/user.md
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
"last_protocol_cipher": "",
|
31
31
|
"lockout_expires": "2000-01-01T01:00:00Z",
|
32
32
|
"name": "John Doe",
|
33
|
+
"company": "ACME Corp.",
|
33
34
|
"notes": "Internal notes on this user.",
|
34
35
|
"notification_daily_send_time": 18,
|
35
36
|
"office_integration_enabled": true,
|
@@ -38,6 +39,7 @@
|
|
38
39
|
"public_keys_count": 1,
|
39
40
|
"receive_admin_alerts": true,
|
40
41
|
"require_2fa": true,
|
42
|
+
"active_2fa": true,
|
41
43
|
"require_password_change": true,
|
42
44
|
"restapi_permission": true,
|
43
45
|
"self_managed": true,
|
@@ -78,6 +80,7 @@
|
|
78
80
|
* `last_protocol_cipher` (string): The last protocol and cipher used
|
79
81
|
* `lockout_expires` (date-time): Time in the future that the user will no longer be locked out if applicable
|
80
82
|
* `name` (string): User's full name
|
83
|
+
* `company` (string): User's company
|
81
84
|
* `notes` (string): Any internal notes on the user
|
82
85
|
* `notification_daily_send_time` (int64): Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
|
83
86
|
* `office_integration_enabled` (boolean): Enable integration with Office for the web?
|
@@ -86,6 +89,7 @@
|
|
86
89
|
* `public_keys_count` (int64): Number of public keys associated with this user
|
87
90
|
* `receive_admin_alerts` (boolean): Should the user receive admin alerts such a certificate expiration notifications and overages?
|
88
91
|
* `require_2fa` (boolean): Is 2fa required to sign in?
|
92
|
+
* `active_2fa` (boolean): Is 2fa required to sign in?
|
89
93
|
* `require_password_change` (boolean): Is a password change required upon next user login?
|
90
94
|
* `restapi_permission` (boolean): Can this user access the REST API?
|
91
95
|
* `self_managed` (boolean): Does this user manage it's own credentials or is it a shared/bot user?
|
@@ -127,13 +131,13 @@ Files::User.list(
|
|
127
131
|
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
128
132
|
* `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
129
133
|
* `cursor` (string): Send cursor 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.
|
130
|
-
* `sort_by` (object): If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `active`, `master_admin`, `site_id`, `authenticate_until`, `email`, `last_desktop_login_at`, `last_login_at`, `username`, `notes`, `site_admin`, `receive_admin_alerts`, `allowed_ips`, `password_validity_days`, `ssl_required` or `not_site_admin`.
|
131
|
-
* `filter` (object): If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
132
|
-
* `filter_gt` (object): If set, return records where the specifiied field is greater than the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
133
|
-
* `filter_gteq` (object): If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
134
|
-
* `filter_like` (object): If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
135
|
-
* `filter_lt` (object): If set, return records where the specifiied field is less than the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
136
|
-
* `filter_lteq` (object): If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
134
|
+
* `sort_by` (object): If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `active`, `master_admin`, `site_id`, `authenticate_until`, `email`, `last_desktop_login_at`, `last_login_at`, `username`, `company`, `name`, `notes`, `site_admin`, `receive_admin_alerts`, `allowed_ips`, `password_validity_days`, `ssl_required` or `not_site_admin`.
|
135
|
+
* `filter` (object): If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
136
|
+
* `filter_gt` (object): If set, return records where the specifiied field is greater than the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
137
|
+
* `filter_gteq` (object): If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
138
|
+
* `filter_like` (object): If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
139
|
+
* `filter_lt` (object): If set, return records where the specifiied field is less than the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
140
|
+
* `filter_lteq` (object): If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
137
141
|
* `ids` (string): comma-separated list of User IDs
|
138
142
|
* `q[username]` (string): List users matching username.
|
139
143
|
* `q[email]` (string): List users matching email.
|
@@ -182,6 +186,7 @@ Files::User.create(
|
|
182
186
|
language: "en",
|
183
187
|
notification_daily_send_time: 18,
|
184
188
|
name: "John Doe",
|
189
|
+
company: "ACME Corp.",
|
185
190
|
notes: "Internal notes on this user.",
|
186
191
|
office_integration_enabled: true,
|
187
192
|
password_validity_days: 1,
|
@@ -227,6 +232,7 @@ Files::User.create(
|
|
227
232
|
* `language` (string): Preferred language
|
228
233
|
* `notification_daily_send_time` (int64): Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
|
229
234
|
* `name` (string): User's full name
|
235
|
+
* `company` (string): User's company
|
230
236
|
* `notes` (string): Any internal notes on the user
|
231
237
|
* `office_integration_enabled` (boolean): Enable integration with Office for the web?
|
232
238
|
* `password_validity_days` (int64): Number of days to allow user to use the same password
|
@@ -308,6 +314,7 @@ Files::User.update(id,
|
|
308
314
|
language: "en",
|
309
315
|
notification_daily_send_time: 18,
|
310
316
|
name: "John Doe",
|
317
|
+
company: "ACME Corp.",
|
311
318
|
notes: "Internal notes on this user.",
|
312
319
|
office_integration_enabled: true,
|
313
320
|
password_validity_days: 1,
|
@@ -354,6 +361,7 @@ Files::User.update(id,
|
|
354
361
|
* `language` (string): Preferred language
|
355
362
|
* `notification_daily_send_time` (int64): Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
|
356
363
|
* `name` (string): User's full name
|
364
|
+
* `company` (string): User's company
|
357
365
|
* `notes` (string): Any internal notes on the user
|
358
366
|
* `office_integration_enabled` (boolean): Enable integration with Office for the web?
|
359
367
|
* `password_validity_days` (int64): Number of days to allow user to use the same password
|
@@ -456,6 +464,7 @@ user.update(
|
|
456
464
|
language: "en",
|
457
465
|
notification_daily_send_time: 18,
|
458
466
|
name: "John Doe",
|
467
|
+
company: "ACME Corp.",
|
459
468
|
notes: "Internal notes on this user.",
|
460
469
|
office_integration_enabled: true,
|
461
470
|
password_validity_days: 1,
|
@@ -502,6 +511,7 @@ user.update(
|
|
502
511
|
* `language` (string): Preferred language
|
503
512
|
* `notification_daily_send_time` (int64): Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
|
504
513
|
* `name` (string): User's full name
|
514
|
+
* `company` (string): User's company
|
505
515
|
* `notes` (string): Any internal notes on the user
|
506
516
|
* `office_integration_enabled` (boolean): Enable integration with Office for the web?
|
507
517
|
* `password_validity_days` (int64): Number of days to allow user to use the same password
|
data/lib/files.com.rb
CHANGED
@@ -25,6 +25,7 @@ require "files.com/response"
|
|
25
25
|
require "files.com/system_profiler"
|
26
26
|
require "files.com/util"
|
27
27
|
require "files.com/list"
|
28
|
+
require "files.com/uri"
|
28
29
|
|
29
30
|
require "files.com/models/account_line_item"
|
30
31
|
require "files.com/models/action"
|
@@ -46,7 +47,7 @@ require "files.com/models/file"
|
|
46
47
|
require "files.com/models/file_action"
|
47
48
|
require "files.com/models/file_comment"
|
48
49
|
require "files.com/models/file_comment_reaction"
|
49
|
-
require "files.com/models/
|
50
|
+
require "files.com/models/file_upload_part"
|
50
51
|
require "files.com/models/folder"
|
51
52
|
require "files.com/models/group"
|
52
53
|
require "files.com/models/group_user"
|
data/lib/files.com/api_client.rb
CHANGED
@@ -172,9 +172,10 @@ module Files
|
|
172
172
|
private def api_url(url = "", base_url = nil)
|
173
173
|
uri = Addressable::URI.new
|
174
174
|
uri.host = Addressable::URI.parse(base_url).host
|
175
|
-
uri.path = "/api/rest/v1" + url
|
175
|
+
uri.path = "/api/rest/v1" + Files::URI.normalized_path(url)
|
176
176
|
uri.scheme = Addressable::URI.parse(base_url).scheme
|
177
|
-
|
177
|
+
|
178
|
+
uri.to_s
|
178
179
|
end
|
179
180
|
|
180
181
|
private def check_api_key!(api_key)
|
@@ -257,7 +257,7 @@ module Files
|
|
257
257
|
# Parameters:
|
258
258
|
# format - string
|
259
259
|
# api_key - object
|
260
|
-
def self.
|
260
|
+
def self.current(params = {}, options = {})
|
261
261
|
raise InvalidParameterError.new("Bad parameter: format must be an String") if params.dig(:format) and !params.dig(:format).is_a?(String)
|
262
262
|
raise InvalidParameterError.new("Bad parameter: api_key must be an Hash") if params.dig(:api_key) and !params.dig(:api_key).is_a?(Hash)
|
263
263
|
|
@@ -149,6 +149,15 @@ module Files
|
|
149
149
|
@attributes[:inbox_id] = value
|
150
150
|
end
|
151
151
|
|
152
|
+
# boolean - Does this bundle have an associated inbox?
|
153
|
+
def has_inbox
|
154
|
+
@attributes[:has_inbox]
|
155
|
+
end
|
156
|
+
|
157
|
+
def has_inbox=(value)
|
158
|
+
@attributes[:has_inbox] = value
|
159
|
+
end
|
160
|
+
|
152
161
|
# array - A list of paths in this bundle
|
153
162
|
def paths
|
154
163
|
@attributes[:paths]
|
@@ -119,7 +119,7 @@ module Files
|
|
119
119
|
|
120
120
|
response, options = Api.send_request("/file_actions/begin_upload/#{params[:path]}", :post, params, options)
|
121
121
|
response.data.map do |entity_data|
|
122
|
-
|
122
|
+
FileUploadPart.new(entity_data, options)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Files
|
4
|
-
class
|
4
|
+
class FileUploadPart
|
5
5
|
attr_reader :options, :attributes
|
6
6
|
|
7
7
|
def initialize(attributes = {}, options = {})
|
@@ -19,57 +19,57 @@ module Files
|
|
19
19
|
@attributes[:action]
|
20
20
|
end
|
21
21
|
|
22
|
-
# boolean - If
|
22
|
+
# boolean - If `true`, this file exists and you may wish to ask the user for overwrite confirmation
|
23
23
|
def ask_about_overwrites
|
24
24
|
@attributes[:ask_about_overwrites]
|
25
25
|
end
|
26
26
|
|
27
|
-
# int64 -
|
27
|
+
# int64 - Number of parts in the upload
|
28
28
|
def available_parts
|
29
29
|
@attributes[:available_parts]
|
30
30
|
end
|
31
31
|
|
32
|
-
# string -
|
32
|
+
# string - Date/time of when this Upload part expires and the URL cannot be used any more
|
33
33
|
def expires
|
34
34
|
@attributes[:expires]
|
35
35
|
end
|
36
36
|
|
37
|
-
# object - Additional upload headers
|
37
|
+
# object - Additional upload headers to provide as part of the upload
|
38
38
|
def headers
|
39
39
|
@attributes[:headers]
|
40
40
|
end
|
41
41
|
|
42
|
-
# string -
|
42
|
+
# string - HTTP Method to use for uploading the part, usually `PUT`
|
43
43
|
def http_method
|
44
44
|
@attributes[:http_method]
|
45
45
|
end
|
46
46
|
|
47
|
-
# int64 -
|
47
|
+
# int64 - Size in bytes for this part
|
48
48
|
def next_partsize
|
49
49
|
@attributes[:next_partsize]
|
50
50
|
end
|
51
51
|
|
52
|
-
# boolean - If true
|
52
|
+
# boolean - If `true`, multiple parts may be uploaded in parallel. If `false`, be sure to only upload one part at a time, in order.
|
53
53
|
def parallel_parts
|
54
54
|
@attributes[:parallel_parts]
|
55
55
|
end
|
56
56
|
|
57
|
-
# object - Additional
|
57
|
+
# object - Additional HTTP parameters to send with the upload
|
58
58
|
def parameters
|
59
59
|
@attributes[:parameters]
|
60
60
|
end
|
61
61
|
|
62
|
-
# int64 -
|
62
|
+
# int64 - Number of this upload part
|
63
63
|
def part_number
|
64
64
|
@attributes[:part_number]
|
65
65
|
end
|
66
66
|
|
67
|
-
# int64 -
|
67
|
+
# int64 - Size in bytes for the next upload part
|
68
68
|
def partsize
|
69
69
|
@attributes[:partsize]
|
70
70
|
end
|
71
71
|
|
72
|
-
# string -
|
72
|
+
# string - New file path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
73
73
|
def path
|
74
74
|
@attributes[:path]
|
75
75
|
end
|
@@ -36,7 +36,7 @@ module Files
|
|
36
36
|
@attributes[:end_at] = value
|
37
37
|
end
|
38
38
|
|
39
|
-
# string - Status of export. Will be: `building` or `
|
39
|
+
# string - Status of export. Will be: `building`, `ready`, or `failed`
|
40
40
|
def status
|
41
41
|
@attributes[:status]
|
42
42
|
end
|
@@ -54,7 +54,7 @@ module Files
|
|
54
54
|
@attributes[:query_action] = value
|
55
55
|
end
|
56
56
|
|
57
|
-
# string - Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
|
57
|
+
# string - Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`
|
58
58
|
def query_interface
|
59
59
|
@attributes[:query_interface]
|
60
60
|
end
|
@@ -264,7 +264,7 @@ module Files
|
|
264
264
|
# start_at - string - Start date/time of export range.
|
265
265
|
# end_at - string - End date/time of export range.
|
266
266
|
# query_action - string - Filter results by this this action type. Valid values: `create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_update`, `user_destroy`, `group_create`, `group_update`, `group_destroy`, `permission_create`, `permission_destroy`, `api_key_create`, `api_key_update`, `api_key_destroy`
|
267
|
-
# query_interface - string - Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
|
267
|
+
# query_interface - string - Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`
|
268
268
|
# query_user_id - string - Return results that are actions performed by the user indiciated by this User ID
|
269
269
|
# query_file_id - string - Return results that are file actions related to the file indicated by this File ID
|
270
270
|
# query_parent_id - string - Return results that are file actions inside the parent folder specified by this folder ID
|
@@ -74,7 +74,7 @@ module Files
|
|
74
74
|
@attributes[:failure_type]
|
75
75
|
end
|
76
76
|
|
77
|
-
# string - Inteface through which the action was taken. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
|
77
|
+
# string - Inteface through which the action was taken. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`
|
78
78
|
def interface
|
79
79
|
@attributes[:interface]
|
80
80
|
end
|
@@ -149,6 +149,11 @@ module Files
|
|
149
149
|
@attributes[:email]
|
150
150
|
end
|
151
151
|
|
152
|
+
# email - Reply-to email for this site
|
153
|
+
def reply_to_email
|
154
|
+
@attributes[:reply_to_email]
|
155
|
+
end
|
156
|
+
|
152
157
|
# boolean - If true, groups can be manually created / modified / deleted by Site Admins. Otherwise, groups can only be managed via your SSO provider.
|
153
158
|
def non_sso_groups_allowed
|
154
159
|
@attributes[:non_sso_groups_allowed]
|
@@ -586,6 +591,7 @@ module Files
|
|
586
591
|
# subdomain - string - Site subdomain
|
587
592
|
# domain - string - Custom domain
|
588
593
|
# email - string - Main email for this site
|
594
|
+
# reply_to_email - string - Reply-to email for this site
|
589
595
|
# allow_bundle_names - boolean - Are manual Bundle names allowed?
|
590
596
|
# bundle_expiration - int64 - Site-wide Bundle expiration in days
|
591
597
|
# overage_notify - boolean - Notify site email of overages?
|
@@ -689,6 +695,7 @@ module Files
|
|
689
695
|
raise InvalidParameterError.new("Bad parameter: subdomain must be an String") if params.dig(:subdomain) and !params.dig(:subdomain).is_a?(String)
|
690
696
|
raise InvalidParameterError.new("Bad parameter: domain must be an String") if params.dig(:domain) and !params.dig(:domain).is_a?(String)
|
691
697
|
raise InvalidParameterError.new("Bad parameter: email must be an String") if params.dig(:email) and !params.dig(:email).is_a?(String)
|
698
|
+
raise InvalidParameterError.new("Bad parameter: reply_to_email must be an String") if params.dig(:reply_to_email) and !params.dig(:reply_to_email).is_a?(String)
|
692
699
|
raise InvalidParameterError.new("Bad parameter: bundle_expiration must be an Integer") if params.dig(:bundle_expiration) and !params.dig(:bundle_expiration).is_a?(Integer)
|
693
700
|
raise InvalidParameterError.new("Bad parameter: welcome_email_cc must be an String") if params.dig(:welcome_email_cc) and !params.dig(:welcome_email_cc).is_a?(String)
|
694
701
|
raise InvalidParameterError.new("Bad parameter: welcome_custom_text must be an String") if params.dig(:welcome_custom_text) and !params.dig(:welcome_custom_text).is_a?(String)
|
@@ -149,6 +149,11 @@ module Files
|
|
149
149
|
@attributes[:provision_time_zone]
|
150
150
|
end
|
151
151
|
|
152
|
+
# string - Default company for auto provisioned users.
|
153
|
+
def provision_company
|
154
|
+
@attributes[:provision_company]
|
155
|
+
end
|
156
|
+
|
152
157
|
# string - Base DN for looking up users in LDAP server
|
153
158
|
def ldap_base_dn
|
154
159
|
@attributes[:ldap_base_dn]
|
@@ -221,6 +221,15 @@ module Files
|
|
221
221
|
@attributes[:name] = value
|
222
222
|
end
|
223
223
|
|
224
|
+
# string - User's company
|
225
|
+
def company
|
226
|
+
@attributes[:company]
|
227
|
+
end
|
228
|
+
|
229
|
+
def company=(value)
|
230
|
+
@attributes[:company] = value
|
231
|
+
end
|
232
|
+
|
224
233
|
# string - Any internal notes on the user
|
225
234
|
def notes
|
226
235
|
@attributes[:notes]
|
@@ -293,6 +302,15 @@ module Files
|
|
293
302
|
@attributes[:require_2fa] = value
|
294
303
|
end
|
295
304
|
|
305
|
+
# boolean - Is 2fa required to sign in?
|
306
|
+
def active_2fa
|
307
|
+
@attributes[:active_2fa]
|
308
|
+
end
|
309
|
+
|
310
|
+
def active_2fa=(value)
|
311
|
+
@attributes[:active_2fa] = value
|
312
|
+
end
|
313
|
+
|
296
314
|
# boolean - Is a password change required upon next user login?
|
297
315
|
def require_password_change
|
298
316
|
@attributes[:require_password_change]
|
@@ -550,6 +568,7 @@ module Files
|
|
550
568
|
# language - string - Preferred language
|
551
569
|
# notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
|
552
570
|
# name - string - User's full name
|
571
|
+
# company - string - User's company
|
553
572
|
# notes - string - Any internal notes on the user
|
554
573
|
# office_integration_enabled - boolean - Enable integration with Office for the web?
|
555
574
|
# password_validity_days - int64 - Number of days to allow user to use the same password
|
@@ -586,6 +605,7 @@ module Files
|
|
586
605
|
raise InvalidParameterError.new("Bad parameter: language must be an String") if params.dig(:language) and !params.dig(:language).is_a?(String)
|
587
606
|
raise InvalidParameterError.new("Bad parameter: notification_daily_send_time must be an Integer") if params.dig(:notification_daily_send_time) and !params.dig(:notification_daily_send_time).is_a?(Integer)
|
588
607
|
raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
|
608
|
+
raise InvalidParameterError.new("Bad parameter: company must be an String") if params.dig(:company) and !params.dig(:company).is_a?(String)
|
589
609
|
raise InvalidParameterError.new("Bad parameter: notes must be an String") if params.dig(:notes) and !params.dig(:notes).is_a?(String)
|
590
610
|
raise InvalidParameterError.new("Bad parameter: password_validity_days must be an Integer") if params.dig(:password_validity_days) and !params.dig(:password_validity_days).is_a?(Integer)
|
591
611
|
raise InvalidParameterError.new("Bad parameter: ssl_required must be an String") if params.dig(:ssl_required) and !params.dig(:ssl_required).is_a?(String)
|
@@ -626,13 +646,13 @@ module Files
|
|
626
646
|
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
627
647
|
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
628
648
|
# cursor - string - Send cursor 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.
|
629
|
-
# sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `active`, `master_admin`, `site_id`, `authenticate_until`, `email`, `last_desktop_login_at`, `last_login_at`, `username`, `notes`, `site_admin`, `receive_admin_alerts`, `allowed_ips`, `password_validity_days`, `ssl_required` or `not_site_admin`.
|
630
|
-
# filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
631
|
-
# filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
632
|
-
# filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
633
|
-
# filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
634
|
-
# filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
635
|
-
# filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
649
|
+
# sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `active`, `master_admin`, `site_id`, `authenticate_until`, `email`, `last_desktop_login_at`, `last_login_at`, `username`, `company`, `name`, `notes`, `site_admin`, `receive_admin_alerts`, `allowed_ips`, `password_validity_days`, `ssl_required` or `not_site_admin`.
|
650
|
+
# filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
651
|
+
# filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
652
|
+
# filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
653
|
+
# filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
654
|
+
# filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
655
|
+
# filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `username`, `email`, `company`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
|
636
656
|
# ids - string - comma-separated list of User IDs
|
637
657
|
# q[username] - string - List users matching username.
|
638
658
|
# q[email] - string - List users matching email.
|
@@ -708,6 +728,7 @@ module Files
|
|
708
728
|
# language - string - Preferred language
|
709
729
|
# notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
|
710
730
|
# name - string - User's full name
|
731
|
+
# company - string - User's company
|
711
732
|
# notes - string - Any internal notes on the user
|
712
733
|
# office_integration_enabled - boolean - Enable integration with Office for the web?
|
713
734
|
# password_validity_days - int64 - Number of days to allow user to use the same password
|
@@ -740,6 +761,7 @@ module Files
|
|
740
761
|
raise InvalidParameterError.new("Bad parameter: language must be an String") if params.dig(:language) and !params.dig(:language).is_a?(String)
|
741
762
|
raise InvalidParameterError.new("Bad parameter: notification_daily_send_time must be an Integer") if params.dig(:notification_daily_send_time) and !params.dig(:notification_daily_send_time).is_a?(Integer)
|
742
763
|
raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
|
764
|
+
raise InvalidParameterError.new("Bad parameter: company must be an String") if params.dig(:company) and !params.dig(:company).is_a?(String)
|
743
765
|
raise InvalidParameterError.new("Bad parameter: notes must be an String") if params.dig(:notes) and !params.dig(:notes).is_a?(String)
|
744
766
|
raise InvalidParameterError.new("Bad parameter: password_validity_days must be an Integer") if params.dig(:password_validity_days) and !params.dig(:password_validity_days).is_a?(Integer)
|
745
767
|
raise InvalidParameterError.new("Bad parameter: ssl_required must be an String") if params.dig(:ssl_required) and !params.dig(:ssl_required).is_a?(String)
|
@@ -811,6 +833,7 @@ module Files
|
|
811
833
|
# language - string - Preferred language
|
812
834
|
# notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
|
813
835
|
# name - string - User's full name
|
836
|
+
# company - string - User's company
|
814
837
|
# notes - string - Any internal notes on the user
|
815
838
|
# office_integration_enabled - boolean - Enable integration with Office for the web?
|
816
839
|
# password_validity_days - int64 - Number of days to allow user to use the same password
|
@@ -846,6 +869,7 @@ module Files
|
|
846
869
|
raise InvalidParameterError.new("Bad parameter: language must be an String") if params.dig(:language) and !params.dig(:language).is_a?(String)
|
847
870
|
raise InvalidParameterError.new("Bad parameter: notification_daily_send_time must be an Integer") if params.dig(:notification_daily_send_time) and !params.dig(:notification_daily_send_time).is_a?(Integer)
|
848
871
|
raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
|
872
|
+
raise InvalidParameterError.new("Bad parameter: company must be an String") if params.dig(:company) and !params.dig(:company).is_a?(String)
|
849
873
|
raise InvalidParameterError.new("Bad parameter: notes must be an String") if params.dig(:notes) and !params.dig(:notes).is_a?(String)
|
850
874
|
raise InvalidParameterError.new("Bad parameter: password_validity_days must be an Integer") if params.dig(:password_validity_days) and !params.dig(:password_validity_days).is_a?(Integer)
|
851
875
|
raise InvalidParameterError.new("Bad parameter: ssl_required must be an String") if params.dig(:ssl_required) and !params.dig(:ssl_required).is_a?(String)
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Files
|
2
|
+
module URI
|
3
|
+
# This is a copy of Addressable::URI.normalize_component without Addressable::IDNA.unicode_normalize_kc.
|
4
|
+
def self.normalize_component(component, character_class =
|
5
|
+
Addressable::URI::CharacterClasses::RESERVED + Addressable::URI::CharacterClasses::UNRESERVED,
|
6
|
+
leave_encoded = '')
|
7
|
+
return nil if component.nil?
|
8
|
+
|
9
|
+
unless component.is_a? String
|
10
|
+
begin
|
11
|
+
component = component.to_str
|
12
|
+
rescue NoMethodError, TypeError
|
13
|
+
raise TypeError, "Can't convert #{component.class} into String."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
unless [ String, Regexp ].include?(character_class.class)
|
18
|
+
raise TypeError,
|
19
|
+
"Expected String or Regexp, got #{character_class.inspect}"
|
20
|
+
end
|
21
|
+
if character_class.is_a?(String)
|
22
|
+
leave_re = unless leave_encoded.empty?
|
23
|
+
character_class = "#{character_class}%" unless character_class.include?('%')
|
24
|
+
|
25
|
+
"|%(?!#{leave_encoded.chars.map do |char|
|
26
|
+
seq = SEQUENCE_ENCODING_TABLE[char]
|
27
|
+
[ seq.upcase, seq.downcase ]
|
28
|
+
end.flatten.join('|')})"
|
29
|
+
end
|
30
|
+
|
31
|
+
character_class = /[^#{character_class}]#{leave_re}/
|
32
|
+
end
|
33
|
+
# We can't perform regexps on invalid UTF sequences, but
|
34
|
+
# here we need to, so switch to ASCII.
|
35
|
+
component = component.dup
|
36
|
+
component.force_encoding(Encoding::ASCII_8BIT)
|
37
|
+
unencoded = Addressable::URI.unencode_component(component, String, leave_encoded)
|
38
|
+
begin
|
39
|
+
encoded = Addressable::URI.encode_component(
|
40
|
+
# Addressable::IDNA.unicode_normalize_kc(unencoded),
|
41
|
+
unencoded,
|
42
|
+
character_class,
|
43
|
+
leave_encoded
|
44
|
+
)
|
45
|
+
rescue ArgumentError
|
46
|
+
encoded = encode_component(unencoded)
|
47
|
+
end
|
48
|
+
encoded.force_encoding(Encoding::UTF_8)
|
49
|
+
encoded
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.normalized_path(path)
|
53
|
+
if path =~ Addressable::URI::NORMPATH
|
54
|
+
# Relative paths with colons in the first segment are ambiguous.
|
55
|
+
path = path.sub(":", "%2F")
|
56
|
+
end
|
57
|
+
# String#split(delimeter, -1) uses the more strict splitting behavior
|
58
|
+
# found by default in Python.
|
59
|
+
result = path.strip.split(Addressable::URI::SLASH, -1).map do |segment|
|
60
|
+
normalize_component(
|
61
|
+
segment,
|
62
|
+
Addressable::URI::CharacterClasses::PCHAR
|
63
|
+
)
|
64
|
+
end.join(Addressable::URI::SLASH)
|
65
|
+
|
66
|
+
# All normalized values should be UTF-8
|
67
|
+
result.force_encoding(Encoding::UTF_8)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/spec/uri_spec.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Files::URI do
|
4
|
+
describe "normalized_path" do
|
5
|
+
it { expect(described_class.normalized_path("[[strange stuff]]#yes.text")).to eq("%5B%5Bstrange%20stuff%5D%5D%23yes.text") }
|
6
|
+
it { expect(Addressable::URI.unencode_component(described_class.normalized_path("[[strange stuff]]#yes.text"))).to eq("[[strange stuff]]#yes.text") }
|
7
|
+
|
8
|
+
it { expect(described_class.normalized_path("folder/AdÇe")).to eq("folder/AdC%CC%A7e") }
|
9
|
+
it { expect(Addressable::URI.unencode_component(described_class.normalized_path("AdÇe"))).to eq("AdÇe") }
|
10
|
+
end
|
11
|
+
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.114
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- files.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -105,7 +105,7 @@ files:
|
|
105
105
|
- docs/file_action.md
|
106
106
|
- docs/file_comment.md
|
107
107
|
- docs/file_comment_reaction.md
|
108
|
-
- docs/
|
108
|
+
- docs/file_upload_part.md
|
109
109
|
- docs/file_utils.md
|
110
110
|
- docs/folder.md
|
111
111
|
- docs/group.md
|
@@ -170,7 +170,7 @@ files:
|
|
170
170
|
- lib/files.com/models/file_action.rb
|
171
171
|
- lib/files.com/models/file_comment.rb
|
172
172
|
- lib/files.com/models/file_comment_reaction.rb
|
173
|
-
- lib/files.com/models/
|
173
|
+
- lib/files.com/models/file_upload_part.rb
|
174
174
|
- lib/files.com/models/file_utils.rb
|
175
175
|
- lib/files.com/models/folder.rb
|
176
176
|
- lib/files.com/models/group.rb
|
@@ -211,12 +211,14 @@ files:
|
|
211
211
|
- lib/files.com/response.rb
|
212
212
|
- lib/files.com/sizable_io.rb
|
213
213
|
- lib/files.com/system_profiler.rb
|
214
|
+
- lib/files.com/uri.rb
|
214
215
|
- lib/files.com/util.rb
|
215
216
|
- lib/files.com/version.rb
|
216
217
|
- spec/list_spec.rb
|
217
218
|
- spec/models/file_spec.rb
|
218
219
|
- spec/models/folder_spec.rb
|
219
220
|
- spec/spec_helper.rb
|
221
|
+
- spec/uri_spec.rb
|
220
222
|
- test.sh
|
221
223
|
- test/test.rb
|
222
224
|
homepage: https://www.files.com
|
data/docs/file_part_upload.md
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# FilePartUpload
|
2
|
-
|
3
|
-
## Example FilePartUpload Object
|
4
|
-
|
5
|
-
```
|
6
|
-
{
|
7
|
-
"send": "",
|
8
|
-
"action": "upload/direct",
|
9
|
-
"ask_about_overwrites": true,
|
10
|
-
"available_parts": 1,
|
11
|
-
"expires": "",
|
12
|
-
"headers": "",
|
13
|
-
"http_method": "POST",
|
14
|
-
"next_partsize": 1,
|
15
|
-
"parallel_parts": true,
|
16
|
-
"parameters": "{}",
|
17
|
-
"part_number": 1,
|
18
|
-
"partsize": 1,
|
19
|
-
"path": "",
|
20
|
-
"ref": "upload-1",
|
21
|
-
"upload_uri": ""
|
22
|
-
}
|
23
|
-
```
|
24
|
-
|
25
|
-
* `send` (object): Content-Type and File to send
|
26
|
-
* `action` (string): Type of upload
|
27
|
-
* `ask_about_overwrites` (boolean): If false, rename conflicting files instead of asking for overwrite confirmation
|
28
|
-
* `available_parts` (int64): Currently unused
|
29
|
-
* `expires` (string): Currently unused
|
30
|
-
* `headers` (object): Additional upload headers
|
31
|
-
* `http_method` (string): Upload method, usually POST
|
32
|
-
* `next_partsize` (int64): Currently unused
|
33
|
-
* `parallel_parts` (boolean): If true, parts may be uploaded in parallel
|
34
|
-
* `parameters` (object): Additional upload parameters
|
35
|
-
* `part_number` (int64): Currently unused
|
36
|
-
* `partsize` (int64): Currently unused
|
37
|
-
* `path` (string): Upload path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
38
|
-
* `ref` (string): Reference name for this upload part
|
39
|
-
* `upload_uri` (string): URI to upload this part to
|