files.com 1.0.92

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 (136) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTORS +4 -0
  3. data/Gemfile +12 -0
  4. data/Gemfile.lock +82 -0
  5. data/LICENSE +21 -0
  6. data/README.md +119 -0
  7. data/Rakefile +12 -0
  8. data/SECURITY.md +24 -0
  9. data/_VERSION +1 -0
  10. data/bin/files +8 -0
  11. data/bin/files-console +16 -0
  12. data/docs/account_line_item.md +41 -0
  13. data/docs/action.md +37 -0
  14. data/docs/api_key.md +202 -0
  15. data/docs/app.md +59 -0
  16. data/docs/as2_key.md +133 -0
  17. data/docs/auto.md +11 -0
  18. data/docs/automation.md +190 -0
  19. data/docs/behavior.md +208 -0
  20. data/docs/bundle.md +252 -0
  21. data/docs/bundle_download.md +35 -0
  22. data/docs/clickwrap.md +143 -0
  23. data/docs/dns_record.md +35 -0
  24. data/docs/errors.md +17 -0
  25. data/docs/file.md +204 -0
  26. data/docs/file_action.md +126 -0
  27. data/docs/file_comment.md +116 -0
  28. data/docs/file_comment_reaction.md +62 -0
  29. data/docs/file_part_upload.md +37 -0
  30. data/docs/file_utils.md +4 -0
  31. data/docs/folder.md +90 -0
  32. data/docs/group.md +153 -0
  33. data/docs/group_user.md +124 -0
  34. data/docs/history.md +171 -0
  35. data/docs/history_export.md +174 -0
  36. data/docs/image.md +13 -0
  37. data/docs/invoice.md +72 -0
  38. data/docs/invoice_line_item.md +27 -0
  39. data/docs/ip_address.md +55 -0
  40. data/docs/lock.md +98 -0
  41. data/docs/message.md +147 -0
  42. data/docs/message_comment.md +132 -0
  43. data/docs/message_comment_reaction.md +94 -0
  44. data/docs/message_reaction.md +94 -0
  45. data/docs/notification.md +177 -0
  46. data/docs/payment.md +72 -0
  47. data/docs/payment_line_item.md +19 -0
  48. data/docs/permission.md +95 -0
  49. data/docs/preview.md +19 -0
  50. data/docs/project.md +121 -0
  51. data/docs/public_ip_address.md +13 -0
  52. data/docs/public_key.md +133 -0
  53. data/docs/remote_server.md +356 -0
  54. data/docs/request.md +100 -0
  55. data/docs/session.md +78 -0
  56. data/docs/site.md +448 -0
  57. data/docs/sso_strategy.md +114 -0
  58. data/docs/status.md +21 -0
  59. data/docs/style.md +93 -0
  60. data/docs/usage_daily_snapshot.md +45 -0
  61. data/docs/usage_snapshot.md +53 -0
  62. data/docs/user.md +535 -0
  63. data/docs/user_cipher_use.md +41 -0
  64. data/docs/user_request.md +93 -0
  65. data/files.com.gemspec +22 -0
  66. data/lib/files.com.rb +184 -0
  67. data/lib/files.com/api.rb +38 -0
  68. data/lib/files.com/api_client.rb +340 -0
  69. data/lib/files.com/errors.rb +41 -0
  70. data/lib/files.com/list.rb +95 -0
  71. data/lib/files.com/models/account_line_item.rb +82 -0
  72. data/lib/files.com/models/action.rb +77 -0
  73. data/lib/files.com/models/api_key.rb +270 -0
  74. data/lib/files.com/models/app.rb +106 -0
  75. data/lib/files.com/models/as2_key.rb +179 -0
  76. data/lib/files.com/models/auto.rb +17 -0
  77. data/lib/files.com/models/automation.rb +304 -0
  78. data/lib/files.com/models/behavior.rb +266 -0
  79. data/lib/files.com/models/bundle.rb +371 -0
  80. data/lib/files.com/models/bundle_download.rb +49 -0
  81. data/lib/files.com/models/clickwrap.rb +197 -0
  82. data/lib/files.com/models/dir.rb +3 -0
  83. data/lib/files.com/models/dns_record.rb +51 -0
  84. data/lib/files.com/models/errors.rb +22 -0
  85. data/lib/files.com/models/file.rb +968 -0
  86. data/lib/files.com/models/file_action.rb +126 -0
  87. data/lib/files.com/models/file_comment.rb +146 -0
  88. data/lib/files.com/models/file_comment_reaction.rb +100 -0
  89. data/lib/files.com/models/file_part_upload.rb +82 -0
  90. data/lib/files.com/models/file_utils.rb +118 -0
  91. data/lib/files.com/models/folder.rb +357 -0
  92. data/lib/files.com/models/group.rb +208 -0
  93. data/lib/files.com/models/group_user.rb +171 -0
  94. data/lib/files.com/models/history.rb +228 -0
  95. data/lib/files.com/models/history_export.rb +353 -0
  96. data/lib/files.com/models/image.rb +22 -0
  97. data/lib/files.com/models/invoice.rb +117 -0
  98. data/lib/files.com/models/invoice_line_item.rb +57 -0
  99. data/lib/files.com/models/ip_address.rb +66 -0
  100. data/lib/files.com/models/lock.rb +173 -0
  101. data/lib/files.com/models/message.rb +201 -0
  102. data/lib/files.com/models/message_comment.rb +165 -0
  103. data/lib/files.com/models/message_comment_reaction.rb +128 -0
  104. data/lib/files.com/models/message_reaction.rb +128 -0
  105. data/lib/files.com/models/notification.rb +263 -0
  106. data/lib/files.com/models/payment.rb +117 -0
  107. data/lib/files.com/models/payment_line_item.rb +37 -0
  108. data/lib/files.com/models/permission.rb +172 -0
  109. data/lib/files.com/models/preview.rb +37 -0
  110. data/lib/files.com/models/project.rb +140 -0
  111. data/lib/files.com/models/public_ip_address.rb +22 -0
  112. data/lib/files.com/models/public_key.rb +179 -0
  113. data/lib/files.com/models/remote_server.rb +680 -0
  114. data/lib/files.com/models/request.rb +179 -0
  115. data/lib/files.com/models/session.rb +247 -0
  116. data/lib/files.com/models/site.rb +733 -0
  117. data/lib/files.com/models/sso_strategy.rb +227 -0
  118. data/lib/files.com/models/status.rb +37 -0
  119. data/lib/files.com/models/style.rb +131 -0
  120. data/lib/files.com/models/usage_daily_snapshot.rb +66 -0
  121. data/lib/files.com/models/usage_snapshot.rb +96 -0
  122. data/lib/files.com/models/user.rb +876 -0
  123. data/lib/files.com/models/user_cipher_use.rb +63 -0
  124. data/lib/files.com/models/user_request.rb +127 -0
  125. data/lib/files.com/response.rb +25 -0
  126. data/lib/files.com/sizable_io.rb +32 -0
  127. data/lib/files.com/system_profiler.rb +56 -0
  128. data/lib/files.com/util.rb +106 -0
  129. data/lib/files.com/version.rb +5 -0
  130. data/spec/list_spec.rb +214 -0
  131. data/spec/models/file_spec.rb +68 -0
  132. data/spec/models/folder_spec.rb +40 -0
  133. data/spec/spec_helper.rb +36 -0
  134. data/test.sh +8 -0
  135. data/test/test.rb +75 -0
  136. metadata +235 -0
