files.com 1.0.330 → 1.0.332
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/file_upload_part.md +2 -0
- data/docs/inbox_recipient.md +0 -5
- data/lib/files.com/models/file_upload_part.rb +5 -0
- data/lib/files.com/models/inbox_recipient.rb +0 -13
- data/lib/files.com/path_util.rb +52 -0
- data/lib/files.com.rb +1 -0
- data/shared/normalization_for_comparison_test_data.json +38 -0
- data/spec/path_util_spec.rb +14 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13ad2522a4dd40214766647a047e44ef3b82f26e45615d66e712b3f62cdeb24a
|
4
|
+
data.tar.gz: 47929ef18498cb61f94c30cf47404465937f772eeedd6d7fcb8339f43e7152e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9079993c64d759596c7c1881594e3df987df0cd428a66f569c3f6573a0b0425d33a7dfe9aa342a07b8ecc7aa942372555cd47f9eff3e137e2c781b8c03402e38
|
7
|
+
data.tar.gz: 0d6984671d22fc24708c47955218a33ba045f9e2968d8287e4b1b777c77c3d07b92c7b5a29614658ecb5b3f9fd493c221f54b64834eda98f4df9d4216842c5df
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.332
|
data/docs/file_upload_part.md
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
"http_method": "PUT",
|
18
18
|
"next_partsize": 1,
|
19
19
|
"parallel_parts": true,
|
20
|
+
"retry_parts": true,
|
20
21
|
"parameters": {
|
21
22
|
"key": "example value"
|
22
23
|
},
|
@@ -37,6 +38,7 @@
|
|
37
38
|
* `http_method` (string): HTTP Method to use for uploading the part, usually `PUT`
|
38
39
|
* `next_partsize` (int64): Size in bytes for this part
|
39
40
|
* `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.
|
41
|
+
* `retry_parts` (boolean): If `true`, parts may be retried. If `false`, a part cannot be retried and the upload should be restarted.
|
40
42
|
* `parameters` (object): Additional HTTP parameters to send with the upload
|
41
43
|
* `part_number` (int64): Number of this upload part
|
42
44
|
* `partsize` (int64): Size in bytes for the next upload part
|
data/docs/inbox_recipient.md
CHANGED
@@ -17,7 +17,6 @@
|
|
17
17
|
* `note` (string): A note sent to the recipient with the inbox.
|
18
18
|
* `recipient` (string): The recipient's email address.
|
19
19
|
* `sent_at` (date-time): When the Inbox was shared with this recipient.
|
20
|
-
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
21
20
|
* `inbox_id` (int64): Inbox to share.
|
22
21
|
* `share_after_create` (boolean): Set to true to share the link with the recipient upon creation.
|
23
22
|
|
@@ -28,7 +27,6 @@
|
|
28
27
|
|
29
28
|
```
|
30
29
|
Files::InboxRecipient.list(
|
31
|
-
user_id: 1,
|
32
30
|
per_page: 1,
|
33
31
|
inbox_id: 1
|
34
32
|
)
|
@@ -36,7 +34,6 @@ Files::InboxRecipient.list(
|
|
36
34
|
|
37
35
|
### Parameters
|
38
36
|
|
39
|
-
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
40
37
|
* `cursor` (string): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
41
38
|
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
42
39
|
* `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[has_registrations]=desc`). Valid fields are `has_registrations`.
|
@@ -50,7 +47,6 @@ Files::InboxRecipient.list(
|
|
50
47
|
|
51
48
|
```
|
52
49
|
Files::InboxRecipient.create(
|
53
|
-
user_id: 1,
|
54
50
|
inbox_id: 1,
|
55
51
|
recipient: "johndoe@gmail.com",
|
56
52
|
name: "John Smith",
|
@@ -62,7 +58,6 @@ Files::InboxRecipient.create(
|
|
62
58
|
|
63
59
|
### Parameters
|
64
60
|
|
65
|
-
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
66
61
|
* `inbox_id` (int64): Required - Inbox to share.
|
67
62
|
* `recipient` (string): Required - Email address to share this inbox with.
|
68
63
|
* `name` (string): Name of recipient.
|
@@ -54,6 +54,11 @@ module Files
|
|
54
54
|
@attributes[:parallel_parts]
|
55
55
|
end
|
56
56
|
|
57
|
+
# boolean - If `true`, parts may be retried. If `false`, a part cannot be retried and the upload should be restarted.
|
58
|
+
def retry_parts
|
59
|
+
@attributes[:retry_parts]
|
60
|
+
end
|
61
|
+
|
57
62
|
# object - Additional HTTP parameters to send with the upload
|
58
63
|
def parameters
|
59
64
|
@attributes[:parameters]
|
@@ -54,15 +54,6 @@ module Files
|
|
54
54
|
@attributes[:sent_at] = value
|
55
55
|
end
|
56
56
|
|
57
|
-
# int64 - User ID. Provide a value of `0` to operate the current session's user.
|
58
|
-
def user_id
|
59
|
-
@attributes[:user_id]
|
60
|
-
end
|
61
|
-
|
62
|
-
def user_id=(value)
|
63
|
-
@attributes[:user_id] = value
|
64
|
-
end
|
65
|
-
|
66
57
|
# int64 - Inbox to share.
|
67
58
|
def inbox_id
|
68
59
|
@attributes[:inbox_id]
|
@@ -91,14 +82,12 @@ module Files
|
|
91
82
|
end
|
92
83
|
|
93
84
|
# Parameters:
|
94
|
-
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
95
85
|
# cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
96
86
|
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
97
87
|
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[has_registrations]=desc`). Valid fields are `has_registrations`.
|
98
88
|
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `has_registrations`.
|
99
89
|
# inbox_id (required) - int64 - List recipients for the inbox with this ID.
|
100
90
|
def self.list(params = {}, options = {})
|
101
|
-
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
|
102
91
|
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
|
103
92
|
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
|
104
93
|
raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
|
@@ -116,7 +105,6 @@ module Files
|
|
116
105
|
end
|
117
106
|
|
118
107
|
# Parameters:
|
119
|
-
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
120
108
|
# inbox_id (required) - int64 - Inbox to share.
|
121
109
|
# recipient (required) - string - Email address to share this inbox with.
|
122
110
|
# name - string - Name of recipient.
|
@@ -124,7 +112,6 @@ module Files
|
|
124
112
|
# note - string - Note to include in email.
|
125
113
|
# share_after_create - boolean - Set to true to share the link with the recipient upon creation.
|
126
114
|
def self.create(params = {}, options = {})
|
127
|
-
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
|
128
115
|
raise InvalidParameterError.new("Bad parameter: inbox_id must be an Integer") if params[:inbox_id] and !params[:inbox_id].is_a?(Integer)
|
129
116
|
raise InvalidParameterError.new("Bad parameter: recipient must be an String") if params[:recipient] and !params[:recipient].is_a?(String)
|
130
117
|
raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
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same?(a, b)
|
12
|
+
normalize_for_comparison(a) == normalize_for_comparison(b)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.cleanpath(path)
|
16
|
+
new_path = Pathname.new(path).cleanpath.to_s
|
17
|
+
|
18
|
+
return "" if [ ".", ".." ].include? new_path
|
19
|
+
return new_path[1..] if new_path.index('/') == 0
|
20
|
+
|
21
|
+
new_path
|
22
|
+
end
|
23
|
+
|
24
|
+
private_class_method def self.normalize(*paths)
|
25
|
+
all_paths = paths.flatten.compact.map { |path| u8(path).gsub("\x00", "").gsub("\\", "/").split("/") }.flatten
|
26
|
+
all_paths.map { |path| cleanpath(path) }.reject(&:empty?).join("/")
|
27
|
+
end
|
28
|
+
|
29
|
+
private_class_method def self.u8(str)
|
30
|
+
new_string = begin
|
31
|
+
str.encode("UTF-8")
|
32
|
+
rescue Encoding::UndefinedConversionError
|
33
|
+
str.dup.force_encoding("UTF-8")
|
34
|
+
end
|
35
|
+
|
36
|
+
if new_string.valid_encoding?
|
37
|
+
new_string
|
38
|
+
else
|
39
|
+
new_string.force_encoding("ISO-8859-1").encode("UTF-8")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private_class_method def self.unicode_normalize_and_transliterate(string)
|
44
|
+
# convert multi-code-point characters into single-code-point characters
|
45
|
+
normalized_string = string.unicode_normalize(:nfkc)
|
46
|
+
|
47
|
+
normalized_string.gsub(/[^\x00-\x7f]/u) do |char|
|
48
|
+
TRANSLIT_MAP[char] || char
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/files.com.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
[
|
2
|
+
[ "filename.txt", "filename.txt" ],
|
3
|
+
[ "FiLeNaMe.TxT", "filename.txt" ],
|
4
|
+
[ "FILENAME.TXT", "filename.txt" ],
|
5
|
+
[ "FÎŁĘÑÂMÉ.TXT", "filename.txt" ],
|
6
|
+
[ "Fïłèńämê.Txt", "filename.txt" ],
|
7
|
+
[ "a/b/c.txt", "a/b/c.txt" ],
|
8
|
+
[ "A\\B\\C.TXT", "a/b/c.txt" ],
|
9
|
+
[ "A/B\\C.TXT", "a/b/c.txt" ],
|
10
|
+
[ "//a/b//c.txt", "a/b/c.txt" ],
|
11
|
+
[ "a/b/c.txt ", "a/b/c.txt" ],
|
12
|
+
[ "a/b/c.txt\t", "a/b/c.txt" ],
|
13
|
+
[ "a/b/c.txt\n", "a/b/c.txt" ],
|
14
|
+
[ "a/b/c.txt\r", "a/b/c.txt" ],
|
15
|
+
[ " space_at_beginning", " space_at_beginning"],
|
16
|
+
[ "space_at_end ", "space_at_end"],
|
17
|
+
[ "tab\tseperated", "tab\tseperated"],
|
18
|
+
[ "<title>hello</hello>", "<title>hello</hello>"],
|
19
|
+
[ "안녕하세요", "안녕하세요" ],
|
20
|
+
[ "こんにちは", "こんにちは" ],
|
21
|
+
[ "今日は", "今日は" ],
|
22
|
+
[ "longest_unicode_character_﷽", "longest_unicode_character_﷽"],
|
23
|
+
[ "invalid_null_byte_before\u0000after", "invalid_null_byte_beforeafter" ],
|
24
|
+
[ "a/b/c/../../hello", "a/b/c/hello" ],
|
25
|
+
[ "a/b/c/././hello", "a/b/c/hello" ],
|
26
|
+
[ "one_code_point_ą", "one_code_point_a" ],
|
27
|
+
[ "two_code_points_ą", "two_code_points_a" ],
|
28
|
+
[ "one_code_point_훯", "one_code_point_훯"],
|
29
|
+
[ "three_code_points_훯", "three_code_points_훯" ],
|
30
|
+
[ "ÞþŊŋŦŧ", "þþŋŋŧŧ" ],
|
31
|
+
[ "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ", "aaaaaaaeceeeeiiiidnoooooouuuuyssaaaaaaaeceeeeiiiidnoooooouuuuyy" ],
|
32
|
+
[ "ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİIJij", "aaaaaaccccccccddddeeeeeeeeeegggggggghhhhiiiiiiiiiijij" ],
|
33
|
+
[ "ĴĵĶķĹĺĻļĽľŁłŃńŅņŇňʼnŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤť", "jjkkllllllllnnnnnnʼnoooooooeoerrrrrrsssssssstttt" ],
|
34
|
+
[ "ŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽž", "uuuuuuuuuuuuwwyyyzzzzzz" ],
|
35
|
+
[ "😂❤️😍🤣😊🙏💕😭😘👍😅👏😁♥️🔥💔💖💙😢🤔😆🙄💪😉☺️👌🤗", "😂❤️😍🤣😊🙏💕😭😘👍😅👏😁♥️🔥💔💖💙😢🤔😆🙄💪😉☺️👌🤗" ],
|
36
|
+
[ "💜😔😎😇🌹🤦🎉💞✌️✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣️", "💜😔😎😇🌹🤦🎉💞✌️✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣️" ],
|
37
|
+
[ "emoji_‼️", "emoji_!!️" ]
|
38
|
+
]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
RSpec.describe Files::PathUtil do
|
5
|
+
json_str = File.read("shared/normalization_for_comparison_test_data.json")
|
6
|
+
test_cases = JSON.parse json_str
|
7
|
+
|
8
|
+
test_cases.each do |test_case_info|
|
9
|
+
src_chars, dst_chars = test_case_info
|
10
|
+
example "normalizes #{src_chars} to #{dst_chars}" do
|
11
|
+
expect(Files::PathUtil.same?(src_chars, dst_chars)).to eq(true)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
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.332
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- files.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -277,15 +277,18 @@ files:
|
|
277
277
|
- lib/files.com/models/user_cipher_use.rb
|
278
278
|
- lib/files.com/models/user_request.rb
|
279
279
|
- lib/files.com/models/webhook_test.rb
|
280
|
+
- lib/files.com/path_util.rb
|
280
281
|
- lib/files.com/response.rb
|
281
282
|
- lib/files.com/sizable_io.rb
|
282
283
|
- lib/files.com/system_profiler.rb
|
283
284
|
- lib/files.com/uri.rb
|
284
285
|
- lib/files.com/util.rb
|
285
286
|
- lib/files.com/version.rb
|
287
|
+
- shared/normalization_for_comparison_test_data.json
|
286
288
|
- spec/list_spec.rb
|
287
289
|
- spec/models/file_spec.rb
|
288
290
|
- spec/models/folder_spec.rb
|
291
|
+
- spec/path_util_spec.rb
|
289
292
|
- spec/spec_helper.rb
|
290
293
|
- spec/uri_spec.rb
|
291
294
|
- test.sh
|