files.com 1.0.123 → 1.0.128

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/_VERSION +1 -1
  3. data/docs/account_line_item.md +18 -2
  4. data/docs/api_key.md +1 -1
  5. data/docs/app.md +3 -1
  6. data/docs/automation.md +51 -16
  7. data/docs/bandwidth_snapshot.md +5 -1
  8. data/docs/behavior.md +2 -2
  9. data/docs/bundle.md +40 -2
  10. data/docs/bundle_download.md +5 -1
  11. data/docs/bundle_recipient.md +7 -0
  12. data/docs/bundle_registration.md +23 -0
  13. data/docs/external_event.md +1 -1
  14. data/docs/file.md +7 -1
  15. data/docs/file_action.md +13 -0
  16. data/docs/file_comment.md +4 -1
  17. data/docs/folder.md +7 -1
  18. data/docs/form_field.md +29 -0
  19. data/docs/form_field_set.md +154 -0
  20. data/docs/group.md +13 -7
  21. data/docs/group_user.md +1 -1
  22. data/docs/history.md +1 -1
  23. data/docs/inbox_registration.md +21 -0
  24. data/docs/inbox_upload.md +35 -0
  25. data/docs/invoice.md +18 -2
  26. data/docs/ip_address.md +1 -1
  27. data/docs/message.md +10 -1
  28. data/docs/message_comment.md +4 -1
  29. data/docs/notification.md +1 -1
  30. data/docs/payment.md +18 -2
  31. data/docs/permission.md +1 -1
  32. data/docs/request.md +2 -2
  33. data/docs/settings_change.md +1 -1
  34. data/docs/site.md +91 -7
  35. data/docs/sso_strategy.md +1 -1
  36. data/docs/status.md +7 -0
  37. data/docs/style.md +1 -1
  38. data/docs/usage_daily_snapshot.md +1 -1
  39. data/docs/user.md +8 -8
  40. data/lib/files.com.rb +5 -0
  41. data/lib/files.com/models/api_key.rb +1 -1
  42. data/lib/files.com/models/automation.rb +60 -31
  43. data/lib/files.com/models/bandwidth_snapshot.rb +11 -1
  44. data/lib/files.com/models/behavior.rb +2 -2
  45. data/lib/files.com/models/bundle.rb +29 -1
  46. data/lib/files.com/models/bundle_download.rb +7 -2
  47. data/lib/files.com/models/bundle_recipient.rb +14 -0
  48. data/lib/files.com/models/bundle_registration.rb +47 -0
  49. data/lib/files.com/models/external_event.rb +1 -1
  50. data/lib/files.com/models/file_action.rb +14 -4
  51. data/lib/files.com/models/form_field.rb +52 -0
  52. data/lib/files.com/models/form_field_set.rb +171 -0
  53. data/lib/files.com/models/group.rb +1 -1
  54. data/lib/files.com/models/history.rb +1 -1
  55. data/lib/files.com/models/inbox_registration.rb +42 -0
  56. data/lib/files.com/models/inbox_upload.rb +46 -0
  57. data/lib/files.com/models/notification.rb +1 -1
  58. data/lib/files.com/models/permission.rb +1 -1
  59. data/lib/files.com/models/request.rb +2 -2
  60. data/lib/files.com/models/settings_change.rb +1 -1
  61. data/lib/files.com/models/usage_daily_snapshot.rb +1 -1
  62. data/lib/files.com/models/user.rb +7 -7
  63. metadata +12 -2
@@ -24,6 +24,16 @@ module Files
24
24
  @attributes[:bytes_sent]
25
25
  end
26
26
 
27
+ # double - Site sync bandwidth report bytes received
28
+ def sync_bytes_received
29
+ @attributes[:sync_bytes_received]
30
+ end
31
+
32
+ # double - Site sync bandwidth report bytes sent
33
+ def sync_bytes_sent
34
+ @attributes[:sync_bytes_sent]
35
+ end
36
+
27
37
  # double - Site bandwidth report get requests
28
38
  def requests_get
29
39
  @attributes[:requests_get]
@@ -57,7 +67,7 @@ module Files
57
67
  # Parameters:
58
68
  # cursor - string - Used for pagination. Send a cursor value 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.
59
69
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
60
- # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id` and `logged_at`.
70
+ # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `logged_at`.
61
71
  # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `logged_at`.
62
72
  # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `logged_at`.
63
73
  # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `logged_at`.
