files.com 1.0.101 → 1.0.106

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/_VERSION +1 -1
  3. data/docs/api_key.md +18 -2
  4. data/docs/as2_key.md +1 -0
  5. data/docs/bandwidth_snapshot.md +8 -0
  6. data/docs/bundle_download.md +1 -0
  7. data/docs/bundle_recipient.md +1 -0
  8. data/docs/clickwrap.md +1 -0
  9. data/docs/dns_record.md +1 -0
  10. data/docs/external_event.md +43 -0
  11. data/docs/file.md +2 -2
  12. data/docs/file_comment.md +1 -0
  13. data/docs/file_part_upload.md +2 -0
  14. data/docs/folder.md +2 -2
  15. data/docs/group_user.md +1 -0
  16. data/docs/history_export.md +23 -69
  17. data/docs/history_export_result.md +79 -0
  18. data/docs/invoice.md +1 -0
  19. data/docs/ip_address.md +2 -0
  20. data/docs/lock.md +1 -0
  21. data/docs/message.md +1 -0
  22. data/docs/message_comment.md +1 -0
  23. data/docs/message_comment_reaction.md +1 -0
  24. data/docs/message_reaction.md +1 -0
  25. data/docs/payment.md +1 -0
  26. data/docs/project.md +1 -0
  27. data/docs/public_key.md +1 -0
  28. data/docs/remote_server.md +1 -0
  29. data/docs/session.md +10 -2
  30. data/docs/site.md +18 -2
  31. data/docs/sso_strategy.md +3 -0
  32. data/docs/usage_snapshot.md +1 -0
  33. data/docs/user_cipher_use.md +1 -0
  34. data/docs/user_request.md +3 -0
  35. data/lib/files.com.rb +2 -0
  36. data/lib/files.com/api_client.rb +2 -1
  37. data/lib/files.com/models/api_key.rb +12 -0
  38. data/lib/files.com/models/as2_key.rb +4 -3
  39. data/lib/files.com/models/bandwidth_snapshot.rb +18 -3
  40. data/lib/files.com/models/bundle_download.rb +4 -3
  41. data/lib/files.com/models/bundle_recipient.rb +4 -3
  42. data/lib/files.com/models/clickwrap.rb +4 -3
  43. data/lib/files.com/models/dns_record.rb +4 -3
  44. data/lib/files.com/models/external_event.rb +66 -0
  45. data/lib/files.com/models/file.rb +6 -6
  46. data/lib/files.com/models/file_comment.rb +4 -3
  47. data/lib/files.com/models/file_part_upload.rb +5 -0
  48. data/lib/files.com/models/folder.rb +3 -3
  49. data/lib/files.com/models/group_user.rb +4 -3
  50. data/lib/files.com/models/history_export.rb +24 -64
  51. data/lib/files.com/models/history_export_result.rb +152 -0
  52. data/lib/files.com/models/invoice.rb +4 -3
  53. data/lib/files.com/models/ip_address.rb +8 -6
  54. data/lib/files.com/models/lock.rb +4 -3
  55. data/lib/files.com/models/message.rb +4 -3
  56. data/lib/files.com/models/message_comment.rb +4 -3
  57. data/lib/files.com/models/message_comment_reaction.rb +4 -3
  58. data/lib/files.com/models/message_reaction.rb +4 -3
  59. data/lib/files.com/models/payment.rb +4 -3
  60. data/lib/files.com/models/project.rb +4 -3
  61. data/lib/files.com/models/public_key.rb +4 -3
  62. data/lib/files.com/models/remote_server.rb +4 -3
  63. data/lib/files.com/models/session.rb +6 -0
  64. data/lib/files.com/models/site.rb +12 -0
  65. data/lib/files.com/models/sso_strategy.rb +9 -3
  66. data/lib/files.com/models/usage_snapshot.rb +4 -3
  67. data/lib/files.com/models/user_cipher_use.rb +4 -3
  68. data/lib/files.com/models/user_request.rb +13 -3
  69. metadata +6 -2
@@ -305,8 +305,8 @@ module Files
305
305
  end
