files.com 1.0.66 → 1.0.71

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/_VERSION +1 -1
  3. data/docs/auto.md +1 -1
  4. data/docs/behavior.md +5 -1
  5. data/docs/group_user.md +9 -8
  6. data/docs/remote_server.md +32 -4
  7. data/docs/sso_strategy.md +4 -4
  8. data/docs/status.md +1 -1
  9. data/docs/user.md +2 -0
  10. data/files.com.gemspec +1 -0
  11. data/lib/files.com.rb +2 -0
  12. data/lib/files.com/api_client.rb +9 -3
  13. data/lib/files.com/models/api_key.rb +3 -0
  14. data/lib/files.com/models/as2_key.rb +3 -0
  15. data/lib/files.com/models/auto.rb +1 -1
  16. data/lib/files.com/models/automation.rb +3 -0
  17. data/lib/files.com/models/behavior.rb +10 -0
  18. data/lib/files.com/models/bundle.rb +3 -0
  19. data/lib/files.com/models/dns_record.rb +3 -0
  20. data/lib/files.com/models/file.rb +3 -2
  21. data/lib/files.com/models/file_action.rb +3 -1
  22. data/lib/files.com/models/file_comment.rb +3 -0
  23. data/lib/files.com/models/group.rb +3 -0
  24. data/lib/files.com/models/group_user.rb +27 -24
  25. data/lib/files.com/models/history.rb +15 -0
  26. data/lib/files.com/models/history_export.rb +3 -0
  27. data/lib/files.com/models/invoice.rb +3 -0
  28. data/lib/files.com/models/ip_address.rb +3 -0
  29. data/lib/files.com/models/lock.rb +3 -0
  30. data/lib/files.com/models/message.rb +3 -0
  31. data/lib/files.com/models/message_comment.rb +3 -0
  32. data/lib/files.com/models/message_comment_reaction.rb +3 -0
  33. data/lib/files.com/models/message_reaction.rb +3 -0
  34. data/lib/files.com/models/notification.rb +3 -0
  35. data/lib/files.com/models/payment.rb +3 -0
  36. data/lib/files.com/models/permission.rb +3 -0
  37. data/lib/files.com/models/project.rb +3 -0
  38. data/lib/files.com/models/public_key.rb +3 -0
  39. data/lib/files.com/models/remote_server.rb +63 -0
  40. data/lib/files.com/models/request.rb +6 -0
  41. data/lib/files.com/models/sso_strategy.rb +4 -6
  42. data/lib/files.com/models/status.rb +1 -0
  43. data/lib/files.com/models/usage_daily_snapshot.rb +3 -0
  44. data/lib/files.com/models/usage_snapshot.rb +3 -0
  45. data/lib/files.com/models/user.rb +5 -0
  46. data/lib/files.com/models/user_cipher_use.rb +3 -0
  47. data/lib/files.com/sizable_io.rb +32 -0
  48. data/spec/models/file_spec.rb +2 -1
  49. data/spec/spec_helper.rb +1 -0
  50. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e4a2bc035d0e4d4e0f653c54d0b5e78a6b10a2976ae0d002dd88ce76b55c414
4
- data.tar.gz: 3d8337b9ee382d61c0d63a279b25cccc72e785c52af0e99604e2171ce659eafa
3
+ metadata.gz: ba11ccb193f6c7ada9965b54d78719ccd41523a54c393d6ddd26dd7a95208d4d
4
+ data.tar.gz: 9ab54afdb9798cb42082ee5a8d4f832177146ef18521f101eef2f451dbbeb3e5
5
5
  SHA512:
6
- metadata.gz: 3035d31c71891d53be25324ac06d26d92ecced24ab73574cbb2b73786b3f25666d07a06d6589a1363daf289d87dea93c3f2dabfd05ac652d061050d18974da25
7
- data.tar.gz: d6fcd3f9394bf481cb94dfddbcc0c92a3e5cb68c6673632dff2a4557f1fe396206a563fba5b38ad53798d14479ec3453c6e9b84b17f205d8cbcc8ea60d01ae23
6
+ metadata.gz: eebe72236cb31ad47a3a54e91236f955d879d1645eb93ce705beb2af7dea5e43d35c5532e6f025257561f8607c4eb79faad37c4f09280969de942e2a32454af7
7
+ data.tar.gz: 72f30ebfafbeca587380f4b88722a108cf8f01b6be4549cd7f03201a8a986c054e8bfb08ed9a2f03ef0073f80d0590e943e33692b142d374e1b950f7594b6708
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.66
1
+ 1.0.71
@@ -8,4 +8,4 @@
8
8
  }
9
9
  ```
10
10
 
11
- * `dynamic` (object): Additional data
11
+ * `dynamic` (object):
@@ -105,7 +105,9 @@ Files::Behavior.create(
105
105
  Files::Behavior.webhook_test(
106
106
  url: "https://www.site.com/...",
107
107
  method: "GET",
108
- encoding: "RAW"
108
+ encoding: "RAW",
109
+ headers: "x-test-header => testvalue",
110
+ body: "test-param => testvalue"
109
111
  )
110
112
  ```
111
113
 
