files.com 1.0.106 → 1.0.111

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: 32131f5bd3bf8f5002f21ab2ad489b1ccf93bc1fcb7c42427ea5c18f83af9977
4
- data.tar.gz: 797cf35c63d959a478f124ff84d5f3cdef1d1c1a0d1098cc2d201cc8950ec1c8
3
+ metadata.gz: 225dfeba48af26960bc78d58fcc6582130528647e1f4f8cbe46883f79a24cc78
4
+ data.tar.gz: e432cdc6416e3ff8f24911833c33f244dc6d3c030db9a1ea1d517ab4e7038098
5
5
  SHA512:
6
- metadata.gz: 0b0ec308bc1cfd10683b7fd92796eb4bc686de078b364dcb819f2531b9850b120a2721da2e49e97949b424c2648b131f83195358e404ff98bb814594193bca4f
7
- data.tar.gz: 4c57b09e30babaeeada3e8d08f9904dbcf17b4fe22ed9be57285e8f7cde9d2142e551b61c87f9feb955269c144989eac1d16660919ea95b47dacbba639f681ff
6
+ metadata.gz: ca79ab1f63905d8a1d91ebf3a4c620ec0d1f10024b6786162e6735266a1dc2c548bde72461f7ec2e653dd5bab918505b3b6bd99ed887c3152ae76d252fc55919
7
+ data.tar.gz: 067e4d6f28a7ecfdd71b327e026a6414988384639af8546dcc8dd0a52da280be8ded9af59b6146d99f43c3d6bd6a9ae832c4eef7af344bfb3cddeeedc6971c89
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.106
1
+ 1.0.111
@@ -9,6 +9,7 @@
9
9
  "documentation_links": "Important Info => http://files.test/learn-more",
10
10
  "icon_url": "",
11
11
  "logo_url": "",
12
+ "screenshot_list_urls": "",
12
13
  "logo_thumbnail_url": "",
13
14
  "sso_strategy_type": "",
14
15
  "remote_server_type": "",
@@ -24,6 +25,7 @@
24
25
  * `documentation_links` (string): Collection of named links to documentation
25
26
  * `icon_url` (string): App icon
26
27
  * `logo_url` (string): Full size logo for the App
28
+ * `screenshot_list_urls` (string): Screenshots of the App
27
29
  * `logo_thumbnail_url` (string): Logo thumbnail for the App
28
30
  * `sso_strategy_type` (string): Associated SSO Strategy type, if any
29
31
  * `remote_server_type` (string): Associated Remote Server type, if any
@@ -7,7 +7,6 @@ may places where a Ruby File object can be used.
7
7
 
8
8
  ```
9
9
  {
10
- "id": 1,
11
10
  "path": "path/file.txt",
12
11
  "display_name": "file.txt",
13
12
  "type": "file",
@@ -27,7 +26,6 @@ may places where a Ruby File object can be used.
27
26
  }
28
27
  ```
29
28
 
30
- * `id` (int64): File/Folder ID
31
29
  * `path` (string): File/Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
32
30
  * `display_name` (string): File/Folder display name
33
31
  * `type` (string): Type: `directory` or `file`.
@@ -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
@@ -9,7 +9,6 @@ Files::Dir is an alias of Files::Folder
9
9
 
10
10
  ```
11
11
  {
12
- "id": 1,
13
12
  "path": "path/file.txt",
14
13
  "display_name": "file.txt",
15
14
  "type": "file",
@@ -29,7 +28,6 @@ Files::Dir is an alias of Files::Folder
29
28
  }
30
29
  ```
31
30
 
32
- * `id` (int64): File/Folder ID
33
31
  * `path` (string): File/Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
34
32
  * `display_name` (string): File/Folder display name
35
33
  * `type` (string): Type: `directory` or `file`.
@@ -13,6 +13,7 @@
13
13
  "id": 1,
14
14
  "saml_provider_cert_fingerprint": "",
15
15
  "saml_provider_issuer_url": "",
16
+ "saml_provider_metadata_content": "",
16
17
  "saml_provider_metadata_url": "",
17
18
  "saml_provider_slo_target_url": "",
18
19
  "saml_provider_sso_target_url": "",
@@ -53,6 +54,7 @@
53
54
  * `id` (int64): ID
54
55
  * `saml_provider_cert_fingerprint` (string): Identity provider sha256 cert fingerprint if saml_provider_metadata_url is not available.
55
56
  * `saml_provider_issuer_url` (string): Identity provider issuer url