306
306
  end
307
307
 
308
- def download_content(io)
309
- Files::ApiClient.download_client.stream_download(download_uri_with_load, io)
308
+ def download_content(io, range: [])
309
+ Files::ApiClient.download_client.stream_download(download_uri_with_load, io, range)
310
310
  end
311
311
 
312
312
  def each(*args, &block)
@@ -388,11 +388,11 @@ module Files
388
388
  read_io.gets *args
389
389
  end
390
390
 
391
- def read_io
391
+ def read_io(**options)
392
392
  @read_io ||= begin
393
393
  r, w = SizableIO.pipe
394
394
  Thread.new do
395
- download_content(w)
395
+ download_content(w, **options)
396
396
  ensure
397
397
  w.close
398
398
  end
@@ -857,7 +857,7 @@ module Files
857
857
  end
858
858
 
859
859
  # Parameters:
860
- # recursive - boolean - If true, will recursively delete folers. Otherwise, will error on non-empty folders. For legacy reasons, this parameter may also be provided as the HTTP header `Depth: Infinity`
860
+ # recursive - boolean - If true, will recursively delete folers. Otherwise, will error on non-empty folders.
861
861
  def delete(params = {})
862
862
  params ||= {}
863
863
  params[:path] = @attributes[:path]
@@ -946,7 +946,7 @@ module Files
946
946
  end
947
947
 
948
948
  # Parameters:
949
- # recursive - boolean - If true, will recursively delete folers. Otherwise, will error on non-empty folders. For legacy reasons, this parameter may also be provided as the HTTP header `Depth: Infinity`
949
+ # recursive - boolean - If true, will recursively delete folers. Otherwise, will error on non-empty folders.
950
950
  def self.delete(path, params = {}, options = {})
951
951
  params ||= {}
952
952
  params[:path] = path
@@ -86,6 +86,7 @@ module Files
86
86
  # page - int64 - Current page number.
87
87
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
88
88
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
89
+ # 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.
89
90
  # path (required) - string - Path to operate on.
90
91
  def self.list_for(path, params = {}, options = {})
91
92
  params ||= {}
@@ -93,12 +94,12 @@ module Files
93
94
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
94
95
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
95
96
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
97
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
96
98
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
97
99
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
98
100
 
99
- response, options = Api.send_request("/file_comments/files/#{params[:path]}", :get, params, options)
100
- response.data.map do |entity_data|
101
- FileComment.new(entity_data, options)
101
+ List.new(FileComment, params) do
102
+ Api.send_request("/file_comments/files/#{params[:path]}", :get, params, options)
102
103
  end
103
104
  end
104
105
 
@@ -49,6 +49,11 @@ module Files
49
49
  @attributes[:next_partsize]
50
50
  end
51
51
 
52
+ # boolean - If true, parts may be uploaded in parallel
53
+ def parallel_parts
54
+ @attributes[:parallel_parts]
55
+ end
56
+
52
57
  # string - Additional upload parameters
53
58
  def parameters
54
59
  @attributes[:parameters]
@@ -311,9 +311,9 @@ module Files
311
311
  # Parameters:
312
312
  # page - int64 - Current page number.
313
313
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
314
- # action - string - Action to take. Can be `count`, `count_nrs` (non recursive), `size`, `permissions`, or blank.
315
- # path (required) - string - Path to operate on.
314
+ # action - string - Action to take. Can be `count`, `size`, `permissions`, or blank.
316
315
  # 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 header.
316
+ # path (required) - string - Path to operate on.
317
317
  # filter - string - If specified, will to filter folders/files list by this string. Wildcards of `*` and `?` are acceptable here.
318
318
  # preview_size - string - Request a preview size. Can be `small` (default), `large`, `xlarge`, or `pdf`.
319
319
  # search - string - If `search_all` is `true`, provide the search string here. Otherwise, this parameter acts like an alias of `filter`.
@@ -326,8 +326,8 @@ module Files
326
326
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
327
327
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
328
328
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
329
- raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
330
329
  raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
