files.com 1.1.786 → 1.1.787
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/_VERSION +1 -1
- data/lib/files.com/api.rb +20 -5
- data/lib/files.com/api_client.rb +196 -17
- data/lib/files.com/list.rb +4 -2
- data/lib/files.com/models/action_log.rb +4 -1
- data/lib/files.com/models/action_notification_export.rb +3 -1
- data/lib/files.com/models/action_notification_export_result.rb +4 -1
- data/lib/files.com/models/ai_assistant_personality.rb +20 -7
- data/lib/files.com/models/ai_task.rb +22 -10
- data/lib/files.com/models/api_key.rb +15 -7
- data/lib/files.com/models/api_request_log.rb +4 -1
- data/lib/files.com/models/app.rb +4 -1
- data/lib/files.com/models/as2_incoming_message.rb +4 -1
- data/lib/files.com/models/as2_outgoing_message.rb +4 -1
- data/lib/files.com/models/as2_partner.rb +18 -7
- data/lib/files.com/models/as2_station.rb +14 -7
- data/lib/files.com/models/automation.rb +47 -13
- data/lib/files.com/models/automation_log.rb +4 -1
- data/lib/files.com/models/automation_run.rb +16 -9
- data/lib/files.com/models/bandwidth_snapshot.rb +4 -1
- data/lib/files.com/models/behavior.rb +27 -9
- data/lib/files.com/models/bundle.rb +57 -10
- data/lib/files.com/models/bundle_action.rb +4 -1
- data/lib/files.com/models/bundle_download.rb +4 -1
- data/lib/files.com/models/bundle_notification.rb +20 -7
- data/lib/files.com/models/bundle_recipient.rb +6 -1
- data/lib/files.com/models/bundle_registration.rb +4 -1
- data/lib/files.com/models/chat_session.rb +5 -2
- data/lib/files.com/models/child_site_management_policy.rb +18 -7
- data/lib/files.com/models/clickwrap.rb +14 -7
- data/lib/files.com/models/custom_domain.rb +18 -8
- data/lib/files.com/models/desktop_configuration_profile.rb +21 -7
- data/lib/files.com/models/dns_record.rb +4 -1
- data/lib/files.com/models/email_incoming_message.rb +4 -1
- data/lib/files.com/models/email_log.rb +4 -1
- data/lib/files.com/models/event_channel.rb +20 -7
- data/lib/files.com/models/event_delivery_attempt.rb +5 -2
- data/lib/files.com/models/event_record.rb +5 -2
- data/lib/files.com/models/event_subscription.rb +25 -7
- data/lib/files.com/models/event_target.rb +22 -7
- data/lib/files.com/models/exavault_api_request_log.rb +4 -1
- data/lib/files.com/models/expectation.rb +23 -10
- data/lib/files.com/models/expectation_evaluation.rb +5 -2
- data/lib/files.com/models/expectation_incident.rb +20 -11
- data/lib/files.com/models/external_event.rb +6 -2
- data/lib/files.com/models/file.rb +110 -37
- data/lib/files.com/models/file_comment.rb +14 -7
- data/lib/files.com/models/file_comment_reaction.rb +6 -3
- data/lib/files.com/models/file_migration.rb +1 -1
- data/lib/files.com/models/file_migration_log.rb +4 -1
- data/lib/files.com/models/folder.rb +11 -3
- data/lib/files.com/models/form_field_set.rb +26 -7
- data/lib/files.com/models/ftp_action_log.rb +4 -1
- data/lib/files.com/models/gpg_key.rb +15 -7
- data/lib/files.com/models/group.rb +30 -7
- data/lib/files.com/models/group_user.rb +16 -6
- data/lib/files.com/models/history.rb +23 -8
- data/lib/files.com/models/history_export.rb +2 -1
- data/lib/files.com/models/history_export_result.rb +4 -1
- data/lib/files.com/models/holiday_calendar.rb +15 -7
- data/lib/files.com/models/holiday_region.rb +4 -1
- data/lib/files.com/models/inbound_s3_log.rb +4 -1
- data/lib/files.com/models/inbox_recipient.rb +6 -1
- data/lib/files.com/models/inbox_registration.rb +4 -1
- data/lib/files.com/models/inbox_upload.rb +4 -1
- data/lib/files.com/models/integration_centric_profile.rb +17 -7
- data/lib/files.com/models/invoice.rb +5 -2
- data/lib/files.com/models/ip_address.rb +16 -4
- data/lib/files.com/models/key_lifecycle_rule.rb +17 -7
- data/lib/files.com/models/lock.rb +16 -6
- data/lib/files.com/models/metadata_category.rb +19 -9
- data/lib/files.com/models/notification.rb +39 -7
- data/lib/files.com/models/outbound_connection_log.rb +4 -1
- data/lib/files.com/models/partner.rb +32 -7
- data/lib/files.com/models/partner_channel.rb +17 -7
- data/lib/files.com/models/partner_channel_template.rb +17 -7
- data/lib/files.com/models/partner_site.rb +5 -3
- data/lib/files.com/models/partner_site_request.rb +10 -4
- data/lib/files.com/models/payment.rb +5 -2
- data/lib/files.com/models/pending_work_event.rb +5 -2
- data/lib/files.com/models/permission.rb +12 -4
- data/lib/files.com/models/public_hosting_request_log.rb +4 -1
- data/lib/files.com/models/public_key.rb +15 -7
- data/lib/files.com/models/remote_bandwidth_snapshot.rb +4 -1
- data/lib/files.com/models/remote_mount_backend.rb +25 -10
- data/lib/files.com/models/remote_server.rb +46 -14
- data/lib/files.com/models/remote_server_credential.rb +14 -7
- data/lib/files.com/models/request.rb +17 -6
- data/lib/files.com/models/restore.rb +8 -1
- data/lib/files.com/models/schedule.rb +14 -7
- data/lib/files.com/models/scheduled_export.rb +18 -7
- data/lib/files.com/models/scim_log.rb +5 -2
- data/lib/files.com/models/secret.rb +15 -7
- data/lib/files.com/models/session.rb +1 -0
- data/lib/files.com/models/settings_change.rb +4 -1
- data/lib/files.com/models/sftp_action_log.rb +4 -1
- data/lib/files.com/models/sftp_host_key.rb +17 -7
- data/lib/files.com/models/share_group.rb +14 -7
- data/lib/files.com/models/siem_http_destination.rb +67 -7
- data/lib/files.com/models/siem_http_destination_event.rb +5 -2
- data/lib/files.com/models/site.rb +109 -0
- data/lib/files.com/models/site_subdomain_redirect.rb +10 -5
- data/lib/files.com/models/snapshot.rb +19 -10
- data/lib/files.com/models/sso_event.rb +5 -2
- data/lib/files.com/models/sso_strategy.rb +10 -5
- data/lib/files.com/models/style.rb +9 -6
- data/lib/files.com/models/sync.rb +36 -13
- data/lib/files.com/models/sync_log.rb +4 -1
- data/lib/files.com/models/sync_run.rb +5 -2
- data/lib/files.com/models/usage_daily_snapshot.rb +4 -1
- data/lib/files.com/models/usage_snapshot.rb +4 -1
- data/lib/files.com/models/user.rb +124 -16
- data/lib/files.com/models/user_additional_email_recipient.rb +14 -7
- data/lib/files.com/models/user_cipher_use.rb +4 -1
- data/lib/files.com/models/user_lifecycle_rule.rb +26 -7
- data/lib/files.com/models/user_request.rb +11 -5
- data/lib/files.com/models/user_security_event.rb +5 -2
- data/lib/files.com/models/user_sftp_client_use.rb +4 -1
- data/lib/files.com/models/web_dav_action_log.rb +4 -1
- data/lib/files.com/models/webhook_test.rb +3 -0
- data/lib/files.com/models/workspace.rb +14 -7
- data/lib/files.com/util.rb +32 -1
- data/lib/files.com.rb +54 -1
- data/spec/lib/api_client_spec.rb +483 -0
- data/spec/list_spec.rb +31 -2
- data/spec/models/persistence_spec.rb +1 -1
- data/spec/models/user_spec.rb +20 -0
- metadata +2 -1
|
@@ -161,15 +161,19 @@ module Files
|
|
|
161
161
|
# user_tag - string - If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
162
162
|
# workspace_id - int64 - Workspace whose users the rule applies to. `0` means the Default Workspace. A Custom Workspace rule applies only to users who belong to that Workspace, regardless of access granted to other users.
|
|
163
163
|
def update(params = {})
|
|
164
|
-
params
|
|
164
|
+
params = (params || {}).dup
|
|
165
165
|
params[:id] = @attributes[:id]
|
|
166
166
|
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
|
167
167
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
168
168
|
raise InvalidParameterError.new("Bad parameter: action must be an String") if !params[:action].nil? and !params[:action].is_a?(String)
|
|
169
|
+
raise InvalidParameterError.new("Bad parameter: apply_to_all_workspaces must be a single value, not #{params[:apply_to_all_workspaces].class}") if [ Array, Hash ].any? { |klass| params[:apply_to_all_workspaces].is_a?(klass) }
|
|
169
170
|
raise InvalidParameterError.new("Bad parameter: authentication_method must be an String") if !params[:authentication_method].nil? and !params[:authentication_method].is_a?(String)
|
|
170
171
|
raise InvalidParameterError.new("Bad parameter: group_ids must be an Array") if !params[:group_ids].nil? and !params[:group_ids].is_a?(Array)
|
|
171
172
|
raise InvalidParameterError.new("Bad parameter: inactivity_days must be an Integer") if !params[:inactivity_days].nil? and !params[:inactivity_days].is_a?(Integer)
|
|
173
|
+
raise InvalidParameterError.new("Bad parameter: include_site_admins must be a single value, not #{params[:include_site_admins].class}") if [ Array, Hash ].any? { |klass| params[:include_site_admins].is_a?(klass) }
|
|
174
|
+
raise InvalidParameterError.new("Bad parameter: include_folder_admins must be a single value, not #{params[:include_folder_admins].class}") if [ Array, Hash ].any? { |klass| params[:include_folder_admins].is_a?(klass) }
|
|
172
175
|
raise InvalidParameterError.new("Bad parameter: name must be an String") if !params[:name].nil? and !params[:name].is_a?(String)
|
|
176
|
+
raise InvalidParameterError.new("Bad parameter: notify_users must be a single value, not #{params[:notify_users].class}") if [ Array, Hash ].any? { |klass| params[:notify_users].is_a?(klass) }
|
|
173
177
|
raise InvalidParameterError.new("Bad parameter: partner_tag must be an String") if !params[:partner_tag].nil? and !params[:partner_tag].is_a?(String)
|
|
174
178
|
raise InvalidParameterError.new("Bad parameter: user_state must be an String") if !params[:user_state].nil? and !params[:user_state].is_a?(String)
|
|
175
179
|
raise InvalidParameterError.new("Bad parameter: user_tag must be an String") if !params[:user_tag].nil? and !params[:user_tag].is_a?(String)
|
|
@@ -178,18 +182,21 @@ module Files
|
|
|
178
182
|
|
|
179
183
|
response, options = Api.send_request("/user_lifecycle_rules/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("UserLifecycleRule") }
|
|
180
184
|
@attributes = response.data
|
|
185
|
+
@options = @options.merge(options)
|
|
181
186
|
[ response, options ]
|
|
182
187
|
end
|
|
183
188
|
|
|
184
189
|
# Returns the [response, options] pair from Files::Api.send_request.
|
|
185
190
|
def delete(params = {})
|
|
186
|
-
params
|
|
191
|
+
params = (params || {}).dup
|
|
187
192
|
params[:id] = @attributes[:id]
|
|
188
193
|
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
|
189
194
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
190
195
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
|
191
196
|
|
|
192
|
-
Api.send_request("/user_lifecycle_rules/#{@attributes[:id]}", :delete, params, @options)
|
|
197
|
+
response, options = Api.send_request("/user_lifecycle_rules/#{@attributes[:id]}", :delete, params, @options)
|
|
198
|
+
@options = @options.merge(options)
|
|
199
|
+
[ response, options ]
|
|
193
200
|
end
|
|
194
201
|
|
|
195
202
|
# Alias for #delete. Returns nil.
|
|
@@ -204,6 +211,7 @@ module Files
|
|
|
204
211
|
else
|
|
205
212
|
new_obj = UserLifecycleRule.create(@attributes, @options)
|
|
206
213
|
@attributes = new_obj.attributes
|
|
214
|
+
@options = @options.merge(new_obj.options)
|
|
207
215
|
end
|
|
208
216
|
|
|
209
217
|
true
|
|
@@ -225,8 +233,11 @@ module Files
|
|
|
225
233
|
raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if !params[:sort_by].nil? and !params[:sort_by].is_a?(Hash)
|
|
226
234
|
raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if !params[:filter].nil? and !params[:filter].is_a?(Hash)
|
|
227
235
|
|
|
236
|
+
list_options = options.dup
|
|
228
237
|
List.new(UserLifecycleRule, params) do |page_params, &check_page|
|
|
229
|
-
Api.send_request("/user_lifecycle_rules", :get, page_params,
|
|
238
|
+
response, page_options = Api.send_request("/user_lifecycle_rules", :get, page_params, list_options, &check_page)
|
|
239
|
+
list_options = list_options.merge(page_options)
|
|
240
|
+
[ response, page_options ]
|
|
230
241
|
end
|
|
231
242
|
end
|
|
232
243
|
|
|
@@ -242,7 +253,7 @@ module Files
|
|
|
242
253
|
#
|
|
243
254
|
# Returns a Files::UserLifecycleRule.
|
|
244
255
|
def self.find(id, params = {}, options = {})
|
|
245
|
-
params
|
|
256
|
+
params = (params || {}).dup
|
|
246
257
|
params[:id] = id
|
|
247
258
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
248
259
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
|
@@ -276,10 +287,14 @@ module Files
|
|
|
276
287
|
# Returns a Files::UserLifecycleRule.
|
|
277
288
|
def self.create(params = {}, options = {})
|
|
278
289
|
raise InvalidParameterError.new("Bad parameter: action must be an String") if !params[:action].nil? and !params[:action].is_a?(String)
|
|
290
|
+
raise InvalidParameterError.new("Bad parameter: apply_to_all_workspaces must be a single value, not #{params[:apply_to_all_workspaces].class}") if [ Array, Hash ].any? { |klass| params[:apply_to_all_workspaces].is_a?(klass) }
|
|
279
291
|
raise InvalidParameterError.new("Bad parameter: authentication_method must be an String") if !params[:authentication_method].nil? and !params[:authentication_method].is_a?(String)
|
|
280
292
|
raise InvalidParameterError.new("Bad parameter: group_ids must be an Array") if !params[:group_ids].nil? and !params[:group_ids].is_a?(Array)
|
|
281
293
|
raise InvalidParameterError.new("Bad parameter: inactivity_days must be an Integer") if !params[:inactivity_days].nil? and !params[:inactivity_days].is_a?(Integer)
|
|
294
|
+
raise InvalidParameterError.new("Bad parameter: include_site_admins must be a single value, not #{params[:include_site_admins].class}") if [ Array, Hash ].any? { |klass| params[:include_site_admins].is_a?(klass) }
|
|
295
|
+
raise InvalidParameterError.new("Bad parameter: include_folder_admins must be a single value, not #{params[:include_folder_admins].class}") if [ Array, Hash ].any? { |klass| params[:include_folder_admins].is_a?(klass) }
|
|
282
296
|
raise InvalidParameterError.new("Bad parameter: name must be an String") if !params[:name].nil? and !params[:name].is_a?(String)
|
|
297
|
+
raise InvalidParameterError.new("Bad parameter: notify_users must be a single value, not #{params[:notify_users].class}") if [ Array, Hash ].any? { |klass| params[:notify_users].is_a?(klass) }
|
|
283
298
|
raise InvalidParameterError.new("Bad parameter: partner_tag must be an String") if !params[:partner_tag].nil? and !params[:partner_tag].is_a?(String)
|
|
284
299
|
raise InvalidParameterError.new("Bad parameter: user_state must be an String") if !params[:user_state].nil? and !params[:user_state].is_a?(String)
|
|
285
300
|
raise InvalidParameterError.new("Bad parameter: user_tag must be an String") if !params[:user_tag].nil? and !params[:user_tag].is_a?(String)
|
|
@@ -309,14 +324,18 @@ module Files
|
|
|
309
324
|
#
|
|
310
325
|
# Returns a Files::UserLifecycleRule.
|
|
311
326
|
def self.update(id, params = {}, options = {})
|
|
312
|
-
params
|
|
327
|
+
params = (params || {}).dup
|
|
313
328
|
params[:id] = id
|
|
314
329
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
315
330
|
raise InvalidParameterError.new("Bad parameter: action must be an String") if !params[:action].nil? and !params[:action].is_a?(String)
|
|
331
|
+
raise InvalidParameterError.new("Bad parameter: apply_to_all_workspaces must be a single value, not #{params[:apply_to_all_workspaces].class}") if [ Array, Hash ].any? { |klass| params[:apply_to_all_workspaces].is_a?(klass) }
|
|
316
332
|
raise InvalidParameterError.new("Bad parameter: authentication_method must be an String") if !params[:authentication_method].nil? and !params[:authentication_method].is_a?(String)
|
|
317
333
|
raise InvalidParameterError.new("Bad parameter: group_ids must be an Array") if !params[:group_ids].nil? and !params[:group_ids].is_a?(Array)
|
|
318
334
|
raise InvalidParameterError.new("Bad parameter: inactivity_days must be an Integer") if !params[:inactivity_days].nil? and !params[:inactivity_days].is_a?(Integer)
|
|
335
|
+
raise InvalidParameterError.new("Bad parameter: include_site_admins must be a single value, not #{params[:include_site_admins].class}") if [ Array, Hash ].any? { |klass| params[:include_site_admins].is_a?(klass) }
|
|
336
|
+
raise InvalidParameterError.new("Bad parameter: include_folder_admins must be a single value, not #{params[:include_folder_admins].class}") if [ Array, Hash ].any? { |klass| params[:include_folder_admins].is_a?(klass) }
|
|
319
337
|
raise InvalidParameterError.new("Bad parameter: name must be an String") if !params[:name].nil? and !params[:name].is_a?(String)
|
|
338
|
+
raise InvalidParameterError.new("Bad parameter: notify_users must be a single value, not #{params[:notify_users].class}") if [ Array, Hash ].any? { |klass| params[:notify_users].is_a?(klass) }
|
|
320
339
|
raise InvalidParameterError.new("Bad parameter: partner_tag must be an String") if !params[:partner_tag].nil? and !params[:partner_tag].is_a?(String)
|
|
321
340
|
raise InvalidParameterError.new("Bad parameter: user_state must be an String") if !params[:user_state].nil? and !params[:user_state].is_a?(String)
|
|
322
341
|
raise InvalidParameterError.new("Bad parameter: user_tag must be an String") if !params[:user_tag].nil? and !params[:user_tag].is_a?(String)
|
|
@@ -332,7 +351,7 @@ module Files
|
|
|
332
351
|
#
|
|
333
352
|
# Returns nil.
|
|
334
353
|
def self.delete(id, params = {}, options = {})
|
|
335
|
-
params
|
|
354
|
+
params = (params || {}).dup
|
|
336
355
|
params[:id] = id
|
|
337
356
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
338
357
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
|
@@ -58,13 +58,15 @@ module Files
|
|
|
58
58
|
|
|
59
59
|
# Returns the [response, options] pair from Files::Api.send_request.
|
|
60
60
|
def delete(params = {})
|
|
61
|
-
params
|
|
61
|
+
params = (params || {}).dup
|
|
62
62
|
params[:id] = @attributes[:id]
|
|
63
63
|
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
|
64
64
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
65
65
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
|
66
66
|
|
|
67
|
-
Api.send_request("/user_requests/#{@attributes[:id]}", :delete, params, @options)
|
|
67
|
+
response, options = Api.send_request("/user_requests/#{@attributes[:id]}", :delete, params, @options)
|
|
68
|
+
@options = @options.merge(options)
|
|
69
|
+
[ response, options ]
|
|
68
70
|
end
|
|
69
71
|
|
|
70
72
|
# Alias for #delete. Returns nil.
|
|
@@ -79,6 +81,7 @@ module Files
|
|
|
79
81
|
else
|
|
80
82
|
new_obj = UserRequest.create(@attributes, @options)
|
|
81
83
|
@attributes = new_obj.attributes
|
|
84
|
+
@options = @options.merge(new_obj.options)
|
|
82
85
|
end
|
|
83
86
|
|
|
84
87
|
true
|
|
@@ -96,8 +99,11 @@ module Files
|
|
|
96
99
|
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if !params[:cursor].nil? and !params[:cursor].is_a?(String)
|
|
97
100
|
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if !params[:per_page].nil? and !params[:per_page].is_a?(Integer)
|
|
98
101
|
|
|
102
|
+
list_options = options.dup
|
|
99
103
|
List.new(UserRequest, params) do |page_params, &check_page|
|
|
100
|
-
Api.send_request("/user_requests", :get, page_params,
|
|
104
|
+
response, page_options = Api.send_request("/user_requests", :get, page_params, list_options, &check_page)
|
|
105
|
+
list_options = list_options.merge(page_options)
|
|
106
|
+
[ response, page_options ]
|
|
101
107
|
end
|
|
102
108
|
end
|
|
103
109
|
|
|
@@ -113,7 +119,7 @@ module Files
|
|
|
113
119
|
#
|
|
114
120
|
# Returns a Files::UserRequest.
|
|
115
121
|
def self.find(id, params = {}, options = {})
|
|
116
|
-
params
|
|
122
|
+
params = (params || {}).dup
|
|
117
123
|
params[:id] = id
|
|
118
124
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
119
125
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
|
@@ -154,7 +160,7 @@ module Files
|
|
|
154
160
|
#
|
|
155
161
|
# Returns nil.
|
|
156
162
|
def self.delete(id, params = {}, options = {})
|
|
157
|
-
params
|
|
163
|
+
params = (params || {}).dup
|
|
158
164
|
params[:id] = id
|
|
159
165
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
160
166
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
|
@@ -70,8 +70,11 @@ module Files
|
|
|
70
70
|
raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if !params[:filter_lt].nil? and !params[:filter_lt].is_a?(Hash)
|
|
71
71
|
raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if !params[:filter_lteq].nil? and !params[:filter_lteq].is_a?(Hash)
|
|
72
72
|
|
|
73
|
+
list_options = options.dup
|
|
73
74
|
List.new(UserSecurityEvent, params) do |page_params, &check_page|
|
|
74
|
-
Api.send_request("/user_security_events", :get, page_params,
|
|
75
|
+
response, page_options = Api.send_request("/user_security_events", :get, page_params, list_options, &check_page)
|
|
76
|
+
list_options = list_options.merge(page_options)
|
|
77
|
+
[ response, page_options ]
|
|
75
78
|
end
|
|
76
79
|
end
|
|
77
80
|
|
|
@@ -87,7 +90,7 @@ module Files
|
|
|
87
90
|
#
|
|
88
91
|
# Returns a Files::UserSecurityEvent.
|
|
89
92
|
def self.find(id, params = {}, options = {})
|
|
90
|
-
params
|
|
93
|
+
params = (params || {}).dup
|
|
91
94
|
params[:id] = id
|
|
92
95
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
93
96
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
|
@@ -52,8 +52,11 @@ module Files
|
|
|
52
52
|
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if !params[:per_page].nil? and !params[:per_page].is_a?(Integer)
|
|
53
53
|
raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if !params[:sort_by].nil? and !params[:sort_by].is_a?(Hash)
|
|
54
54
|
|
|
55
|
+
list_options = options.dup
|
|
55
56
|
List.new(UserSftpClientUse, params) do |page_params, &check_page|
|
|
56
|
-
Api.send_request("/user_sftp_client_uses", :get, page_params,
|
|
57
|
+
response, page_options = Api.send_request("/user_sftp_client_uses", :get, page_params, list_options, &check_page)
|
|
58
|
+
list_options = list_options.merge(page_options)
|
|
59
|
+
[ response, page_options ]
|
|
57
60
|
end
|
|
58
61
|
end
|
|
59
62
|
|
|
@@ -125,8 +125,11 @@ module Files
|
|
|
125
125
|
raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if !params[:filter_lt].nil? and !params[:filter_lt].is_a?(Hash)
|
|
126
126
|
raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if !params[:filter_lteq].nil? and !params[:filter_lteq].is_a?(Hash)
|
|
127
127
|
|
|
128
|
+
list_options = options.dup
|
|
128
129
|
List.new(WebDavActionLog, params) do |page_params, &check_page|
|
|
129
|
-
Api.send_request("/web_dav_action_logs", :get, page_params,
|
|
130
|
+
response, page_options = Api.send_request("/web_dav_action_logs", :get, page_params, list_options, &check_page)
|
|
131
|
+
list_options = list_options.merge(page_options)
|
|
132
|
+
[ response, page_options ]
|
|
130
133
|
end
|
|
131
134
|
end
|
|
132
135
|
|
|
@@ -152,6 +152,7 @@ module Files
|
|
|
152
152
|
else
|
|
153
153
|
new_obj = WebhookTest.create(@attributes, @options)
|
|
154
154
|
@attributes = new_obj.attributes
|
|
155
|
+
@options = @options.merge(new_obj.options)
|
|
155
156
|
end
|
|
156
157
|
|
|
157
158
|
true
|
|
@@ -180,8 +181,10 @@ module Files
|
|
|
180
181
|
raise InvalidParameterError.new("Bad parameter: headers must be an Hash") if !params[:headers].nil? and !params[:headers].is_a?(Hash)
|
|
181
182
|
raise InvalidParameterError.new("Bad parameter: body must be an Hash") if !params[:body].nil? and !params[:body].is_a?(Hash)
|
|
182
183
|
raise InvalidParameterError.new("Bad parameter: raw_body must be an String") if !params[:raw_body].nil? and !params[:raw_body].is_a?(String)
|
|
184
|
+
raise InvalidParameterError.new("Bad parameter: file_as_body must be a single value, not #{params[:file_as_body].class}") if [ Array, Hash ].any? { |klass| params[:file_as_body].is_a?(klass) }
|
|
183
185
|
raise InvalidParameterError.new("Bad parameter: file_form_field must be an String") if !params[:file_form_field].nil? and !params[:file_form_field].is_a?(String)
|
|
184
186
|
raise InvalidParameterError.new("Bad parameter: action must be an String") if !params[:action].nil? and !params[:action].is_a?(String)
|
|
187
|
+
raise InvalidParameterError.new("Bad parameter: use_dedicated_ips must be a single value, not #{params[:use_dedicated_ips].class}") if [ Array, Hash ].any? { |klass| params[:use_dedicated_ips].is_a?(klass) }
|
|
185
188
|
raise MissingParameterError.new("Parameter missing: url") if params[:url].nil?
|
|
186
189
|
|
|
187
190
|
response, options = Api.send_request("/webhook_tests", :post, params, options) { |reply| reply.require_object("WebhookTest") }
|
|
@@ -32,7 +32,7 @@ module Files
|
|
|
32
32
|
# Parameters:
|
|
33
33
|
# name - string - Workspace name
|
|
34
34
|
def update(params = {})
|
|
35
|
-
params
|
|
35
|
+
params = (params || {}).dup
|
|
36
36
|
params[:id] = @attributes[:id]
|
|
37
37
|
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
|
38
38
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
@@ -41,18 +41,21 @@ module Files
|
|
|
41
41
|
|
|
42
42
|
response, options = Api.send_request("/workspaces/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("Workspace") }
|
|
43
43
|
@attributes = response.data
|
|
44
|
+
@options = @options.merge(options)
|
|
44
45
|
[ response, options ]
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
# Returns the [response, options] pair from Files::Api.send_request.
|
|
48
49
|
def delete(params = {})
|
|
49
|
-
params
|
|
50
|
+
params = (params || {}).dup
|
|
50
51
|
params[:id] = @attributes[:id]
|
|
51
52
|
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
|
52
53
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
53
54
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
|
54
55
|
|
|
55
|
-
Api.send_request("/workspaces/#{@attributes[:id]}", :delete, params, @options)
|
|
56
|
+
response, options = Api.send_request("/workspaces/#{@attributes[:id]}", :delete, params, @options)
|
|
57
|
+
@options = @options.merge(options)
|
|
58
|
+
[ response, options ]
|
|
56
59
|
end
|
|
57
60
|
|
|
58
61
|
# Alias for #delete. Returns nil.
|
|
@@ -67,6 +70,7 @@ module Files
|
|
|
67
70
|
else
|
|
68
71
|
new_obj = Workspace.create(@attributes, @options)
|
|
69
72
|
@attributes = new_obj.attributes
|
|
73
|
+
@options = @options.merge(new_obj.options)
|
|
70
74
|
end
|
|
71
75
|
|
|
72
76
|
true
|
|
@@ -90,8 +94,11 @@ module Files
|
|
|
90
94
|
raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if !params[:filter].nil? and !params[:filter].is_a?(Hash)
|
|
91
95
|
raise InvalidParameterError.new("Bad parameter: filter_prefix must be an Hash") if !params[:filter_prefix].nil? and !params[:filter_prefix].is_a?(Hash)
|
|
92
96
|
|
|
97
|
+
list_options = options.dup
|
|
93
98
|
List.new(Workspace, params) do |page_params, &check_page|
|
|
94
|
-
Api.send_request("/workspaces", :get, page_params,
|
|
99
|
+
response, page_options = Api.send_request("/workspaces", :get, page_params, list_options, &check_page)
|
|
100
|
+
list_options = list_options.merge(page_options)
|
|
101
|
+
[ response, page_options ]
|
|
95
102
|
end
|
|
96
103
|
end
|
|
97
104
|
|
|
@@ -107,7 +114,7 @@ module Files
|
|
|
107
114
|
#
|
|
108
115
|
# Returns a Files::Workspace.
|
|
109
116
|
def self.find(id, params = {}, options = {})
|
|
110
|
-
params
|
|
117
|
+
params = (params || {}).dup
|
|
111
118
|
params[:id] = id
|
|
112
119
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
113
120
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
|
@@ -142,7 +149,7 @@ module Files
|
|
|
142
149
|
#
|
|
143
150
|
# Returns a Files::Workspace.
|
|
144
151
|
def self.update(id, params = {}, options = {})
|
|
145
|
-
params
|
|
152
|
+
params = (params || {}).dup
|
|
146
153
|
params[:id] = id
|
|
147
154
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
148
155
|
raise InvalidParameterError.new("Bad parameter: name must be an String") if !params[:name].nil? and !params[:name].is_a?(String)
|
|
@@ -157,7 +164,7 @@ module Files
|
|
|
157
164
|
#
|
|
158
165
|
# Returns nil.
|
|
159
166
|
def self.delete(id, params = {}, options = {})
|
|
160
|
-
params
|
|
167
|
+
params = (params || {}).dup
|
|
161
168
|
params[:id] = id
|
|
162
169
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if !params[:id].nil? and !params[:id].is_a?(Integer)
|
|
163
170
|
raise MissingParameterError.new("Parameter missing: id") if params[:id].nil?
|
data/lib/files.com/util.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Files
|
|
4
4
|
module Util
|
|
5
|
-
OPTS = Set[:api_key, :client, :session_id, :workspace_id].freeze
|
|
5
|
+
OPTS = Set[:api_key, :base_url, :client, :region_http_pairs, :session_id, :workspace_id].freeze
|
|
6
6
|
COLOR_CODES = {
|
|
7
7
|
black: 0, light_black: 60,
|
|
8
8
|
red: 1, light_red: 61,
|
|
@@ -53,6 +53,37 @@ module Files
|
|
|
53
53
|
val
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
# The http:// origin +value+ names, written as http://, its lowercase host and a port only when it is not 80, or
|
|
57
|
+
# nil when +value+ is not a plain http:// origin: a host name or IP address with an empty or "/" path and no
|
|
58
|
+
# credentials, query, fragment, spaces or backslashes.
|
|
59
|
+
def self.http_origin(value)
|
|
60
|
+
return unless value.is_a?(String) && !value.match?(/[[:space:][:cntrl:]\\]/) && value.match?(/\Ahttp:\/\/[^\/?#@]+\/?\z/i)
|
|
61
|
+
|
|
62
|
+
uri = Addressable::URI.parse(value)
|
|
63
|
+
host = uri.normalized_host.to_s
|
|
64
|
+
port = uri.port || 80
|
|
65
|
+
return unless port.between?(1, 65_535) && host.match?(/\A(\[[0-9a-f:.]+\]|[a-z0-9]([a-z0-9.-]*[a-z0-9])?)\z/)
|
|
66
|
+
|
|
67
|
+
port == 80 ? "http://#{host}" : "http://#{host}:#{port}"
|
|
68
|
+
rescue Addressable::URI::InvalidURIError, ArgumentError
|
|
69
|
+
nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# A frozen copy of +pairs+ for Files.region_http_pairs= and the region_http_pairs option of a Files::ApiClient or a
|
|
73
|
+
# request, made of new Arrays and Strings, so the caller's are neither kept nor changed. Raises ArgumentError unless
|
|
74
|
+
# +pairs+ is an Array of [source, destination] Arrays of two origins already written the way http_origin writes them.
|
|
75
|
+
def self.checked_region_http_pairs(pairs)
|
|
76
|
+
message = "region_http_pairs should be an Array of [source, destination] Arrays of http:// origins, each with a lowercase host, a port only when it is not 80 and no path"
|
|
77
|
+
raise ArgumentError, message unless pairs.is_a?(Array)
|
|
78
|
+
|
|
79
|
+
pairs.map do |pair|
|
|
80
|
+
origins = pair.is_a?(Array) ? pair.map { |origin| http_origin(origin) } : []
|
|
81
|
+
raise ArgumentError, message unless origins.length == 2 && origins.all? && origins == pair
|
|
82
|
+
|
|
83
|
+
origins.each(&:freeze).freeze
|
|
84
|
+
end.freeze
|
|
85
|
+
end
|
|
86
|
+
|
|
56
87
|
def self.log_error(message, data = {}, settings = global_log_settings)
|
|
57
88
|
if !settings.logger.nil? ||
|
|
58
89
|
(!settings.log_level.nil? && settings.log_level <= Files::LEVEL_ERROR)
|
data/lib/files.com.rb
CHANGED
|
@@ -190,6 +190,9 @@ module Files
|
|
|
190
190
|
@log_level = nil
|
|
191
191
|
@logger = nil
|
|
192
192
|
@proxy = nil
|
|
193
|
+
@region_handler = nil
|
|
194
|
+
@region_http_pairs = [].freeze
|
|
195
|
+
@region_policy = :automatic
|
|
193
196
|
@session_id = nil
|
|
194
197
|
@workspace_id = nil
|
|
195
198
|
@default_headers = nil
|
|
@@ -203,7 +206,7 @@ module Files
|
|
|
203
206
|
|
|
204
207
|
class << self
|
|
205
208
|
attr_accessor :api_key, :base_url, :default_headers, :initial_network_retry_delay, :language, :max_network_retry_delay, :proxy, :session_id, :workspace_id
|
|
206
|
-
attr_reader :open_timeout, :read_timeout
|
|
209
|
+
attr_reader :open_timeout, :read_timeout, :region_handler, :region_http_pairs, :region_policy
|
|
207
210
|
end
|
|
208
211
|
|
|
209
212
|
# map to the same values as the standard library's logger
|
|
@@ -281,6 +284,56 @@ module Files
|
|
|
281
284
|
raise ArgumentError, "#{name} should be nil or a number of seconds from 0 to #{MAX_TIMEOUT}"
|
|
282
285
|
end
|
|
283
286
|
|
|
287
|
+
# What a request does when the API answers that the site must be reached through another origin, such as its
|
|
288
|
+
# region or its custom domain (Files::LockoutRegionMismatchError, with that origin in data[:host]).
|
|
289
|
+
#
|
|
290
|
+
# :automatic (the default) sends the same request once more to that origin, within the same retry count, and keeps
|
|
291
|
+
# using it for the records and pages the request returns. Other requests still start at Files.base_url. It does so
|
|
292
|
+
# only for an error that came over verified HTTPS from the configured base URL through the SDK's own connection, and
|
|
293
|
+
# only to an https:// origin on a DNS name at port 443 that is not a local or Files.com development name, unless
|
|
294
|
+
# region_handler approves another. The only exception is plain HTTP from the source to the destination of a
|
|
295
|
+
# region_http_pairs pair. :disabled raises the error instead, so you can update your own settings and retry.
|
|
296
|
+
def self.region_policy=(policy)
|
|
297
|
+
raise ArgumentError, "region_policy should be :automatic or :disabled" unless %i[automatic disabled].include?(policy)
|
|
298
|
+
|
|
299
|
+
@region_policy = policy
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Pairs of http:// origins, each letting a lockout region mismatch move a request from the first to the second over
|
|
303
|
+
# plain HTTP, for your own local development servers only. Plain HTTP is intentionally insecure: it sends the API key
|
|
304
|
+
# or session unencrypted to whatever answers, and a pair is your explicit choice, never a verified or trusted origin.
|
|
305
|
+
# Each pair is [source, destination], such as [["http://localhost:3000", "http://site.localhost:3000"]].
|
|
306
|
+
#
|
|
307
|
+
# With region_policy :automatic, a request to the source (Files.base_url, or the request's own base_url) that gets
|
|
308
|
+
# the error with data[:host] naming the destination, as that full http:// origin or as its bare host (with its port
|
|
309
|
+
# when it is not 80), is sent once more to the destination, within the same retry count, and the records and pages
|
|
310
|
+
# it returns keep using it. region_handler, when set, is still asked first and can decline. Nothing else continues
|
|
311
|
+
# over plain HTTP, a request to an https:// origin never does, and :disabled still raises the error.
|
|
312
|
+
#
|
|
313
|
+
# Write each origin as http://, a lowercase host name or IP address, a port only when it is not 80 and no path.
|
|
314
|
+
# The default, [], allows none. The SDK keeps a frozen copy, so changing the Arrays or Strings you passed has no
|
|
315
|
+
# effect. Each request fixes its pairs before it starts: its own region_http_pairs option if it has one, otherwise
|
|
316
|
+
# those of a Files::ApiClient created with its own region_http_pairs, otherwise this setting. The records and pages
|
|
317
|
+
# it returns keep those pairs in their options, so their own requests use them even after this setting changes;
|
|
318
|
+
# other requests use the setting as it is when they start.
|
|
319
|
+
def self.region_http_pairs=(pairs)
|
|
320
|
+
@region_http_pairs = Util.checked_region_http_pairs(pairs)
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
# An optional object with a call method that decides each move to another origin. It receives a frozen Hash with
|
|
324
|
+
# :reason (:lockout_region_mismatch), :original_origin, :target_origin and :approval_required (true for an IP
|
|
325
|
+
# address, a localhost, .local, files.test or filesrails.test name, a name without a dot or a port other than 443).
|
|
326
|
+
# It returns true to continue at the target origin; another https:// origin in the same form (lowercase host, a port
|
|
327
|
+
# only when it is not 443, no path) to continue there instead, which the SDK checks like the target; or false or nil
|
|
328
|
+
# to raise the error. An error it raises stops the request. It cannot make a request continue from an error the SDK
|
|
329
|
+
# does not trust. For a move between region_http_pairs origins, :approval_required is false, since the pair already
|
|
330
|
+
# allows it, and another origin it returns must be a destination paired with the same source, written as in the pairs.
|
|
331
|
+
def self.region_handler=(handler)
|
|
332
|
+
raise ArgumentError, "region_handler should be nil or respond to call" unless handler.nil? || handler.respond_to?(:call)
|
|
333
|
+
|
|
334
|
+
@region_handler = handler
|
|
335
|
+
end
|
|
336
|
+
|
|
284
337
|
def self.session=(session)
|
|
285
338
|
session.save unless session.id
|
|
286
339
|
self.session_id = session.id
|