57
+ * `saml_provider_metadata_content` (string): Custom identity provider metadata
56
58
  * `saml_provider_metadata_url` (string): Metadata URL for the SAML identity provider
57
59
  * `saml_provider_slo_target_url` (string): Identity provider SLO endpoint
58
60
  * `saml_provider_sso_target_url` (string): Identity provider SSO endpoint if saml_provider_metadata_url is not available.
@@ -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/file_part_upload"
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"
@@ -170,7 +170,12 @@ module Files
170
170
  end
171
171
 
172
172
  private def api_url(url = "", base_url = nil)
173
- Addressable::URI.parse((base_url || Files.base_url) + "/api/rest/v1" + url).normalize!.to_s
173
+ uri = Addressable::URI.new
174
+ uri.host = Addressable::URI.parse(base_url).host
175
+ uri.path = "/api/rest/v1" + Files::URI.normalized_path(url)
176
+ uri.scheme = Addressable::URI.parse(base_url).scheme
177
+
178
+ uri.to_s
174
179
  end
175
180
 
176
181
  private def check_api_key!(api_key)
@@ -34,6 +34,11 @@ module Files
34
34
  @attributes[:logo_url]
35
35
  end
36
36
 
37
+ # string - Screenshots of the App
38
+ def screenshot_list_urls
39
+ @attributes[:screenshot_list_urls]
40
+ end
41
+
37
42
  # string - Logo thumbnail for the App
38
43
  def logo_thumbnail_url
39
44
  @attributes[:logo_thumbnail_url]
@@ -588,15 +588,6 @@ module Files
588
588
  @write_io.write_nonblock *args
589
589
  end
590
590
 
591
- # int64 - File/Folder ID
592
- def id
593
- @attributes[:id]
594
- end
595
-
596
- def id=(value)
597
- @attributes[:id] = value
598
- end
599
-
600
591
  # string - File/Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
601
592
  def path
602
593
  @attributes[:path]
@@ -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
- FilePartUpload.new(entity_data, options)
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 FilePartUpload
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 false, rename conflicting files instead of asking for overwrite confirmation
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
- # string - Currently unused
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 - Currently unused
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 - Upload method, usually POST
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
- # string - Currently unused
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, parts may be uploaded in parallel
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
- # string - Additional upload parameters
57
+ # object - Additional HTTP parameters to send with the upload
58
58
  def parameters
59
59
  @attributes[:parameters]
60
60
  end
61
61
 
62
- # string - Currently unused
62
+ # int64 - Number of this upload part
63
63
  def part_number
64
64
  @attributes[:part_number]
65
65
  end
66
66
 
67
- # string - Currently unused
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 - Upload path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
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
@@ -150,15 +150,6 @@ module Files
150
150
  path
151
151
  end
152
152
 
153
- # int64 - File/Folder ID
154
- def id
155
- @attributes[:id]
156
- end
157
-
158
- def id=(value)
159
- @attributes[:id] = value
160
- end
161
-
162
153
  # string - File/Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
163
154
  def path
164
155
  @attributes[:path]
@@ -44,6 +44,11 @@ module Files
44
44
  @attributes[:saml_provider_issuer_url]
45
45
  end
46
46
 
47
+ # string - Custom identity provider metadata
48
+ def saml_provider_metadata_content
49
+ @attributes[:saml_provider_metadata_content]
50
+ end
51
+
47
52
  # string - Metadata URL for the SAML identity provider
48
53
  def saml_provider_metadata_url
49
54
  @attributes[:saml_provider_metadata_url]
@@ -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
@@ -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.106
4
+ version: 1.0.111
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-08-20 00:00:00.000000000 Z
11
+ date: 2020-09-04 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/file_part_upload.md
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/file_part_upload.rb
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
@@ -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": "",
11
- "expires": "",
12
- "headers": "",
13
- "http_method": "POST",
14
- "next_partsize": "",
15
- "parallel_parts": true,
16
- "parameters": "",
17
- "part_number": "",
18
- "partsize": "",
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` (string): Currently unused
29
- * `expires` (string): Currently unused
30
- * `headers` (object): Additional upload headers
31
- * `http_method` (string): Upload method, usually POST
32
- * `next_partsize` (string): Currently unused
33
- * `parallel_parts` (boolean): If true, parts may be uploaded in parallel
34
- * `parameters` (string): Additional upload parameters
35
- * `part_number` (string): Currently unused
36
- * `partsize` (string): 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