330
+ raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
331
331
  raise InvalidParameterError.new("Bad parameter: filter must be an String") if params.dig(:filter) and !params.dig(:filter).is_a?(String)
332
332
  raise InvalidParameterError.new("Bad parameter: preview_size must be an String") if params.dig(:preview_size) and !params.dig(:preview_size).is_a?(String)
333
333
  raise InvalidParameterError.new("Bad parameter: search must be an String") if params.dig(:search) and !params.dig(:search).is_a?(String)
@@ -111,17 +111,18 @@ module Files
111
111
  # page - int64 - Current page number.
112
112
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
113
113
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
114
+ # 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.
114
115
  # group_id - int64 - Group ID. If provided, will return group_users of this group.
115
116
  def self.list(params = {}, options = {})
116
117
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
117
118
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
118
119
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
119
120
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
121
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
120
122
  raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
121
123
 
122
- response, options = Api.send_request("/group_users", :get, params, options)
123
- response.data.map do |entity_data|
124
- GroupUser.new(entity_data, options)
124
+ List.new(GroupUser, params) do
125
+ Api.send_request("/group_users", :get, params, options)
125
126
  end
126
127
  end
127
128
 
@@ -63,7 +63,7 @@ module Files
63
63
  @attributes[:query_interface] = value
64
64
  end
65
65
 
66
- # int64 - Return results that are actions performed by the user indiciated by this User ID
66
+ # string - Return results that are actions performed by the user indiciated by this User ID
67
67
  def query_user_id
68
68
  @attributes[:query_user_id]
69
69
  end
@@ -72,7 +72,7 @@ module Files
72
72
  @attributes[:query_user_id] = value
73
73
  end
74
74
 
75
- # int64 - Return results that are file actions related to the file indicated by this File ID
75
+ # string - Return results that are file actions related to the file indicated by this File ID
76
76
  def query_file_id
77
77
  @attributes[:query_file_id]
78
78
  end
@@ -81,7 +81,7 @@ module Files
81
81
  @attributes[:query_file_id] = value
82
82
  end
83
83
 
84
- # int64 - Return results that are file actions inside the parent folder specified by this folder ID
84
+ # string - Return results that are file actions inside the parent folder specified by this folder ID
85
85
  def query_parent_id
86
86
  @attributes[:query_parent_id]
87
87
  end
@@ -153,7 +153,7 @@ module Files
153
153
  @attributes[:query_failure_type] = value
154
154
  end
155
155
 
156
- # int64 - If searching for Histories about specific objects (such as Users, or API Keys), this paremeter restricts results to objects that match this ID.
156
+ # string - If searching for Histories about specific objects (such as Users, or API Keys), this paremeter restricts results to objects that match this ID.
157
157
  def query_target_id
158
158
  @attributes[:query_target_id]
159
159
  end
@@ -180,7 +180,7 @@ module Files
180
180
  @attributes[:query_target_permission] = value
181
181
  end
182
182
 
183
- # int64 - If searching for Histories about API keys, this parameter restricts results to API keys created by/for this user ID.
183
+ # string - If searching for Histories about API keys, this parameter restricts results to API keys created by/for this user ID.
184
184
  def query_target_user_id
185
185
  @attributes[:query_target_user_id]
186
186
  end
@@ -216,6 +216,15 @@ module Files
216
216
  @attributes[:query_target_permission_set] = value
217
217
  end
218
218
 
219
+ # string - If `status` is `ready` and the query succeeded, this will be a URL where all the results can be downloaded at once as a CSV.
220
+ def results_url
221
+ @attributes[:results_url]
222
+ end
223
+
224
+ def results_url=(value)
225
+ @attributes[:results_url] = value
226
+ end
227
+
219
228
  # int64 - User ID. Provide a value of `0` to operate the current session's user.
220
229
  def user_id
221
230
  @attributes[:user_id]
@@ -225,20 +234,6 @@ module Files
225
234
  @attributes[:user_id] = value
226
235
  end
227
236
 