@@ -107,7 +107,7 @@ module Files
107
107
  # Parameters:
108
108
  # cursor - string - Used for pagination. Send a cursor value 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.
109
109
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
110
- # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id` and `behavior`.
110
+ # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `behavior`.
111
111
  # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `behavior`.
112
112
  # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `behavior`.
113
113
  # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `behavior`.
@@ -155,7 +155,7 @@ module Files
155
155
  # Parameters:
156
156
  # cursor - string - Used for pagination. Send a cursor value 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.
157
157
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
158
- # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id` and `behavior`.
158
+ # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `behavior`.
159
159
  # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `behavior`.
160
160
  # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `behavior`.
161
161
  # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `behavior`.
@@ -72,6 +72,15 @@ module Files
72
72
  @attributes[:clickwrap_body] = value
73
73
  end
74
74
 
75
+ # Custom Form to use
76
+ def form_field_set
77
+ @attributes[:form_field_set]
78
+ end
79
+
80
+ def form_field_set=(value)
81
+ @attributes[:form_field_set] = value
82
+ end
83
+
75
84
  # int64 - Bundle ID
76
85
  def id
77
86
  @attributes[:id]
@@ -176,6 +185,15 @@ module Files
176
185
  @attributes[:password] = value
177
186
  end
178
187
 
188
+ # int64 - Id of Form Field Set to use with this bundle
189
+ def form_field_set_id
190
+ @attributes[:form_field_set_id]
191
+ end
192
+
193
+ def form_field_set_id=(value)
194
+ @attributes[:form_field_set_id] = value
195
+ end
196
+
179
197
  # Send email(s) with a link to bundle
180
198
  #
181
199
  # Parameters:
@@ -197,7 +215,9 @@ module Files
197
215
  end
198
216
 
199
217
  # Parameters:
218
+ # paths - array(string) - A list of paths to include in this bundle.
200
219
  # password - string - Password for this bundle.
220
+ # form_field_set_id - int64 - Id of Form Field Set to use with this bundle
201
221
  # clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
202
222
  # code - string - Bundle code. This code forms the end part of the Public URL.
203
223
  # description - string - Public description
@@ -212,7 +232,9 @@ module Files
212
232
  params[:id] = @attributes[:id]
213
233
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
214
234
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
235
+ raise InvalidParameterError.new("Bad parameter: paths must be an Array") if params.dig(:paths) and !params.dig(:paths).is_a?(Array)
215
236
  raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
237
+ raise InvalidParameterError.new("Bad parameter: form_field_set_id must be an Integer") if params.dig(:form_field_set_id) and !params.dig(:form_field_set_id).is_a?(Integer)
216
238
  raise InvalidParameterError.new("Bad parameter: clickwrap_id must be an Integer") if params.dig(:clickwrap_id) and !params.dig(:clickwrap_id).is_a?(Integer)
217
239
  raise InvalidParameterError.new("Bad parameter: code must be an String") if params.dig(:code) and !params.dig(:code).is_a?(String)
218
240
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params.dig(:description) and !params.dig(:description).is_a?(String)
@@ -252,7 +274,7 @@ module Files
252
274
  # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
253
275
  # cursor - string - Used for pagination. Send a cursor value 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.
254
276
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
255
- # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id`, `created_at` or `code`.
277
+ # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `created_at` and `code`.
256
278
  # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `created_at`.
257
279
  # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `created_at`.
258
280
  # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `created_at`.
@@ -300,6 +322,7 @@ module Files
300
322
  # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
301
323
  # paths (required) - array(string) - A list of paths to include in this bundle.
302
324
  # password - string - Password for this bundle.
325
+ # form_field_set_id - int64 - Id of Form Field Set to use with this bundle
303
326
  # expires_at - string - Bundle expiration date/time
304
327
  # max_uses - int64 - Maximum number of times bundle can be accessed
305
328
  # description - string - Public description
@@ -313,6 +336,7 @@ module Files
313
336
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
314
337
  raise InvalidParameterError.new("Bad parameter: paths must be an Array") if params.dig(:paths) and !params.dig(:paths).is_a?(Array)
315
338
  raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
339
+ raise InvalidParameterError.new("Bad parameter: form_field_set_id must be an Integer") if params.dig(:form_field_set_id) and !params.dig(:form_field_set_id).is_a?(Integer)
316
340
  raise InvalidParameterError.new("Bad parameter: expires_at must be an String") if params.dig(:expires_at) and !params.dig(:expires_at).is_a?(String)