@@ -114,6 +116,8 @@ Files::Behavior.webhook_test(
114
116
  * `url` (string): Required - URL for testing the webhook.
115
117
  * `method` (string): HTTP method(GET or POST).
116
118
  * `encoding` (string): HTTP encoding method. Can be JSON, XML, or RAW (form data).
119
+ * `headers` (object): Additional request headers.
120
+ * `body` (object): Additional body parameters.
117
121
 
118
122
 
119
123
  ---
@@ -4,8 +4,9 @@
4
4
 
5
5
  ```
6
6
  {
7
- "name": "My Group",
8
- "id": 1,
7
+ "group_name": "My Group",
8
+ "group_id": 1,
9
+ "user_id": 1,
9
10
  "admin": true,
10
11
  "usernames": [
11
12
 
@@ -13,12 +14,12 @@
13
14
  }
14
15
  ```
15
16
 
16
- * `name` (string): Group name
17
- * `id` (int64): Group ID
17
+ * `group_name` (string): Group name
18
+ * `group_id` (int64): Group ID
19
+ * `user_id` (int64): User ID
18
20
  * `admin` (boolean): Is this user an administrator of this group?
19
21
  * `usernames` (array): A list of usernames for users in this group
20
- * `group_id` (int64): Group ID to add user to.
21
- * `user_id` (int64): User ID to add to group.
22
+ * `id` (int64): Group User ID.
22
23
 
23
24
 
24
25
  ---
@@ -36,11 +37,11 @@ Files::GroupUser.list(
36
37
 
37
38
  ### Parameters
38
39
 
39
- * `user_id` (int64): User ID. If provided, will return groups of which this user is a member.
40
+ * `user_id` (int64): User ID. If provided, will return group_users of this user.
40
41
  * `page` (int64): Current page number.
41
42
  * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
42
43
  * `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
43
- * `group_id` (int64): Group ID. If provided, will return members of this group.
44
+ * `group_id` (int64): Group ID. If provided, will return group_users of this group.
44
45
 
45
46
 
46
47
  ---
@@ -22,7 +22,10 @@
22
22
  "backblaze_b2_s3_endpoint": "s3.us-west-001.backblazeb2.com",
23
23
  "backblaze_b2_bucket": "my-bucket",
24
24
  "wasabi_bucket": "us-west-1",
25
- "wasabi_region": "my-bucket"
25
+ "wasabi_region": "my-bucket",
26
+ "rackspace_username": "rackspaceuser",
27
+ "rackspace_region": "dfw",
28
+ "rackspace_container": "my-container"
26
29
  }
27
30
  ```
28
31
 
@@ -45,6 +48,9 @@
45
48
  * `backblaze_b2_bucket` (string): Backblaze B2 Cloud Storage Bucket name
46
49
  * `wasabi_bucket` (string): Wasabi region
47
50
  * `wasabi_region` (string): Wasabi Bucket name
51
+ * `rackspace_username` (string): Rackspace username used to login to the Rackspace Cloud Control Panel.
52
+ * `rackspace_region` (string): Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
53
+ * `rackspace_container` (string): The name of the container (top level directory) where files will sync.
48
54
  * `aws_access_key` (string): AWS Access Key.
49
55
  * `aws_secret_key` (string): AWS secret key.
50
56
  * `password` (string): Password if needed.
@@ -54,6 +60,7 @@
54
60
  * `wasabi_secret_key` (string): Wasabi secret key.
55
61
  * `backblaze_b2_key_id` (string): Backblaze B2 Cloud Storage keyID.
56
62
  * `backblaze_b2_application_key` (string): Backblaze B2 Cloud Storage applicationKey.
63
+ * `rackspace_api_key` (string): Rackspace API key from the Rackspace Cloud Control Panel.
57
64
 
58
65
 
59
66
  ---
@@ -109,7 +116,10 @@ Files::RemoteServer.create(
109
116
  backblaze_b2_bucket: "my-bucket",
110
117
  backblaze_b2_s3_endpoint: "s3.us-west-001.backblazeb2.com",
111
118
  wasabi_bucket: "us-west-1",
112
- wasabi_region: "my-bucket"
119
+ wasabi_region: "my-bucket",
120
+ rackspace_username: "rackspaceuser",
121
+ rackspace_region: "dfw",
122
+ rackspace_container: "my-container"
113
123
  )
114
124
  ```
115
125
 
@@ -124,6 +134,7 @@ Files::RemoteServer.create(
124
134
  * `wasabi_secret_key` (string): Wasabi secret key.
125
135
  * `backblaze_b2_key_id` (string): Backblaze B2 Cloud Storage keyID.
126
136
  * `backblaze_b2_application_key` (string): Backblaze B2 Cloud Storage applicationKey.
137
+ * `rackspace_api_key` (string): Rackspace API key from the Rackspace Cloud Control Panel.
127
138
  * `hostname` (string): Hostname or IP address
128
139
  * `name` (string): Internal name for your reference
129
140
  * `max_connections` (int64): Max number of parallel connections. Ignored for S3 connections (we will parallelize these as much as possible).
@@ -141,6 +152,9 @@ Files::RemoteServer.create(
141
152
  * `backblaze_b2_s3_endpoint` (string): Backblaze B2 Cloud Storage S3 Endpoint
142
153
  * `wasabi_bucket` (string): Wasabi region
143
154
  * `wasabi_region` (string): Wasabi Bucket name
155
+ * `rackspace_username` (string): Rackspace username used to login to the Rackspace Cloud Control Panel.
156
+ * `rackspace_region` (string): Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
157
+ * `rackspace_container` (string): The name of the container (top level directory) where files will sync.
144
158
 
145
159
 
146
160
  ---
@@ -165,7 +179,10 @@ Files::RemoteServer.update(id,
165
179
  backblaze_b2_bucket: "my-bucket",
166
180
  backblaze_b2_s3_endpoint: "s3.us-west-001.backblazeb2.com",
167
181
  wasabi_bucket: "us-west-1",
168
- wasabi_region: "my-bucket"
182
+ wasabi_region: "my-bucket",
183
+ rackspace_username: "rackspaceuser",
184
+ rackspace_region: "dfw",
185
+ rackspace_container: "my-container"
169
186
  )
170
187
  ```
171
188
 
@@ -181,6 +198,7 @@ Files::RemoteServer.update(id,
181
198
  * `wasabi_secret_key` (string): Wasabi secret key.
182
199
  * `backblaze_b2_key_id` (string): Backblaze B2 Cloud Storage keyID.
183
200
  * `backblaze_b2_application_key` (string): Backblaze B2 Cloud Storage applicationKey.
201
+ * `rackspace_api_key` (string): Rackspace API key from the Rackspace Cloud Control Panel.
184
202
  * `hostname` (string): Hostname or IP address
185
203
  * `name` (string): Internal name for your reference
186
204
  * `max_connections` (int64): Max number of parallel connections. Ignored for S3 connections (we will parallelize these as much as possible).
@@ -198,6 +216,9 @@ Files::RemoteServer.update(id,
198
216
  * `backblaze_b2_s3_endpoint` (string): Backblaze B2 Cloud Storage S3 Endpoint
199
217
  * `wasabi_bucket` (string): Wasabi region
200
218
  * `wasabi_region` (string): Wasabi Bucket name
219
+ * `rackspace_username` (string): Rackspace username used to login to the Rackspace Cloud Control Panel.
220
+ * `rackspace_region` (string): Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
221
+ * `rackspace_container` (string): The name of the container (top level directory) where files will sync.
201
222
 
202
223
 
203
224
  ---
@@ -237,7 +258,10 @@ remote_server.update(
237
258
  backblaze_b2_bucket: "my-bucket",
238
259
  backblaze_b2_s3_endpoint: "s3.us-west-001.backblazeb2.com",
239
260
  wasabi_bucket: "us-west-1",
240
- wasabi_region: "my-bucket"
261
+ wasabi_region: "my-bucket",
262
+ rackspace_username: "rackspaceuser",
263
+ rackspace_region: "dfw",
264
+ rackspace_container: "my-container"
241
265
  )
242
266
  ```
243
267
 
@@ -253,6 +277,7 @@ remote_server.update(
253
277
  * `wasabi_secret_key` (string): Wasabi secret key.
254
278
  * `backblaze_b2_key_id` (string): Backblaze B2 Cloud Storage keyID.
255
279
  * `backblaze_b2_application_key` (string): Backblaze B2 Cloud Storage applicationKey.
280
+ * `rackspace_api_key` (string): Rackspace API key from the Rackspace Cloud Control Panel.
256
281
  * `hostname` (string): Hostname or IP address
257
282
  * `name` (string): Internal name for your reference
258
283
  * `max_connections` (int64): Max number of parallel connections. Ignored for S3 connections (we will parallelize these as much as possible).
@@ -270,6 +295,9 @@ remote_server.update(
270
295
  * `backblaze_b2_s3_endpoint` (string): Backblaze B2 Cloud Storage S3 Endpoint
271
296
  * `wasabi_bucket` (string): Wasabi region
272
297
  * `wasabi_region` (string): Wasabi Bucket name
298
+ * `rackspace_username` (string): Rackspace username used to login to the Rackspace Cloud Control Panel.
299
+ * `rackspace_region` (string): Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
300
+ * `rackspace_container` (string): The name of the container (top level directory) where files will sync.
273
301
 
274
302
 
275
303
  ---
@@ -4,7 +4,9 @@
4
4
 
5
5
  ```
6
6
  {
7
- "protocol": "okta",
7
+ "protocol": [
8
+
9
+ ],
8
10
  "provider": "okta",
9
11
  "label": "My Corporate SSO Provider",
10
12
  "logo_url": "https://mysite.files.com/.../logo.png",
@@ -38,13 +40,12 @@
38
40
  "ldap_host_3": "ldap3.site.com",
39
41
  "ldap_port": 1,
40
42
  "ldap_secure": true,
41
- "ldap_user_include_groups": "",
42
43
  "ldap_username": "[ldap username]",
43
44
  "ldap_username_field": "sAMAccountName"
44
45
  }
45
46
  ```
46
47
 
47
- * `protocol` (string): SSO Protocol
48
+ * `protocol` (array): SSO Protocol
48
49
  * `provider` (string): Provider name
49
50
  * `label` (string): Custom label for the SSO provider on the login page.
50
51
  * `logo_url` (string): URL holding a custom logo for the SSO provider on the login page.
@@ -78,7 +79,6 @@
78
79
  * `ldap_host_3` (string): LDAP backup host
79
80
  * `ldap_port` (int64): LDAP port
80
81
  * `ldap_secure` (boolean): Use secure LDAP?
81
- * `ldap_user_include_groups` (string): Comma or newline separated list of group names (with optional wildcards) - if provided, only users in these groups will be added or synced.
82
82
  * `ldap_username` (string): Username for signing in to LDAP server.
83
83
  * `ldap_username_field` (string): LDAP username field
84
84
 
@@ -17,5 +17,5 @@
17
17
  * `code` (int64): Status http code
18
18
  * `message` (string): Error message
19
19
  * `status` (string): Status message
20
- * `data`:
20
+ * `data`: Additional data
21
21
  * `errors` (array): A list of api errors
@@ -132,6 +132,8 @@ Files::User.list(
132
132
  * `q[password_validity_days]` (string): If set, list only users with overridden password validity days setting.
133
133
  * `q[ssl_required]` (string): If set, list only users with overridden SSL required setting.
134
134
  * `search` (string): Searches for partial matches of name, username, or email.
135
+ * `sort_by[last_login_at]` (string): If set, sort users by 'last_login_at' in either 'asc' or 'desc' direction
136
+ * `sort_by[authenticate_until]` (string): If set, sort users by 'authenticate_until' in either 'asc' or 'desc' direction
135
137
 
136
138
 
137
139
  ---
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.add_dependency 'faraday', ">= 1.0.1"
15
15
  s.add_dependency 'net-http-persistent'
16
16
  s.add_dependency 'addressable', ">= 2.7.0"
17
+ s.add_dependency 'concurrent-ruby', ">= 1.1.3"
17
18
 
18
19
  s.files = `find *`.split("\n").uniq.sort.reject(&:empty?)
19
20
  s.executables = [ "files", "files-console" ]
@@ -11,11 +11,13 @@ require "set"
11
11
  require "socket"
12
12
  require "uri"
13
13
  require "addressable/uri"
14
+ require "concurrent/promise"
14
15
 
15
16
  $LOAD_PATH.push __dir__
16
17
 
17
18
  require "files.com/version"
18
19
 
20
+ require "files.com/sizable_io"
19
21
  require "files.com/api"
20
22
  require "files.com/api_client"
21
23
  require "files.com/errors"
@@ -146,13 +146,19 @@ module Files
146
146
 
147
147
  def stream_download(uri, io)
148
148
  if conn.adapter == Faraday::Adapter::NetHttp
149
- remote_request(:get, uri) do |req|
150
- req.options.on_data = proc do |chunk, _overall_received_bytes|
151
- io.write(chunk.encode!)
149
+ uri = URI(uri)
150
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
151
+ request = Net::HTTP::Get.new uri
152
+ http.request request do |response|
153
+ io.fulfill_content_length(response.content_length) if io.respond_to?(:fulfill_content_length)
154
+ response.read_body do |chunk|
155
+ io << chunk.encode!
156
+ end
152
157
  end
153
158
  end
154
159
  else
155
160
  response = remote_request(:get, uri)
161
+ io.fulfill_content_length(response.content_length) if io.respond_to?(:fulfill_content_length)
156
162
  io.write(response.body)
157
163
  end
158
164
  end
@@ -147,6 +147,9 @@ module Files
147
147
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
148
148
 
149
149
  response, options = Api.send_request("/api_keys", :get, params, options)
150
+ response.data.map do |entity_data|
151
+ ApiKey.new(entity_data, options)
152
+ end
150
153
  end
151
154
 
152
155
  def self.all(params = {}, options = {})
@@ -108,6 +108,9 @@ module Files
108
108
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
109
109
 
110
110
  response, options = Api.send_request("/as2_keys", :get, params, options)
111
+ response.data.map do |entity_data|
112
+ As2Key.new(entity_data, options)
113
+ end
111
114
  end
112
115
 
113
116
  def self.all(params = {}, options = {})
@@ -9,7 +9,7 @@ module Files
9
9
  @options = options || {}
10
10
  end
11
11
 
12
- # object - Additional data
12
+ # object
13
13
  def dynamic
14
14
  @attributes[:dynamic]
15
15
  end
@@ -191,6 +191,9 @@ module Files
191
191
  raise InvalidParameterError.new("Bad parameter: automation must be an String") if params.dig(:automation) and !params.dig(:automation).is_a?(String)
192
192
 
193
193
  response, options = Api.send_request("/automations", :get, params, options)
194
+ response.data.map do |entity_data|
195
+ Automation.new(entity_data, options)
196
+ end
194
197
  end
195
198
 
196
199
  def self.all(params = {}, options = {})
@@ -112,6 +112,9 @@ module Files
112
112
  raise InvalidParameterError.new("Bad parameter: behavior must be an String") if params.dig(:behavior) and !params.dig(:behavior).is_a?(String)
113
113
 
114
114
  response, options = Api.send_request("/behaviors", :get, params, options)
115
+ response.data.map do |entity_data|
116
+ Behavior.new(entity_data, options)
117
+ end
115
118
  end
116
119
 
117
120
  def self.all(params = {}, options = {})
@@ -137,6 +140,9 @@ module Files
137
140
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
138
141
 
139
142
  response, options = Api.send_request("/behaviors/folders/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
143
+ response.data.map do |entity_data|
144
+ Behavior.new(entity_data, options)
145
+ end
140
146
  end
141
147
 
142
148
  # Parameters:
@@ -175,10 +181,14 @@ module Files
175
181
  # url (required) - string - URL for testing the webhook.
176
182
  # method - string - HTTP method(GET or POST).
177
183
  # encoding - string - HTTP encoding method. Can be JSON, XML, or RAW (form data).
184
+ # headers - object - Additional request headers.
185
+ # body - object - Additional body parameters.
178
186
  def self.webhook_test(params = {}, options = {})
179
187
  raise InvalidParameterError.new("Bad parameter: url must be an String") if params.dig(:url) and !params.dig(:url).is_a?(String)
180
188
  raise InvalidParameterError.new("Bad parameter: method must be an String") if params.dig(:method) and !params.dig(:method).is_a?(String)
181
189
  raise InvalidParameterError.new("Bad parameter: encoding must be an String") if params.dig(:encoding) and !params.dig(:encoding).is_a?(String)
190
+ raise InvalidParameterError.new("Bad parameter: headers must be an Hash") if params.dig(:headers) and !params.dig(:headers).is_a?(Hash)
191
+ raise InvalidParameterError.new("Bad parameter: body must be an Hash") if params.dig(:body) and !params.dig(:body).is_a?(Hash)
182
192
  raise MissingParameterError.new("Parameter missing: url") unless params.dig(:url)
183
193
 
184
194
  response, _options = Api.send_request("/behaviors/webhook/test", :post, params, options)
@@ -197,6 +197,9 @@ module Files
197
197
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
198
198
 
199
199
  response, options = Api.send_request("/bundles", :get, params, options)
200
+ response.data.map do |entity_data|
201
+ Bundle.new(entity_data, options)
202
+ end
200
203
  end
201
204
 
202
205
  def self.all(params = {}, options = {})
@@ -39,6 +39,9 @@ module Files
39
39
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
40
40
 
41
41
  response, options = Api.send_request("/dns_records", :get, params, options)
42
+ response.data.map do |entity_data|
43
+ DnsRecord.new(entity_data, options)
44
+ end
42
45
  end
43
46
 
44
47
  def self.all(params = {}, options = {})
@@ -151,7 +151,8 @@ module Files
151
151
  etags ||= []
152
152
  bytes_written = 0
153
153
  loop do
154
- upload = FileAction.begin_upload(path, { ref: upload&.ref, part: (upload&.part_number || 0) + 1 }, options)
154
+ begin_upload = FileAction.begin_upload(path, { ref: upload&.ref, part: (upload&.part_number || 0) + 1 }, options)
155
+ upload = begin_upload.is_a?(Enumerable) ? begin_upload.first : begin_upload
155
156
  buf = io.read(upload.partsize) || ""
156
157
  bytes_written += buf.length
157
158
  method = upload.http_method.downcase.to_sym
@@ -389,7 +390,7 @@ module Files
389
390
 
390
391
  def read_io
391
392
  @read_io ||= begin
392
- r, w = IO.pipe
393
+ r, w = SizableIO.pipe
393
394
  Thread.new do
394
395
  download_content(w)
395
396
  ensure
@@ -116,7 +116,9 @@ module Files
116
116
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
117
117
 
118
118
  response, options = Api.send_request("/file_actions/begin_upload/#{Addressable::URI.encode_component(params[:path])}", :post, params, options)
119
- FilePartUpload.new(response.data, options)
119
+ response.data.map do |entity_data|
120
+ FilePartUpload.new(entity_data, options)
121
+ end
120
122
  end
121
123
  end
122
124
  end
@@ -97,6 +97,9 @@ module Files
97
97
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
98
98
 
99
99
  response, options = Api.send_request("/file_comments/files/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
100
+ response.data.map do |entity_data|
101
+ FileComment.new(entity_data, options)
102
+ end
100
103
  end
101
104
 
102
105
  # Parameters:
@@ -117,6 +117,9 @@ module Files
117
117
  raise InvalidParameterError.new("Bad parameter: ids must be an String") if params.dig(:ids) and !params.dig(:ids).is_a?(String)
118
118
 
119
119
  response, options = Api.send_request("/groups", :get, params, options)
120
+ response.data.map do |entity_data|
121
+ Group.new(entity_data, options)
122
+ end
120
123
  end
121
124
 
122
125
  def self.all(params = {}, options = {})
@@ -10,21 +10,30 @@ module Files
10
10
  end
11
11
 
12
12
  # string - Group name
13
- def name
14
- @attributes[:name]
13
+ def group_name
14
+ @attributes[:group_name]
15
15
  end
16
16
 
17
- def name=(value)
18
- @attributes[:name] = value
17
+ def group_name=(value)
18
+ @attributes[:group_name] = value
19
19
  end
20
20
 
21
21
  # int64 - Group ID
22
- def id
23
- @attributes[:id]
22
+ def group_id
23
+ @attributes[:group_id]
24
24
  end
25
25
 
26
- def id=(value)
27
- @attributes[:id] = value
26
+ def group_id=(value)
27
+ @attributes[:group_id] = value
28
+ end
29
+
30
+ # int64 - User ID
31
+ def user_id
32
+ @attributes[:user_id]
33
+ end
34
+
35
+ def user_id=(value)
36
+ @attributes[:user_id] = value
28
37
  end
29
38
 
30
39
  # boolean - Is this user an administrator of this group?
@@ -45,22 +54,13 @@ module Files
45
54
  @attributes[:usernames] = value
46
55
  end
47
56
 
48
- # int64 - Group ID to add user to.
49
- def group_id
50
- @attributes[:group_id]
51
- end
52
-
53
- def group_id=(value)
54
- @attributes[:group_id] = value
55
- end
56
-
57
- # int64 - User ID to add to group.
58
- def user_id
59
- @attributes[:user_id]
57
+ # int64 - Group User ID.
58
+ def id
59
+ @attributes[:id]
60
60
  end
61
61
 
62
- def user_id=(value)
63
- @attributes[:user_id] = value
62
+ def id=(value)
63
+ @attributes[:id] = value
64
64
  end
65
65
 
66
66
  # Parameters:
@@ -100,11 +100,11 @@ module Files
100
100
  end
101
101
 
102
102
  # Parameters:
103
- # user_id - int64 - User ID. If provided, will return groups of which this user is a member.
103
+ # user_id - int64 - User ID. If provided, will return group_users of this user.
104
104
  # page - int64 - Current page number.
105
105
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
106
106
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
107
- # group_id - int64 - Group ID. If provided, will return members of this group.
107
+ # group_id - int64 - Group ID. If provided, will return group_users of this group.
108
108
  def self.list(params = {}, options = {})
109
109
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
110
110
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
@@ -113,6 +113,9 @@ module Files
113
113
  raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
114
114
 
115
115
  response, options = Api.send_request("/group_users", :get, params, options)
116
+ response.data.map do |entity_data|
117
+ GroupUser.new(entity_data, options)
118
+ end
116
119
  end
117
120
 
118
121
  def self.all(params = {}, options = {})
@@ -95,6 +95,9 @@ module Files
95
95
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
96
96
 
97
97
  response, options = Api.send_request("/history/files(/*path)", :get, params, options)
98
+ response.data.map do |entity_data|
99
+ Action.new(entity_data, options)
100
+ end
98
101
  end
99
102
 
100
103
  # Parameters:
@@ -118,6 +121,9 @@ module Files
118
121
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
119
122
 
120
123
  response, options = Api.send_request("/history/folders(/*path)", :get, params, options)
124
+ response.data.map do |entity_data|
125
+ Action.new(entity_data, options)
126
+ end
121
127
  end
122
128
 
123
129
  # Parameters:
@@ -141,6 +147,9 @@ module Files
141
147
  raise MissingParameterError.new("Parameter missing: user_id") unless params.dig(:user_id)
142
148
 
143
149
  response, options = Api.send_request("/history/users/#{params[:user_id]}", :get, params, options)
150
+ response.data.map do |entity_data|
151
+ Action.new(entity_data, options)
152
+ end
144
153
  end
145
154
 
146
155
  # Parameters:
@@ -159,6 +168,9 @@ module Files
159
168
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
160
169
 
161
170
  response, options = Api.send_request("/history/login", :get, params, options)
171
+ response.data.map do |entity_data|
172
+ Action.new(entity_data, options)
173
+ end
162
174
  end
163
175
 
164
176
  # Parameters:
@@ -177,6 +189,9 @@ module Files
177
189
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
178
190
 
179
191
  response, options = Api.send_request("/history", :get, params, options)
192
+ response.data.map do |entity_data|
193
+ Action.new(entity_data, options)
194
+ end
180
195
  end
181
196
 
182
197
  def self.all(params = {}, options = {})
@@ -260,6 +260,9 @@ module Files
260
260
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
261
261
 
262
262
  response, options = Api.send_request("/history_exports", :get, params, options)
263
+ response.data.map do |entity_data|
264
+ HistoryExport.new(entity_data, options)
265
+ end
263
266
  end
264
267
 
265
268
  def self.all(params = {}, options = {})
@@ -89,6 +89,9 @@ module Files
89
89
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
90
90
 
91
91
  response, options = Api.send_request("/invoices", :get, params, options)
92
+ response.data.map do |entity_data|
93
+ AccountLineItem.new(entity_data, options)
94
+ end
92
95
  end
93
96
 
94
97
  def self.all(params = {}, options = {})
@@ -39,6 +39,9 @@ module Files
39
39
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
40
40
 
41
41
  response, options = Api.send_request("/ip_addresses", :get, params, options)
42
+ response.data.map do |entity_data|
43
+ IpAddress.new(entity_data, options)
44
+ end
42
45
  end
43
46
 
44
47
  def self.all(params = {}, options = {})
@@ -133,6 +133,9 @@ module Files
133
133
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
134
134
 
135
135
  response, options = Api.send_request("/locks/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
136
+ response.data.map do |entity_data|
137
+ Lock.new(entity_data, options)
138
+ end
136
139
  end
137
140
 
138
141
  # Parameters:
@@ -121,6 +121,9 @@ module Files
121
121
  raise MissingParameterError.new("Parameter missing: project_id") unless params.dig(:project_id)
122
122
 
123
123
  response, options = Api.send_request("/messages", :get, params, options)
124
+ response.data.map do |entity_data|
125
+ Message.new(entity_data, options)
126
+ end
124
127
  end
125
128
 
126
129
  def self.all(params = {}, options = {})
@@ -97,6 +97,9 @@ module Files
97
97
  raise MissingParameterError.new("Parameter missing: message_id") unless params.dig(:message_id)
98
98
 
99
99
  response, options = Api.send_request("/message_comments", :get, params, options)
100
+ response.data.map do |entity_data|
101
+ MessageComment.new(entity_data, options)
102
+ end
100
103
  end
101
104
 
102
105
  def self.all(params = {}, options = {})
@@ -74,6 +74,9 @@ module Files
74
74
  raise MissingParameterError.new("Parameter missing: message_comment_id") unless params.dig(:message_comment_id)
75
75
 
76
76
  response, options = Api.send_request("/message_comment_reactions", :get, params, options)
77
+ response.data.map do |entity_data|
78
+ MessageCommentReaction.new(entity_data, options)
79
+ end
77
80
  end
78
81
 
79
82
  def self.all(params = {}, options = {})
@@ -74,6 +74,9 @@ module Files
74
74
  raise MissingParameterError.new("Parameter missing: message_id") unless params.dig(:message_id)
75
75
 
76
76
  response, options = Api.send_request("/message_reactions", :get, params, options)
77
+ response.data.map do |entity_data|
78
+ MessageReaction.new(entity_data, options)
79
+ end
77
80
  end
78
81
 
79
82
  def self.all(params = {}, options = {})
@@ -172,6 +172,9 @@ module Files
172
172
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
173
173
 
174
174
  response, options = Api.send_request("/notifications", :get, params, options)
175
+ response.data.map do |entity_data|
176
+ Notification.new(entity_data, options)
177
+ end
175
178
  end
176
179
 
177
180
  def self.all(params = {}, options = {})
@@ -89,6 +89,9 @@ module Files
89
89
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
90
90
 
91
91
  response, options = Api.send_request("/payments", :get, params, options)
92
+ response.data.map do |entity_data|
93
+ AccountLineItem.new(entity_data, options)
94
+ end
92
95
  end
93
96
 
94
97
  def self.all(params = {}, options = {})
@@ -109,6 +109,9 @@ module Files
109
109
  raise InvalidParameterError.new("Bad parameter: user_id must be an String") if params.dig(:user_id) and !params.dig(:user_id).is_a?(String)
110
110
 
111
111
  response, options = Api.send_request("/permissions", :get, params, options)
112
+ response.data.map do |entity_data|
113
+ Permission.new(entity_data, options)
114
+ end
112
115
  end
113
116
 
114
117
  def self.all(path, params = {}, options = {})
@@ -74,6 +74,9 @@ module Files
74
74
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
75
75
 
76
76
  response, options = Api.send_request("/projects", :get, params, options)
77
+ response.data.map do |entity_data|
78
+ Project.new(entity_data, options)
79
+ end
77
80
  end
78
81
 
79
82
  def self.all(params = {}, options = {})
@@ -108,6 +108,9 @@ module Files
108
108
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
109
109
 
110
110
  response, options = Api.send_request("/public_keys", :get, params, options)
111
+ response.data.map do |entity_data|
112
+ PublicKey.new(entity_data, options)
113
+ end
111
114
  end
112
115
 
113
116
  def self.all(params = {}, options = {})
@@ -180,6 +180,33 @@ module Files
180
180
  @attributes[:wasabi_region] = value
181
181
  end
182
182
 
183
+ # string - Rackspace username used to login to the Rackspace Cloud Control Panel.
184
+ def rackspace_username
185
+ @attributes[:rackspace_username]
186
+ end
187
+
188
+ def rackspace_username=(value)
189
+ @attributes[:rackspace_username] = value
190
+ end
191
+
192
+ # string - Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
193
+ def rackspace_region
194
+ @attributes[:rackspace_region]
195
+ end
196
+
197
+ def rackspace_region=(value)
198
+ @attributes[:rackspace_region] = value
199
+ end
200
+
201
+ # string - The name of the container (top level directory) where files will sync.
202
+ def rackspace_container
203
+ @attributes[:rackspace_container]
204
+ end
205
+
206
+ def rackspace_container=(value)
207
+ @attributes[:rackspace_container] = value
208
+ end
209
+
183
210
  # string - AWS Access Key.
184
211
  def aws_access_key
185
212
  @attributes[:aws_access_key]
@@ -261,6 +288,15 @@ module Files
261
288
  @attributes[:backblaze_b2_application_key] = value
262
289
  end
263
290
 
291
+ # string - Rackspace API key from the Rackspace Cloud Control Panel.
292
+ def rackspace_api_key
293
+ @attributes[:rackspace_api_key]
294
+ end
295
+
296
+ def rackspace_api_key=(value)
297
+ @attributes[:rackspace_api_key] = value
298
+ end
299
+
264
300
  # Parameters:
265
301
  # aws_access_key - string - AWS Access Key.
266
302
  # aws_secret_key - string - AWS secret key.
@@ -271,6 +307,7 @@ module Files
271
307
  # wasabi_secret_key - string - Wasabi secret key.
272
308
  # backblaze_b2_key_id - string - Backblaze B2 Cloud Storage keyID.
273
309
  # backblaze_b2_application_key - string - Backblaze B2 Cloud Storage applicationKey.
310
+ # rackspace_api_key - string - Rackspace API key from the Rackspace Cloud Control Panel.
274
311
  # hostname - string - Hostname or IP address
275
312
  # name - string - Internal name for your reference
276
313
  # max_connections - int64 - Max number of parallel connections. Ignored for S3 connections (we will parallelize these as much as possible).
@@ -288,6 +325,9 @@ module Files
288
325
  # backblaze_b2_s3_endpoint - string - Backblaze B2 Cloud Storage S3 Endpoint
289
326
  # wasabi_bucket - string - Wasabi region
290
327
  # wasabi_region - string - Wasabi Bucket name
328
+ # rackspace_username - string - Rackspace username used to login to the Rackspace Cloud Control Panel.
329
+ # rackspace_region - string - Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
330
+ # rackspace_container - string - The name of the container (top level directory) where files will sync.
291
331
  def update(params = {})
292
332
  params ||= {}
293
333
  params[:id] = @attributes[:id]
@@ -302,6 +342,7 @@ module Files
302
342
  raise InvalidParameterError.new("Bad parameter: wasabi_secret_key must be an String") if params.dig(:wasabi_secret_key) and !params.dig(:wasabi_secret_key).is_a?(String)
303
343
  raise InvalidParameterError.new("Bad parameter: backblaze_b2_key_id must be an String") if params.dig(:backblaze_b2_key_id) and !params.dig(:backblaze_b2_key_id).is_a?(String)
304
344
  raise InvalidParameterError.new("Bad parameter: backblaze_b2_application_key must be an String") if params.dig(:backblaze_b2_application_key) and !params.dig(:backblaze_b2_application_key).is_a?(String)
345
+ raise InvalidParameterError.new("Bad parameter: rackspace_api_key must be an String") if params.dig(:rackspace_api_key) and !params.dig(:rackspace_api_key).is_a?(String)
305
346
  raise InvalidParameterError.new("Bad parameter: hostname must be an String") if params.dig(:hostname) and !params.dig(:hostname).is_a?(String)
306
347
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
307
348
  raise InvalidParameterError.new("Bad parameter: max_connections must be an Integer") if params.dig(:max_connections) and !params.dig(:max_connections).is_a?(Integer)
@@ -319,6 +360,9 @@ module Files
319
360
  raise InvalidParameterError.new("Bad parameter: backblaze_b2_s3_endpoint must be an String") if params.dig(:backblaze_b2_s3_endpoint) and !params.dig(:backblaze_b2_s3_endpoint).is_a?(String)
320
361
  raise InvalidParameterError.new("Bad parameter: wasabi_bucket must be an String") if params.dig(:wasabi_bucket) and !params.dig(:wasabi_bucket).is_a?(String)
321
362
  raise InvalidParameterError.new("Bad parameter: wasabi_region must be an String") if params.dig(:wasabi_region) and !params.dig(:wasabi_region).is_a?(String)
363
+ raise InvalidParameterError.new("Bad parameter: rackspace_username must be an String") if params.dig(:rackspace_username) and !params.dig(:rackspace_username).is_a?(String)
364
+ raise InvalidParameterError.new("Bad parameter: rackspace_region must be an String") if params.dig(:rackspace_region) and !params.dig(:rackspace_region).is_a?(String)
365
+ raise InvalidParameterError.new("Bad parameter: rackspace_container must be an String") if params.dig(:rackspace_container) and !params.dig(:rackspace_container).is_a?(String)
322
366
  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
323
367
 
324
368
  Api.send_request("/remote_servers/#{@attributes[:id]}", :patch, params, @options)
@@ -357,6 +401,9 @@ module Files
357
401
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
358
402
 
359
403
  response, options = Api.send_request("/remote_servers", :get, params, options)
404
+ response.data.map do |entity_data|
405
+ RemoteServer.new(entity_data, options)
406
+ end
360
407
  end
361
408
 
362
409
  def self.all(params = {}, options = {})
@@ -389,6 +436,7 @@ module Files
389
436
  # wasabi_secret_key - string - Wasabi secret key.
390
437
  # backblaze_b2_key_id - string - Backblaze B2 Cloud Storage keyID.
391
438
  # backblaze_b2_application_key - string - Backblaze B2 Cloud Storage applicationKey.
439
+ # rackspace_api_key - string - Rackspace API key from the Rackspace Cloud Control Panel.
392
440
  # hostname - string - Hostname or IP address
393
441
  # name - string - Internal name for your reference
394
442
  # max_connections - int64 - Max number of parallel connections. Ignored for S3 connections (we will parallelize these as much as possible).
@@ -406,6 +454,9 @@ module Files
406
454
  # backblaze_b2_s3_endpoint - string - Backblaze B2 Cloud Storage S3 Endpoint
407
455
  # wasabi_bucket - string - Wasabi region
408
456
  # wasabi_region - string - Wasabi Bucket name
457
+ # rackspace_username - string - Rackspace username used to login to the Rackspace Cloud Control Panel.
458
+ # rackspace_region - string - Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
459
+ # rackspace_container - string - The name of the container (top level directory) where files will sync.
409
460
  def self.create(params = {}, options = {})
410
461
  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)
411
462
  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)
@@ -416,6 +467,7 @@ module Files
416
467
  raise InvalidParameterError.new("Bad parameter: wasabi_secret_key must be an String") if params.dig(:wasabi_secret_key) and !params.dig(:wasabi_secret_key).is_a?(String)
417
468
  raise InvalidParameterError.new("Bad parameter: backblaze_b2_key_id must be an String") if params.dig(:backblaze_b2_key_id) and !params.dig(:backblaze_b2_key_id).is_a?(String)
418
469
  raise InvalidParameterError.new("Bad parameter: backblaze_b2_application_key must be an String") if params.dig(:backblaze_b2_application_key) and !params.dig(:backblaze_b2_application_key).is_a?(String)
470
+ raise InvalidParameterError.new("Bad parameter: rackspace_api_key must be an String") if params.dig(:rackspace_api_key) and !params.dig(:rackspace_api_key).is_a?(String)
419
471
  raise InvalidParameterError.new("Bad parameter: hostname must be an String") if params.dig(:hostname) and !params.dig(:hostname).is_a?(String)
420
472
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
421
473
  raise InvalidParameterError.new("Bad parameter: max_connections must be an Integer") if params.dig(:max_connections) and !params.dig(:max_connections).is_a?(Integer)
@@ -433,6 +485,9 @@ module Files
433
485
  raise InvalidParameterError.new("Bad parameter: backblaze_b2_s3_endpoint must be an String") if params.dig(:backblaze_b2_s3_endpoint) and !params.dig(:backblaze_b2_s3_endpoint).is_a?(String)
434
486
  raise InvalidParameterError.new("Bad parameter: wasabi_bucket must be an String") if params.dig(:wasabi_bucket) and !params.dig(:wasabi_bucket).is_a?(String)
435
487
  raise InvalidParameterError.new("Bad parameter: wasabi_region must be an String") if params.dig(:wasabi_region) and !params.dig(:wasabi_region).is_a?(String)
488
+ raise InvalidParameterError.new("Bad parameter: rackspace_username must be an String") if params.dig(:rackspace_username) and !params.dig(:rackspace_username).is_a?(String)
489
+ raise InvalidParameterError.new("Bad parameter: rackspace_region must be an String") if params.dig(:rackspace_region) and !params.dig(:rackspace_region).is_a?(String)
490
+ raise InvalidParameterError.new("Bad parameter: rackspace_container must be an String") if params.dig(:rackspace_container) and !params.dig(:rackspace_container).is_a?(String)
436
491
 
437
492
  response, options = Api.send_request("/remote_servers", :post, params, options)
438
493
  RemoteServer.new(response.data, options)
@@ -448,6 +503,7 @@ module Files
448
503
  # wasabi_secret_key - string - Wasabi secret key.
449
504
  # backblaze_b2_key_id - string - Backblaze B2 Cloud Storage keyID.
450
505
  # backblaze_b2_application_key - string - Backblaze B2 Cloud Storage applicationKey.
506
+ # rackspace_api_key - string - Rackspace API key from the Rackspace Cloud Control Panel.
451
507
  # hostname - string - Hostname or IP address
452
508
  # name - string - Internal name for your reference
453
509
  # max_connections - int64 - Max number of parallel connections. Ignored for S3 connections (we will parallelize these as much as possible).
@@ -465,6 +521,9 @@ module Files
465
521
  # backblaze_b2_s3_endpoint - string - Backblaze B2 Cloud Storage S3 Endpoint
466
522
  # wasabi_bucket - string - Wasabi region
467
523
  # wasabi_region - string - Wasabi Bucket name
524
+ # rackspace_username - string - Rackspace username used to login to the Rackspace Cloud Control Panel.
525
+ # rackspace_region - string - Three letter airport code for Rackspace region. See https://support.rackspace.com/how-to/about-regions/
526
+ # rackspace_container - string - The name of the container (top level directory) where files will sync.
468
527
  def self.update(id, params = {}, options = {})
469
528
  params ||= {}
470
529
  params[:id] = id
@@ -478,6 +537,7 @@ module Files
478
537
  raise InvalidParameterError.new("Bad parameter: wasabi_secret_key must be an String") if params.dig(:wasabi_secret_key) and !params.dig(:wasabi_secret_key).is_a?(String)
479
538
  raise InvalidParameterError.new("Bad parameter: backblaze_b2_key_id must be an String") if params.dig(:backblaze_b2_key_id) and !params.dig(:backblaze_b2_key_id).is_a?(String)
480
539
  raise InvalidParameterError.new("Bad parameter: backblaze_b2_application_key must be an String") if params.dig(:backblaze_b2_application_key) and !params.dig(:backblaze_b2_application_key).is_a?(String)
540
+ raise InvalidParameterError.new("Bad parameter: rackspace_api_key must be an String") if params.dig(:rackspace_api_key) and !params.dig(:rackspace_api_key).is_a?(String)
481
541
  raise InvalidParameterError.new("Bad parameter: hostname must be an String") if params.dig(:hostname) and !params.dig(:hostname).is_a?(String)
482
542
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
483
543
  raise InvalidParameterError.new("Bad parameter: max_connections must be an Integer") if params.dig(:max_connections) and !params.dig(:max_connections).is_a?(Integer)
@@ -495,6 +555,9 @@ module Files
495
555
  raise InvalidParameterError.new("Bad parameter: backblaze_b2_s3_endpoint must be an String") if params.dig(:backblaze_b2_s3_endpoint) and !params.dig(:backblaze_b2_s3_endpoint).is_a?(String)
496
556
  raise InvalidParameterError.new("Bad parameter: wasabi_bucket must be an String") if params.dig(:wasabi_bucket) and !params.dig(:wasabi_bucket).is_a?(String)
497
557
  raise InvalidParameterError.new("Bad parameter: wasabi_region must be an String") if params.dig(:wasabi_region) and !params.dig(:wasabi_region).is_a?(String)
558
+ raise InvalidParameterError.new("Bad parameter: rackspace_username must be an String") if params.dig(:rackspace_username) and !params.dig(:rackspace_username).is_a?(String)
559
+ raise InvalidParameterError.new("Bad parameter: rackspace_region must be an String") if params.dig(:rackspace_region) and !params.dig(:rackspace_region).is_a?(String)
560
+ raise InvalidParameterError.new("Bad parameter: rackspace_container must be an String") if params.dig(:rackspace_container) and !params.dig(:rackspace_container).is_a?(String)
498
561
  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
499
562
 
500
563
  response, options = Api.send_request("/remote_servers/#{params[:id]}", :patch, params, options)
@@ -124,6 +124,9 @@ module Files
124
124
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
125
125
 
126
126
  response, options = Api.send_request("/requests", :get, params, options)
127
+ response.data.map do |entity_data|
128
+ Request.new(entity_data, options)
129
+ end
127
130
  end
128
131
 
129
132
  def self.all(path, params = {}, options = {})
@@ -146,6 +149,9 @@ module Files
146
149
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
147
150
 
148
151
  response, options = Api.send_request("/requests/folders/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
152
+ response.data.map do |entity_data|
153
+ Request.new(entity_data, options)
154
+ end
149
155
  end
150
156
 
151
157
  # Parameters:
@@ -9,7 +9,7 @@ module Files
9
9
  @options = options || {}
10
10
  end
11
11
 
12
- # string - SSO Protocol
12
+ # array - SSO Protocol
13
13
  def protocol
14
14
  @attributes[:protocol]
15
15
  end
@@ -179,11 +179,6 @@ module Files
179
179
  @attributes[:ldap_secure]
180
180
  end
181
181
 
182
- # string - Comma or newline separated list of group names (with optional wildcards) - if provided, only users in these groups will be added or synced.
183
- def ldap_user_include_groups
184
- @attributes[:ldap_user_include_groups]
185
- end
186
-
187
182
  # string - Username for signing in to LDAP server.
188
183
  def ldap_username
189
184
  @attributes[:ldap_username]
@@ -204,6 +199,9 @@ module Files
204
199
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
205
200
 
206
201
  response, options = Api.send_request("/sso_strategies", :get, params, options)
202
+ response.data.map do |entity_data|
203
+ SsoStrategy.new(entity_data, options)
204
+ end
207
205
  end
208
206
 
209
207
  def self.all(params = {}, options = {})
@@ -24,6 +24,7 @@ module Files
24
24
  @attributes[:status]
25
25
  end
26
26
 
27
+ # Additional data
27
28
  def data
28
29
  @attributes[:data]
29
30
  end
@@ -39,6 +39,9 @@ module Files
39
39
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
40
40
 
41
41
  response, options = Api.send_request("/usage_daily_snapshots", :get, params, options)
42
+ response.data.map do |entity_data|
43
+ UsageDailySnapshot.new(entity_data, options)
44
+ end
42
45
  end
43
46
 
44
47
  def self.all(params = {}, options = {})
@@ -84,6 +84,9 @@ module Files
84
84
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
85
85
 
86
86
  response, options = Api.send_request("/usage_snapshots", :get, params, options)
87
+ response.data.map do |entity_data|
88
+ UsageSnapshot.new(entity_data, options)
89
+ end
87
90
  end
88
91
 
89
92
  def self.all(params = {}, options = {})
@@ -612,6 +612,8 @@ module Files
612
612
  # q[password_validity_days] - string - If set, list only users with overridden password validity days setting.
613
613
  # q[ssl_required] - string - If set, list only users with overridden SSL required setting.
614
614
  # search - string - Searches for partial matches of name, username, or email.
615
+ # sort_by[last_login_at] - string - If set, sort users by 'last_login_at' in either 'asc' or 'desc' direction
616
+ # sort_by[authenticate_until] - string - If set, sort users by 'authenticate_until' in either 'asc' or 'desc' direction
615
617
  def self.list(params = {}, options = {})
616
618
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
617
619
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
@@ -619,6 +621,9 @@ module Files
619
621
  raise InvalidParameterError.new("Bad parameter: search must be an String") if params.dig(:search) and !params.dig(:search).is_a?(String)
620
622
 
621
623
  response, options = Api.send_request("/users", :get, params, options)
624
+ response.data.map do |entity_data|
625
+ User.new(entity_data, options)
626
+ end
622
627
  end
623
628
 
624
629
  def self.all(params = {}, options = {})
@@ -51,6 +51,9 @@ module Files
51
51
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
52
52
 
53
53
  response, options = Api.send_request("/user_cipher_uses", :get, params, options)
54
+ response.data.map do |entity_data|
55
+ UserCipherUse.new(entity_data, options)
56
+ end
54
57
  end
55
58
 
56
59
  def self.all(params = {}, options = {})
@@ -0,0 +1,32 @@
1
+ module Files
2
+ class SizableIO < IO
3
+ def self.pipe
4
+ r, w = super
5
+
6
+ w.instance_variable_set(:@read_io, r)
7
+
8
+ [r, w]
9
+ end
10
+
11
+ def size
12
+ read_io.content_length_promise.wait.value
13
+ end
14
+
15
+ def fulfill_content_length(length)
16
+ read_io.content_length = length
17
+ read_io.content_length_promise.execute
18
+ end
19
+
20
+ protected
21
+
22
+ attr_accessor :content_length
23
+
24
+ def content_length_promise
25
+ @content_length_promise ||= Concurrent::Promise.new { content_length }
26
+ end
27
+
28
+ def read_io
29
+ @read_io || self
30
+ end
31
+ end
32
+ end
@@ -24,8 +24,9 @@ RSpec.describe Files::File, :with_test_folder do
24
24
 
25
25
  it "returns an IO Object" do
26
26
  file = Files::File.find(test_folder.join("read.txt").to_s, {}, options)
27
- expect(file.read_io.class).to eq(IO)
27
+ expect(file.read_io).to be_a_kind_of(IO)
28
28
  expect(file.read_io.read).to eq("contents")
29
+ expect(file.read_io.size).to eq("contents".length)
29
30
  end
30
31
  end
31
32
 
@@ -27,6 +27,7 @@ RSpec.configure do |config|
27
27
  Files::Folder.mkdir("files_regional_worker", {}, api_key: @api_key) unless Files::Folder.exist?("files_regional_worker", api_key: @api_key)
28
28
  Files::Folder.mkdir(@test_folder.to_s, {}, api_key: @api_key)
29
29
  all.run
30
+ ensure
30
31
  Files::Folder.delete(@test_folder.to_s, { recursive: true }, api_key: @api_key)
31
32
  end
32
33
 
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.66
4
+ version: 1.0.71
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-06-11 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.7.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: concurrent-ruby
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.3
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.3
55
69
  description: The Files.com Ruby client.
56
70
  email:
57
71
  - support@files.com
@@ -173,6 +187,7 @@ files:
173
187
  - lib/files.com/models/user.rb
174
188
  - lib/files.com/models/user_cipher_use.rb
175
189
  - lib/files.com/response.rb
190
+ - lib/files.com/sizable_io.rb
176
191
  - lib/files.com/system_profiler.rb
177
192
  - lib/files.com/util.rb
178
193
  - lib/files.com/version.rb