228
- def delete(params = {})
229
- params ||= {}
230
- params[:id] = @attributes[:id]
231
- raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
232
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
233
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
234
-
235
- Api.send_request("/history_exports/#{@attributes[:id]}", :delete, params, @options)
236
- end
237
-
238
- def destroy(params = {})
239
- delete(params)
240
- end
241
-
242
237
  def save
243
238
  if @attributes[:id]
244
239
  raise NotImplementedError.new("The HistoryExport object doesn't support updates.")
@@ -248,27 +243,6 @@ module Files
248
243
  end
249
244
  end
250
245
 
251
- # Parameters:
252
- # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
253
- # page - int64 - Current page number.
254
- # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
255
- # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
256
- def self.list(params = {}, options = {})
257
- raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
258
- raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
259
- raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
260
- raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
261
-
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
266
- end
267
-
268
- def self.all(params = {}, options = {})
269
- list(params, options)
270
- end
271
-
272
246
  # Parameters:
273
247
  # id (required) - int64 - History Export ID.
274
248
  def self.find(id, params = {}, options = {})
@@ -291,9 +265,9 @@ module Files
291
265
  # end_at - string - End date/time of export range.
292
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`
293
267
  # query_interface - string - Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
294
- # query_user_id - int64 - Return results that are actions performed by the user indiciated by this User ID
295
- # query_file_id - int64 - Return results that are file actions related to the file indicated by this File ID
296
- # query_parent_id - int64 - Return results that are file actions inside the parent folder specified by this folder ID
268
+ # query_user_id - string - Return results that are actions performed by the user indiciated by this User ID
269
+ # query_file_id - string - Return results that are file actions related to the file indicated by this File ID
270
+ # query_parent_id - string - Return results that are file actions inside the parent folder specified by this folder ID
297
271
  # query_path - string - Return results that are file actions related to this path.
298
272
  # query_folder - string - Return results that are file actions related to files or folders inside this folder path.
299
273
  # query_src - string - Return results that are file moves originating from this path.
@@ -301,10 +275,10 @@ module Files
301
275
  # query_ip - string - Filter results by this IP address.
302
276
  # query_username - string - Filter results by this username.
303
277
  # query_failure_type - string - If searching for Histories about login failures, this parameter restricts results to failures of this specific type. 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`
304
- # query_target_id - int64 - If searching for Histories about specific objects (such as Users, or API Keys), this paremeter restricts results to objects that match this ID.
278
+ # query_target_id - string - If searching for Histories about specific objects (such as Users, or API Keys), this paremeter restricts results to objects that match this ID.
305
279
  # query_target_name - string - If searching for Histories about Users, Groups or other objects with names, this parameter restricts results to objects with this name/username.
306
280
  # query_target_permission - string - If searching for Histories about Permisisons, this parameter restricts results to permissions of this level.
307
- # query_target_user_id - int64 - If searching for Histories about API keys, this parameter restricts results to API keys created by/for this user ID.
281
+ # query_target_user_id - string - If searching for Histories about API keys, this parameter restricts results to API keys created by/for this user ID.
308
282
  # query_target_username - string - If searching for Histories about API keys, this parameter restricts results to API keys created by/for this username.
309
283
  # query_target_platform - string - If searching for Histories about API keys, this parameter restricts results to API keys associated with this platform.
310
284
  # query_target_permission_set - string - If searching for Histories about API keys, this parameter restricts results to API keys with this permission set.
@@ -314,9 +288,9 @@ module Files
314
288
  raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String)
315
289
  raise InvalidParameterError.new("Bad parameter: query_action must be an String") if params.dig(:query_action) and !params.dig(:query_action).is_a?(String)
316
290
  raise InvalidParameterError.new("Bad parameter: query_interface must be an String") if params.dig(:query_interface) and !params.dig(:query_interface).is_a?(String)