317
341
  raise InvalidParameterError.new("Bad parameter: max_uses must be an Integer") if params.dig(:max_uses) and !params.dig(:max_uses).is_a?(Integer)
318
342
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params.dig(:description) and !params.dig(:description).is_a?(String)
@@ -347,7 +371,9 @@ module Files
347
371
  end
348
372
 
349
373
  # Parameters:
374
+ # paths - array(string) - A list of paths to include in this bundle.
350
375
  # password - string - Password for this bundle.
376
+ # form_field_set_id - int64 - Id of Form Field Set to use with this bundle
351
377
  # clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
352
378
  # code - string - Bundle code. This code forms the end part of the Public URL.
353
379
  # description - string - Public description
@@ -361,7 +387,9 @@ module Files
361
387
  params ||= {}
362
388
  params[:id] = id
363
389
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
390
+ raise InvalidParameterError.new("Bad parameter: paths must be an Array") if params.dig(:paths) and !params.dig(:paths).is_a?(Array)
364
391
  raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
392
+ raise InvalidParameterError.new("Bad parameter: form_field_set_id must be an Integer") if params.dig(:form_field_set_id) and !params.dig(:form_field_set_id).is_a?(Integer)
365
393
  raise InvalidParameterError.new("Bad parameter: clickwrap_id must be an Integer") if params.dig(:clickwrap_id) and !params.dig(:clickwrap_id).is_a?(Integer)
366
394
  raise InvalidParameterError.new("Bad parameter: code must be an String") if params.dig(:code) and !params.dig(:code).is_a?(String)
367
395
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params.dig(:description) and !params.dig(:description).is_a?(String)
@@ -9,6 +9,10 @@ module Files
9
9
  @options = options || {}
10
10
  end
11
11
 
12
+ def bundle_registration
13
+ @attributes[:bundle_registration]
14
+ end
15
+
12
16
  # string - Download method (file or full_zip)
13
17
  def download_method
14
18
  @attributes[:download_method]
@@ -27,12 +31,13 @@ module Files
27
31
  # Parameters:
28
32
  # cursor - string - Used for pagination. Send a cursor value 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.
29
33
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
30
- # bundle_registration_id (required) - int64 - BundleRegistration ID
34
+ # bundle_id - int64 - Bundle ID
35
+ # bundle_registration_id - int64 - BundleRegistration ID
31
36
  def self.list(params = {}, options = {})
32
37
  raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
33
38
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
39
+ raise InvalidParameterError.new("Bad parameter: bundle_id must be an Integer") if params.dig(:bundle_id) and !params.dig(:bundle_id).is_a?(Integer)
34
40
  raise InvalidParameterError.new("Bad parameter: bundle_registration_id must be an Integer") if params.dig(:bundle_registration_id) and !params.dig(:bundle_registration_id).is_a?(Integer)
35
- raise MissingParameterError.new("Parameter missing: bundle_registration_id") unless params.dig(:bundle_registration_id)
36
41
 
37
42
  List.new(BundleDownload, params) do
38
43
  Api.send_request("/bundle_downloads", :get, params, options)
@@ -38,11 +38,25 @@ module Files
38
38
  # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
39
39
  # cursor - string - Used for pagination. Send a cursor value 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.
40
40
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
41
+ # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `has_registrations`.
42
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `has_registrations`.
43
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `has_registrations`.
44
+ # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `has_registrations`.
45
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `has_registrations`.
46
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `has_registrations`.
47
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `has_registrations`.
41
48
  # bundle_id (required) - int64 - List recipients for the bundle with this ID.
42
49
  def self.list(params = {}, options = {})
43
50
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
44
51
  raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
45
52
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
53
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
54
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
55
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
56
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
57
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
58
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
59
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
46
60
  raise InvalidParameterError.new("Bad parameter: bundle_id must be an Integer") if params.dig(:bundle_id) and !params.dig(:bundle_id).is_a?(Integer)
47
61
  raise MissingParameterError.new("Parameter missing: bundle_id") unless params.dig(:bundle_id)