@@ -0,0 +1,208 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class Group
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Group ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ def id=(value)
18
+ @attributes[:id] = value
19
+ end
20
+
21
+ # string - Group name
22
+ def name
23
+ @attributes[:name]
24
+ end
25
+
26
+ def name=(value)
27
+ @attributes[:name] = value
28
+ end
29
+
30
+ # array - List of user IDs who are group administrators (separated by commas)
31
+ def admin_ids
32
+ @attributes[:admin_ids]
33
+ end
34
+
35
+ def admin_ids=(value)
36
+ @attributes[:admin_ids] = value
37
+ end
38
+
39
+ # string - Notes about this group
40
+ def notes
41
+ @attributes[:notes]
42
+ end
43
+
44
+ def notes=(value)
45
+ @attributes[:notes] = value
46
+ end
47
+
48
+ # array - List of user IDs who belong to this group (separated by commas)
49
+ def user_ids
50
+ @attributes[:user_ids]
51
+ end
52
+
53
+ def user_ids=(value)
54
+ @attributes[:user_ids] = value
55
+ end
56
+
57
+ # array - List of usernames who belong to this group (separated by commas)
58
+ def usernames
59
+ @attributes[:usernames]
60
+ end
61
+
62
+ def usernames=(value)
63
+ @attributes[:usernames] = value
64
+ end
65
+
66
+ # Parameters:
67
+ # name - string - Group name.
68
+ # notes - string - Group notes.
69
+ # user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
70
+ # admin_ids - string - A list of group admin user ids. If sent as a string, should be comma-delimited.
71
+ def update(params = {})
72
+ params ||= {}
73
+ params[:id] = @attributes[:id]
74
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
75
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
76
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
77
+ raise InvalidParameterError.new("Bad parameter: notes must be an String") if params.dig(:notes) and !params.dig(:notes).is_a?(String)
78
+ raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String)
79
+ raise InvalidParameterError.new("Bad parameter: admin_ids must be an String") if params.dig(:admin_ids) and !params.dig(:admin_ids).is_a?(String)
80
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
81
+
82
+ Api.send_request("/groups/#{@attributes[:id]}", :patch, params, @options)
83
+ end
84
+
85
+ def delete(params = {})
86
+ params ||= {}
87
+ params[:id] = @attributes[:id]
88
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
89
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
90
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
91
+
92
+ Api.send_request("/groups/#{@attributes[:id]}", :delete, params, @options)
93
+ end
94
+
95
+ def destroy(params = {})
96
+ delete(params)
97
+ end
98
+
99
+ def save
100
+ if @attributes[:id]
101
+ update(@attributes)
102
+ else
103
+ new_obj = Group.create(@attributes, @options)
104
+ @attributes = new_obj.attributes
105
+ end
106
+ end
107
+
108
+ # Parameters:
109
+ # page - int64 - Current page number.
110
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
111
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
112
+ # 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.
113
+ # 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 `active`, `deleted_at`, `site_id` or `name`.
114
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `name`.
115
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `name`.
116
+ # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `name`.
117
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `name`.
118
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `name`.
119
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `name`.
120
+ # ids - string - Comma-separated list of group ids to include in results.
121
+ def self.list(params = {}, options = {})
122
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
123
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
124
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
125
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
126
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
127
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
128
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
129
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
130
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
131
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
132
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
133
+ raise InvalidParameterError.new("Bad parameter: ids must be an String") if params.dig(:ids) and !params.dig(:ids).is_a?(String)
134
+
135
+ List.new(Group, params) do
136
+ Api.send_request("/groups", :get, params, options)
137
+ end
138
+ end
139
+
140
+ def self.all(params = {}, options = {})
141
+ list(params, options)
142
+ end
143
+
144
+ # Parameters:
145
+ # id (required) - int64 - Group ID.
146
+ def self.find(id, params = {}, options = {})
147
+ params ||= {}
148
+ params[:id] = id
149
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
150
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
151
+
152
+ response, options = Api.send_request("/groups/#{params[:id]}", :get, params, options)
153
+ Group.new(response.data, options)
154
+ end
155
+
156
+ def self.get(id, params = {}, options = {})
157
+ find(id, params, options)
158
+ end
159
+
160
+ # Parameters:
161
+ # name - string - Group name.
162
+ # notes - string - Group notes.
163
+ # user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
164
+ # admin_ids - string - A list of group admin user ids. If sent as a string, should be comma-delimited.
165
+ def self.create(params = {}, options = {})
166
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
167
+ raise InvalidParameterError.new("Bad parameter: notes must be an String") if params.dig(:notes) and !params.dig(:notes).is_a?(String)
168
+ raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String)
169
+ raise InvalidParameterError.new("Bad parameter: admin_ids must be an String") if params.dig(:admin_ids) and !params.dig(:admin_ids).is_a?(String)
170
+
171
+ response, options = Api.send_request("/groups", :post, params, options)
172
+ Group.new(response.data, options)
173
+ end
174
+
175
+ # Parameters:
176
+ # name - string - Group name.
177
+ # notes - string - Group notes.
178
+ # user_ids - string - A list of user ids. If sent as a string, should be comma-delimited.
179
+ # admin_ids - string - A list of group admin user ids. If sent as a string, should be comma-delimited.
180
+ def self.update(id, params = {}, options = {})
181
+ params ||= {}
182
+ params[:id] = id
183
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
184
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
185
+ raise InvalidParameterError.new("Bad parameter: notes must be an String") if params.dig(:notes) and !params.dig(:notes).is_a?(String)
186
+ raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String)
187
+ raise InvalidParameterError.new("Bad parameter: admin_ids must be an String") if params.dig(:admin_ids) and !params.dig(:admin_ids).is_a?(String)
188
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
189
+
190
+ response, options = Api.send_request("/groups/#{params[:id]}", :patch, params, options)
191
+ Group.new(response.data, options)
192
+ end
193
+
194
+ def self.delete(id, params = {}, options = {})
195
+ params ||= {}
196
+ params[:id] = id
197
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
198
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
199
+
200
+ response, _options = Api.send_request("/groups/#{params[:id]}", :delete, params, options)
201
+ response.data
202
+ end
203
+
204
+ def self.destroy(id, params = {}, options = {})
205
+ delete(id, params, options)
206
+ end
207
+ end
208
+ end
@@ -0,0 +1,171 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class GroupUser
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # string - Group name
13
+ def group_name
14
+ @attributes[:group_name]
15
+ end
16
+
17
+ def group_name=(value)
18
+ @attributes[:group_name] = value
19
+ end
20
+
21
+ # int64 - Group ID
22
+ def group_id
23
+ @attributes[:group_id]
24
+ end
25
+
26
+ def group_id=(value)
27
+ @attributes[:group_id] = value
28
+ end
29
+
30
+ # int64 - User ID
31
+ def user_id
32
+ @attributes[:user_id]
33
+ end
34
+
35
+ def user_id=(value)
36
+ @attributes[:user_id] = value
37
+ end
38
+
39
+ # boolean - Is this user an administrator of this group?
40
+ def admin
41
+ @attributes[:admin]
42
+ end
43
+
44
+ def admin=(value)
45
+ @attributes[:admin] = value
46
+ end
47
+
48
+ # array - A list of usernames for users in this group
49
+ def usernames
50
+ @attributes[:usernames]
51
+ end
52
+
53
+ def usernames=(value)
54
+ @attributes[:usernames] = value
55
+ end
56
+
57
+ # int64 - Group User ID.
58
+ def id
59
+ @attributes[:id]
60
+ end
61
+
62
+ def id=(value)
63
+ @attributes[:id] = value
64
+ end
65
+
66
+ # Parameters:
67
+ # group_id (required) - int64 - Group ID to add user to.
68
+ # user_id (required) - int64 - User ID to add to group.
69
+ # admin - boolean - Is the user a group administrator?
70
+ def update(params = {})
71
+ params ||= {}
72
+ params[:id] = @attributes[:id]
73
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
74
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
75
+ raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
76
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
77
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
78
+ raise MissingParameterError.new("Parameter missing: group_id") unless params.dig(:group_id)
79
+ raise MissingParameterError.new("Parameter missing: user_id") unless params.dig(:user_id)
80
+
81
+ Api.send_request("/group_users/#{@attributes[:id]}", :patch, params, @options)
82
+ end
83
+
84
+ # Parameters:
85
+ # group_id (required) - int64 - Group ID from which to remove user.
86
+ # user_id (required) - int64 - User ID to remove from group.
87
+ def delete(params = {})
88
+ params ||= {}
89
+ params[:id] = @attributes[:id]
90
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
91
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
92
+ raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
93
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
94
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
95
+ raise MissingParameterError.new("Parameter missing: group_id") unless params.dig(:group_id)
96
+ raise MissingParameterError.new("Parameter missing: user_id") unless params.dig(:user_id)
97
+
98
+ Api.send_request("/group_users/#{@attributes[:id]}", :delete, params, @options)
99
+ end
100
+
101
+ def destroy(params = {})
102
+ delete(params)
103
+ end
104
+
105
+ def save
106
+ update(@attributes)
107
+ end
108
+
109
+ # Parameters:
110
+ # user_id - int64 - User ID. If provided, will return group_users of this user.
111
+ # page - int64 - Current page number.
112
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
113
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
114
+ # group_id - int64 - Group ID. If provided, will return group_users of this group.
115
+ def self.list(params = {}, options = {})
116
+ 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
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
118
+ 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
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
120
+ 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
+
122
+ response, options = Api.send_request("/group_users", :get, params, options)
123
+ response.data.map do |entity_data|
124
+ GroupUser.new(entity_data, options)
125
+ end
126
+ end
127
+
128
+ def self.all(params = {}, options = {})
129
+ list(params, options)
130
+ end
131
+
132
+ # Parameters:
133
+ # group_id (required) - int64 - Group ID to add user to.
134
+ # user_id (required) - int64 - User ID to add to group.
135
+ # admin - boolean - Is the user a group administrator?
136
+ def self.update(id, params = {}, options = {})
137
+ params ||= {}
138
+ params[:id] = id
139
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
140
+ raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
141
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
142
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
143
+ raise MissingParameterError.new("Parameter missing: group_id") unless params.dig(:group_id)
144
+ raise MissingParameterError.new("Parameter missing: user_id") unless params.dig(:user_id)
145
+
146
+ response, options = Api.send_request("/group_users/#{params[:id]}", :patch, params, options)
147
+ GroupUser.new(response.data, options)
148
+ end
149
+
150
+ # Parameters:
151
+ # group_id (required) - int64 - Group ID from which to remove user.
152
+ # user_id (required) - int64 - User ID to remove from group.
153
+ def self.delete(id, params = {}, options = {})
154
+ params ||= {}
155
+ params[:id] = id
156
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
157
+ raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
158
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
159
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
160
+ raise MissingParameterError.new("Parameter missing: group_id") unless params.dig(:group_id)
161
+ raise MissingParameterError.new("Parameter missing: user_id") unless params.dig(:user_id)
162
+
163
+ response, _options = Api.send_request("/group_users/#{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
@@ -0,0 +1,228 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class History
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
+ # string - Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
18
+ def path
19
+ @attributes[:path]
20
+ end
21
+
22
+ # date-time - Action occurrence date/time
23
+ def when
24
+ @attributes[:when]
25
+ end
26
+
27
+ # string - The destination path for this action, if applicable
28
+ def destination
29
+ @attributes[:destination]
30
+ end
31
+
32
+ # string - Friendly displayed output
33
+ def display
34
+ @attributes[:display]
35
+ end
36
+
37
+ # string - IP Address that performed this action
38
+ def ip
39
+ @attributes[:ip]
40
+ end
41
+
42
+ # string - The source path for this action, if applicable
43
+ def source
44
+ @attributes[:source]
45
+ end
46
+
47
+ # array - Targets
48
+ def targets
49
+ @attributes[:targets]
50
+ end
51
+
52
+ # int64 - User ID
53
+ def user_id
54
+ @attributes[:user_id]
55
+ end
56
+
57
+ # string - Username
58
+ def username
59
+ @attributes[:username]
60
+ end
61
+
62
+ # string - Type of action
63
+ def action
64
+ @attributes[:action]
65
+ end
66
+
67
+ # string - Failure type. If action was a user login or session failure, why did it fail?
68
+ def failure_type
69
+ @attributes[:failure_type]
70
+ end
71
+
72
+ # string - Interface on which this action occurred.
73
+ def interface
74
+ @attributes[:interface]
75
+ end
76
+
77
+ # Parameters:
78
+ # start_at - string - Leave blank or set to a date/time to filter earlier entries.
79
+ # end_at - string - Leave blank or set to a date/time to filter later entries.
80
+ # display - string - Display format. Leave blank or set to `full` or `parent`.
81
+ # page - int64 - Current page number.
82
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
83
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
84
+ # 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.
85
+ # 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 `user_id` and `created_at`.
86
+ # path (required) - string - Path to operate on.
87
+ def self.list_for_file(path, params = {}, options = {})
88
+ params ||= {}
89
+ params[:path] = path
90
+ raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String)
91
+ raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String)
92
+ raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String)
93
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
94
+ 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
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
96
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
97
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
98
+ raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
99
+ raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
100
+
101
+ List.new(Action, params) do
102
+ Api.send_request("/history/files/#{params[:path]}", :get, params, options)
103
+ end
104
+ end
105
+
106
+ # Parameters:
107
+ # start_at - string - Leave blank or set to a date/time to filter earlier entries.
108
+ # end_at - string - Leave blank or set to a date/time to filter later entries.
109
+ # display - string - Display format. Leave blank or set to `full` or `parent`.
110
+ # page - int64 - Current page number.
111
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
112
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
113
+ # 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
+ # 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 `user_id` and `created_at`.
115
+ # path (required) - string - Path to operate on.
116
+ def self.list_for_folder(path, params = {}, options = {})
117
+ params ||= {}
118
+ params[:path] = path
119
+ raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String)
120
+ raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String)
121
+ raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String)
122
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
123
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
124
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
125
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
126
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
127
+ raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
128
+ raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
129
+
130
+ List.new(Action, params) do
131
+ Api.send_request("/history/folders/#{params[:path]}", :get, params, options)
132
+ end
133
+ end
134
+
135
+ # Parameters:
136
+ # start_at - string - Leave blank or set to a date/time to filter earlier entries.
137
+ # end_at - string - Leave blank or set to a date/time to filter later entries.
138
+ # display - string - Display format. Leave blank or set to `full` or `parent`.
139
+ # page - int64 - Current page number.
140
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
141
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
142
+ # 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.
143
+ # 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 `user_id` and `created_at`.
144
+ # user_id (required) - int64 - User ID.
145
+ def self.list_for_user(user_id, params = {}, options = {})
146
+ params ||= {}
147
+ params[:user_id] = user_id
148
+ raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String)
149
+ raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String)
150
+ raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String)
151
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
152
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
153
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
154
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
155
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
156
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
157
+ raise MissingParameterError.new("Parameter missing: user_id") unless params.dig(:user_id)
158
+
159
+ List.new(Action, params) do
160
+ Api.send_request("/history/users/#{params[:user_id]}", :get, params, options)
161
+ end
162
+ end
163
+
164
+ # Parameters:
165
+ # start_at - string - Leave blank or set to a date/time to filter earlier entries.
166
+ # end_at - string - Leave blank or set to a date/time to filter later entries.
167
+ # display - string - Display format. Leave blank or set to `full` or `parent`.
168
+ # page - int64 - Current page number.
169
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
170
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
171
+ # 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.
172
+ # 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 `user_id` and `created_at`.
173
+ def self.list_logins(params = {}, options = {})
174
+ raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String)
175
+ raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String)
176
+ raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String)
177
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
178
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
179
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
180
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
181
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
182
+
183
+ List.new(Action, params) do
184
+ Api.send_request("/history/login", :get, params, options)
185
+ end
186
+ end
187
+
188
+ # Parameters:
189
+ # start_at - string - Leave blank or set to a date/time to filter earlier entries.
190
+ # end_at - string - Leave blank or set to a date/time to filter later entries.
191
+ # display - string - Display format. Leave blank or set to `full` or `parent`.
192
+ # page - int64 - Current page number.
193
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
194
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
195
+ # 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.
196
+ # 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`, `path`, `created_at`, `folder` or `user_id`.
197
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
198
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `user_id`, `folder` or `path`.
199
+ # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
200
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
201
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `user_id`, `folder` or `path`.
202
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
203
+ def self.list(params = {}, options = {})
204
+ raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String)
205
+ raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String)
206
+ raise InvalidParameterError.new("Bad parameter: display must be an String") if params.dig(:display) and !params.dig(:display).is_a?(String)
207
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
208
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
209
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
210
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
211
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
212
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
213
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
214
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
215
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
216
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
217
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
218
+
219
+ List.new(Action, params) do
220
+ Api.send_request("/history", :get, params, options)
221
+ end
222
+ end
223
+
224
+ def self.all(params = {}, options = {})
225
+ list(params, options)
226
+ end
227
+ end
228
+ end