317
- raise InvalidParameterError.new("Bad parameter: query_user_id must be an Integer") if params.dig(:query_user_id) and !params.dig(:query_user_id).is_a?(Integer)
318
- raise InvalidParameterError.new("Bad parameter: query_file_id must be an Integer") if params.dig(:query_file_id) and !params.dig(:query_file_id).is_a?(Integer)
319
- raise InvalidParameterError.new("Bad parameter: query_parent_id must be an Integer") if params.dig(:query_parent_id) and !params.dig(:query_parent_id).is_a?(Integer)
291
+ raise InvalidParameterError.new("Bad parameter: query_user_id must be an String") if params.dig(:query_user_id) and !params.dig(:query_user_id).is_a?(String)
292
+ raise InvalidParameterError.new("Bad parameter: query_file_id must be an String") if params.dig(:query_file_id) and !params.dig(:query_file_id).is_a?(String)
293
+ raise InvalidParameterError.new("Bad parameter: query_parent_id must be an String") if params.dig(:query_parent_id) and !params.dig(:query_parent_id).is_a?(String)
320
294
  raise InvalidParameterError.new("Bad parameter: query_path must be an String") if params.dig(:query_path) and !params.dig(:query_path).is_a?(String)
321
295
  raise InvalidParameterError.new("Bad parameter: query_folder must be an String") if params.dig(:query_folder) and !params.dig(:query_folder).is_a?(String)
322
296
  raise InvalidParameterError.new("Bad parameter: query_src must be an String") if params.dig(:query_src) and !params.dig(:query_src).is_a?(String)
@@ -324,10 +298,10 @@ module Files
324
298
  raise InvalidParameterError.new("Bad parameter: query_ip must be an String") if params.dig(:query_ip) and !params.dig(:query_ip).is_a?(String)
325
299
  raise InvalidParameterError.new("Bad parameter: query_username must be an String") if params.dig(:query_username) and !params.dig(:query_username).is_a?(String)
326
300
  raise InvalidParameterError.new("Bad parameter: query_failure_type must be an String") if params.dig(:query_failure_type) and !params.dig(:query_failure_type).is_a?(String)
327
- raise InvalidParameterError.new("Bad parameter: query_target_id must be an Integer") if params.dig(:query_target_id) and !params.dig(:query_target_id).is_a?(Integer)
301
+ raise InvalidParameterError.new("Bad parameter: query_target_id must be an String") if params.dig(:query_target_id) and !params.dig(:query_target_id).is_a?(String)
328
302
  raise InvalidParameterError.new("Bad parameter: query_target_name must be an String") if params.dig(:query_target_name) and !params.dig(:query_target_name).is_a?(String)
329
303
  raise InvalidParameterError.new("Bad parameter: query_target_permission must be an String") if params.dig(:query_target_permission) and !params.dig(:query_target_permission).is_a?(String)
330
- raise InvalidParameterError.new("Bad parameter: query_target_user_id must be an Integer") if params.dig(:query_target_user_id) and !params.dig(:query_target_user_id).is_a?(Integer)
304
+ raise InvalidParameterError.new("Bad parameter: query_target_user_id must be an String") if params.dig(:query_target_user_id) and !params.dig(:query_target_user_id).is_a?(String)
331
305
  raise InvalidParameterError.new("Bad parameter: query_target_username must be an String") if params.dig(:query_target_username) and !params.dig(:query_target_username).is_a?(String)
332
306
  raise InvalidParameterError.new("Bad parameter: query_target_platform must be an String") if params.dig(:query_target_platform) and !params.dig(:query_target_platform).is_a?(String)
333
307
  raise InvalidParameterError.new("Bad parameter: query_target_permission_set must be an String") if params.dig(:query_target_permission_set) and !params.dig(:query_target_permission_set).is_a?(String)
@@ -335,19 +309,5 @@ module Files
335
309
  response, options = Api.send_request("/history_exports", :post, params, options)
336
310
  HistoryExport.new(response.data, options)
337
311
  end
338
-
339
- def self.delete(id, params = {}, options = {})
340
- params ||= {}
341
- params[:id] = id
342
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
343
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
344
-
345
- response, _options = Api.send_request("/history_exports/#{params[:id]}", :delete, params, options)
346
- response.data
347
- end
348
-
349
- def self.destroy(id, params = {}, options = {})
350
- delete(id, params, options)
351
- end
352
312
  end