48
62
 
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class BundleRegistration
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # string - Registration cookie code
13
+ def code
14
+ @attributes[:code]
15
+ end
16
+
17
+ # string - Registrant name
18
+ def name
19
+ @attributes[:name]
20
+ end
21
+
22
+ # string - Registrant company name
23
+ def company
24
+ @attributes[:company]
25
+ end
26
+
27
+ # string - Registrant email address
28
+ def email
29
+ @attributes[:email]
30
+ end
31
+
32
+ # string - InboxRegistration cookie code, if there is an associated InboxRegistration
33
+ def inbox_code
34
+ @attributes[:inbox_code]
35
+ end
36
+
37
+ # int64 - Id of associated form field set
38
+ def form_field_set_id
39
+ @attributes[:form_field_set_id]
40
+ end
41
+
42
+ # string - Data for form field set with form field ids as keys and user data as values
43
+ def form_field_data
44
+ @attributes[:form_field_data]
45
+ end
46
+ end
47
+ end
@@ -32,7 +32,7 @@ module Files
32
32
  # Parameters:
33
33
  # cursor - string - Used for pagination. Send a cursor value 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.
34
34
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
35
- # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `remote_server_type`, `site_id`, `event_type`, `created_at` or `status`.
35
+ # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `remote_server_type`, `event_type`, `created_at` or `status`.
36
36
  # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `created_at`, `event_type`, `remote_server_type` or `status`.
37
37
  # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `created_at`, `event_type`, `remote_server_type` or `status`.
38
38
  # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `created_at`, `event_type`, `remote_server_type` or `status`.
@@ -9,6 +9,16 @@ module Files
9
9
  @options = options || {}
10
10
  end
11
11
 
12
+ # string - Status of file operation. Possible values: completed, enqueued.
13
+ def status
14
+ @attributes[:status]
15
+ end
16
+
17
+ # int64 - If status is enqueued, this is the id of the FileMigration to check for status updates.
18
+ def file_migration_id
19
+ @attributes[:file_migration_id]
20
+ end
21
+
12
22
  # Copy file/folder
13
23
  #
14
24
  # Parameters:
@@ -78,8 +88,8 @@ module Files
78
88
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
79
89
  raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
80
90
 
81
- response, _options = Api.send_request("/file_actions/copy/#{params[:path]}", :post, params, options)
82
- response.data
91
+ response, options = Api.send_request("/file_actions/copy/#{params[:path]}", :post, params, options)
92
+ FileAction.new(response.data, options)
83
93
  end
84
94
 
85
95
  # Move file/folder
@@ -94,8 +104,8 @@ module Files
94
104
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
95
105
  raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
96
106
 
97
- response, _options = Api.send_request("/file_actions/move/#{params[:path]}", :post, params, options)
98
- response.data
107
+ response, options = Api.send_request("/file_actions/move/#{params[:path]}", :post, params, options)
108
+ FileAction.new(response.data, options)
99
109
  end
100
110
 