353
313
  end
@@ -0,0 +1,152 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class HistoryExportResult
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Action ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ # int64 - When the action happened
18
+ def created_at
19
+ @attributes[:created_at]
20
+ end
21
+
22
+ # int64 - User ID
23
+ def user_id
24
+ @attributes[:user_id]
25
+ end
26
+
27
+ # int64 - File ID related to the action
28
+ def file_id
29
+ @attributes[:file_id]
30
+ end
31
+
32
+ # int64 - ID of the parent folder
33
+ def parent_id
34
+ @attributes[:parent_id]
35
+ end
36
+
37
+ # string - Path of the related action This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
38
+ def path
39
+ @attributes[:path]
40
+ end
41
+
42
+ # string - Folder in which the action occurred
43
+ def folder
44
+ @attributes[:folder]
45
+ end
46
+
47
+ # string - File move originated from this path
48
+ def src
49
+ @attributes[:src]
50
+ end
51
+
52
+ # string - File moved to this destination folder
53
+ def destination
54
+ @attributes[:destination]
55
+ end
56
+
57
+ # string - Client IP that performed the action
58
+ def ip
59
+ @attributes[:ip]
60
+ end
61
+
62
+ # string - Username of the user that performed the action
63
+ def username
64
+ @attributes[:username]
65
+ end
66
+
67
+ # 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`
68
+ def action
69
+ @attributes[:action]
70
+ end
71
+
72
+ # 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`
73
+ def failure_type
74
+ @attributes[:failure_type]
75
+ end
76
+
77
+ # string - Inteface through which the action was taken. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
78
+ def interface
79
+ @attributes[:interface]
80
+ end
81
+
82
+ # int64 - ID of the object (such as Users, or API Keys) on which the action was taken
83
+ def target_id
84
+ @attributes[:target_id]
85
+ end
86
+
87
+ # string - Name of the User, Group or other object with a name related to this action
88
+ def target_name
89
+ @attributes[:target_name]
90
+ end
91
+
92
+ # string - Permission level of the action
93
+ def target_permission
94
+ @attributes[:target_permission]
95
+ end
96
+
97
+ # boolean - Whether or not the action was recursive
98
+ def target_recursive
99
+ @attributes[:target_recursive]
100
+ end
101
+
102
+ # int64 - If searching for Histories about API keys, this is when the API key will expire
103
+ def target_expires_at
104
+ @attributes[:target_expires_at]
105
+ end
106
+
107
+ # string - If searching for Histories about API keys, this represents the permission set of the associated API key
108
+ def target_permission_set
109
+ @attributes[:target_permission_set]
110
+ end
111
+
112
+ # string - If searching for Histories about API keys, this is the platform on which the action was taken
113
+ def target_platform
114
+ @attributes[:target_platform]
115
+ end
116
+
117
+ # string - If searching for Histories about API keys, this is the username on which the action was taken
118
+ def target_username
119
+ @attributes[:target_username]
120
+ end
121
+
122
+ # int64 - If searching for Histories about API keys, this is the User ID on which the action was taken
123
+ def target_user_id
124
+ @attributes[:target_user_id]
125
+ end
126
+
127
+ # Parameters:
128
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
129
+ # page - int64 - Current page number.
130
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
131
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
132
+ # 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.
133
+ # history_export_id (required) - int64 - ID of the associated history export.
134
+ def self.list(params = {}, options = {})
135
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
136
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
137
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
138
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
139
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
140
+ raise InvalidParameterError.new("Bad parameter: history_export_id must be an Integer") if params.dig(:history_export_id) and !params.dig(:history_export_id).is_a?(Integer)
141
+ raise MissingParameterError.new("Parameter missing: history_export_id") unless params.dig(:history_export_id)
142
+
143
+ List.new(HistoryExportResult, params) do
144
+ Api.send_request("/history_export_results", :get, params, options)
145
+ end
146
+ end
147
+
148
+ def self.all(params = {}, options = {})
149
+ list(params, options)
150
+ end
151
+ end
152
+ end