101
111
  # Begin file upload
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class FormField
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Form field id
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ # string - Label to be displayed
18
+ def label
19
+ @attributes[:label]
20
+ end
21
+
22
+ # boolean - Is this a required field?
23
+ def required
24
+ @attributes[:required]
25
+ end
26
+
27
+ # string - Help text to be displayed
28
+ def help_text
29
+ @attributes[:help_text]
30
+ end
31
+
32
+ # string - Type of Field
33
+ def field_type
34
+ @attributes[:field_type]
35
+ end
36
+
37
+ # string - Options to display for radio and dropdown
38
+ def options_for_select
39
+ @attributes[:options_for_select]
40
+ end
41
+
42
+ # string - Default option for radio and dropdown
43
+ def default_option
44
+ @attributes[:default_option]
45
+ end
46
+
47
+ # int64 - Form field set id
48
+ def form_field_set_id
49
+ @attributes[:form_field_set_id]
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,171 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class FormFieldSet
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Form field set id
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ def id=(value)
18
+ @attributes[:id] = value
19
+ end
20
+
21
+ # string - Title to be displayed
22
+ def title
23
+ @attributes[:title]
24
+ end
25
+
26
+ def title=(value)
27
+ @attributes[:title] = value
28
+ end
29
+
30
+ # int64 - Layout of the form
31
+ def form_layout
32
+ @attributes[:form_layout]
33
+ end
34
+
35
+ def form_layout=(value)
36
+ @attributes[:form_layout] = value
37
+ end
38
+
39
+ # array - Associated form fields
40
+ def form_fields
41
+ @attributes[:form_fields]
42
+ end
43
+
44
+ def form_fields=(value)
45
+ @attributes[:form_fields] = value
46
+ end
47
+
48
+ # int64 - User ID. Provide a value of `0` to operate the current session's user.
49
+ def user_id
50
+ @attributes[:user_id]
51
+ end
52
+
53
+ def user_id=(value)
54
+ @attributes[:user_id] = value
55
+ end
56
+
57
+ # Parameters:
58
+ # title - string - Title to be displayed
59
+ # form_fields - array(object)
60
+ def update(params = {})
61
+ params ||= {}
62
+ params[:id] = @attributes[:id]
63
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
64
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
65
+ raise InvalidParameterError.new("Bad parameter: title must be an String") if params.dig(:title) and !params.dig(:title).is_a?(String)
66
+ raise InvalidParameterError.new("Bad parameter: form_fields must be an Array") if params.dig(:form_fields) and !params.dig(:form_fields).is_a?(Array)
67
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
68
+
69
+ Api.send_request("/form_field_sets/#{@attributes[:id]}", :patch, params, @options)
70
+ end
71
+
72
+ def delete(params = {})
73
+ params ||= {}
74
+ params[:id] = @attributes[:id]
75
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
76
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
77
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
78
+
79
+ Api.send_request("/form_field_sets/#{@attributes[:id]}", :delete, params, @options)
80
+ end
81
+
82
+ def destroy(params = {})
83
+ delete(params)
84
+ end
85
+
86
+ def save
87
+ if @attributes[:id]
88
+ update(@attributes)
89
+ else
90
+ new_obj = FormFieldSet.create(@attributes, @options)
91
+ @attributes = new_obj.attributes
92
+ end
93
+ end
94
+
95
+ # Parameters:
96
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
97
+ # cursor - string - Used for pagination. Send a cursor value 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.
98
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
99
+ def self.list(params = {}, options = {})
100
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
101
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
102
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
103
+
104
+ List.new(FormFieldSet, params) do
105
+ Api.send_request("/form_field_sets", :get, params, options)
106
+ end
107
+ end
108
+
109
+ def self.all(params = {}, options = {})
110
+ list(params, options)
111
+ end
112
+
113
+ # Parameters:
114
+ # id (required) - int64 - Form Field Set ID.
115
+ def self.find(id, params = {}, options = {})
116
+ params ||= {}
117
+ params[:id] = id
118
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
119
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
120
+
121
+ response, options = Api.send_request("/form_field_sets/#{params[:id]}", :get, params, options)
122
+ FormFieldSet.new(response.data, options)
123
+ end
124
+
125
+ def self.get(id, params = {}, options = {})
126
+ find(id, params, options)
127
+ end
128
+
129
+ # Parameters:
130
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
131
+ # title - string - Title to be displayed
132
+ # form_fields - array(object)
133
+ def self.create(params = {}, options = {})
134
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
135
+ raise InvalidParameterError.new("Bad parameter: title must be an String") if params.dig(:title) and !params.dig(:title).is_a?(String)
136
+ raise InvalidParameterError.new("Bad parameter: form_fields must be an Array") if params.dig(:form_fields) and !params.dig(:form_fields).is_a?(Array)
137
+
138
+ response, options = Api.send_request("/form_field_sets", :post, params, options)
139
+ FormFieldSet.new(response.data, options)
140
+ end
141
+
142
+ # Parameters:
143
+ # title - string - Title to be displayed
144
+ # form_fields - array(object)
145
+ def self.update(id, params = {}, options = {})
146
+ params ||= {}
147
+ params[:id] = id
148
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
149
+ raise InvalidParameterError.new("Bad parameter: title must be an String") if params.dig(:title) and !params.dig(:title).is_a?(String)
150
+ raise InvalidParameterError.new("Bad parameter: form_fields must be an Array") if params.dig(:form_fields) and !params.dig(:form_fields).is_a?(Array)
151
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
152
+
153
+ response, options = Api.send_request("/form_field_sets/#{params[:id]}", :patch, params, options)
154
+ FormFieldSet.new(response.data, options)
155
+ end
156
+
157
+ def self.delete(id, params = {}, options = {})
158
+ params ||= {}
159
+ params[:id] = id
160
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
161
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
162
+
163
+ response, _options = Api.send_request("/form_field_sets/#{params[:id]}", :delete, params, options)
164
+ response.data
165
+ end
166
+
167
+ def self.destroy(id, params = {}, options = {})
168
+ delete(id, params, options)
169
+ end
170
+ end
171
+ end