files.com 1.0.87 → 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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +3 -3
  4. data/SECURITY.md +24 -0
  5. data/_VERSION +1 -1
  6. data/docs/api_key.md +13 -1
  7. data/docs/app.md +14 -0
  8. data/docs/automation.md +9 -1
  9. data/docs/behavior.md +30 -14
  10. data/docs/bundle.md +8 -0
  11. data/docs/file.md +0 -4
  12. data/docs/group.md +8 -0
  13. data/docs/history.md +16 -0
  14. data/docs/ip_address.md +18 -0
  15. data/docs/notification.md +10 -2
  16. data/docs/permission.md +11 -3
  17. data/docs/public_ip_address.md +13 -0
  18. data/docs/request.md +6 -25
  19. data/docs/session.md +2 -2
  20. data/docs/style.md +1 -1
  21. data/docs/usage_daily_snapshot.md +8 -0
  22. data/docs/user.md +8 -2
  23. data/lib/files.com.rb +1 -0
  24. data/lib/files.com/models/api_key.rb +30 -4
  25. data/lib/files.com/models/app.rb +33 -3
  26. data/lib/files.com/models/automation.rb +19 -4
  27. data/lib/files.com/models/behavior.rb +53 -23
  28. data/lib/files.com/models/bundle.rb +19 -4
  29. data/lib/files.com/models/file.rb +7 -11
  30. data/lib/files.com/models/file_action.rb +6 -6
  31. data/lib/files.com/models/file_comment.rb +1 -1
  32. data/lib/files.com/models/folder.rb +2 -2
  33. data/lib/files.com/models/group.rb +18 -3
  34. data/lib/files.com/models/history.rb +43 -16
  35. data/lib/files.com/models/ip_address.rb +15 -0
  36. data/lib/files.com/models/lock.rb +4 -4
  37. data/lib/files.com/models/notification.rb +20 -5
  38. data/lib/files.com/models/permission.rb +21 -6
  39. data/lib/files.com/models/public_ip_address.rb +22 -0
  40. data/lib/files.com/models/request.rb +15 -28
  41. data/lib/files.com/models/session.rb +1 -1
  42. data/lib/files.com/models/style.rb +8 -8
  43. data/lib/files.com/models/usage_daily_snapshot.rb +18 -3
  44. data/lib/files.com/models/user.rb +18 -5
  45. metadata +5 -2
@@ -23,7 +23,7 @@ module Files
23
23
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
24
24
  raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
25
25
 
26
- Api.send_request("/file_actions/copy/#{Addressable::URI.encode_component(params[:path])}", :post, params, @options)
26
+ Api.send_request("/file_actions/copy/#{@attributes[:path]}", :post, params, @options)
27
27
  end
28
28
 
29
29
  # Move file/folder
@@ -39,7 +39,7 @@ module Files
39
39
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
40
40
  raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
41
41
 
42
- Api.send_request("/file_actions/move/#{Addressable::URI.encode_component(params[:path])}", :post, params, @options)
42
+ Api.send_request("/file_actions/move/#{@attributes[:path]}", :post, params, @options)
43
43
  end
44
44
 
45
45
  # Begin file upload
@@ -62,7 +62,7 @@ module Files
62
62
  raise InvalidParameterError.new("Bad parameter: restart must be an Integer") if params.dig(:restart) and !params.dig(:restart).is_a?(Integer)
63
63
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
64
64
 
65
- Api.send_request("/file_actions/begin_upload/#{Addressable::URI.encode_component(params[:path])}", :post, params, @options)
65
+ Api.send_request("/file_actions/begin_upload/#{@attributes[:path]}", :post, params, @options)
66
66
  end
67
67
 
68
68
  # Copy file/folder
@@ -78,7 +78,7 @@ module Files
78
78
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
79
79
  raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
80
80
 
81
- response, _options = Api.send_request("/file_actions/copy/#{Addressable::URI.encode_component(params[:path])}", :post, params, options)
81
+ response, _options = Api.send_request("/file_actions/copy/#{params[:path]}", :post, params, options)
82
82
  response.data
83
83
  end
84
84
 
@@ -94,7 +94,7 @@ module Files
94
94
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
95
95
  raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
96
96
 
97
- response, _options = Api.send_request("/file_actions/move/#{Addressable::URI.encode_component(params[:path])}", :post, params, options)
97
+ response, _options = Api.send_request("/file_actions/move/#{params[:path]}", :post, params, options)
98
98
  response.data
99
99
  end
100
100
 
@@ -117,7 +117,7 @@ module Files
117
117
  raise InvalidParameterError.new("Bad parameter: restart must be an Integer") if params.dig(:restart) and !params.dig(:restart).is_a?(Integer)
118
118
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
119
119
 
120
- response, options = Api.send_request("/file_actions/begin_upload/#{Addressable::URI.encode_component(params[:path])}", :post, params, options)
120
+ response, options = Api.send_request("/file_actions/begin_upload/#{params[:path]}", :post, params, options)
121
121
  response.data.map do |entity_data|
122
122
  FilePartUpload.new(entity_data, options)
123
123
  end
@@ -96,7 +96,7 @@ module Files
96
96
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
97
97
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
98
98
 
99
- response, options = Api.send_request("/file_comments/files/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
99
+ response, options = Api.send_request("/file_comments/files/#{params[:path]}", :get, params, options)
100
100
  response.data.map do |entity_data|
101
101
  FileComment.new(entity_data, options)
102
102
  end
@@ -338,7 +338,7 @@ module Files
338
338
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
339
339
 
340
340
  List.new(File, params) do
341
- Api.send_request("/folders/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
341
+ Api.send_request("/folders/#{params[:path]}", :get, params, options)
342
342
  end
343
343
  end
344
344
 
@@ -350,7 +350,7 @@ module Files
350
350
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
351
351
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
352
352
 
353
- response, options = Api.send_request("/folders/#{Addressable::URI.encode_component(params[:path])}", :post, params, options)
353
+ response, options = Api.send_request("/folders/#{params[:path]}", :post, params, options)
354
354
  File.new(response.data, options)
355
355
  end
356
356
  end
@@ -109,16 +109,31 @@ module Files
109
109
  # page - int64 - Current page number.
110
110
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
111
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`.
112
120
  # ids - string - Comma-separated list of group ids to include in results.
113
121
  def self.list(params = {}, options = {})
114
122
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
115
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)
116
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)
117
133
  raise InvalidParameterError.new("Bad parameter: ids must be an String") if params.dig(:ids) and !params.dig(:ids).is_a?(String)
118
134
 
119
- response, options = Api.send_request("/groups", :get, params, options)
120
- response.data.map do |entity_data|
121
- Group.new(entity_data, options)
135
+ List.new(Group, params) do
136
+ Api.send_request("/groups", :get, params, options)
122
137
  end
123
138
  end
124
139
 
@@ -81,6 +81,8 @@ module Files
81
81
  # page - int64 - Current page number.
82
82
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
83
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`.
84
86
  # path (required) - string - Path to operate on.
85
87
  def self.list_for_file(path, params = {}, options = {})
86
88
  params ||= {}
@@ -91,12 +93,13 @@ module Files
91
93
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
92
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)
93
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)
94
98
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
95
99
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
96
100
 
97
- response, options = Api.send_request("/history/files(/*path)", :get, params, options)
98
- response.data.map do |entity_data|
99
- Action.new(entity_data, options)
101
+ List.new(Action, params) do
102
+ Api.send_request("/history/files/#{params[:path]}", :get, params, options)
100
103
  end
101
104
  end
102
105
 
@@ -107,6 +110,8 @@ module Files
107
110
  # page - int64 - Current page number.
108
111
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
109
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`.
110
115
  # path (required) - string - Path to operate on.
111
116
  def self.list_for_folder(path, params = {}, options = {})
112
117
  params ||= {}
@@ -117,12 +122,13 @@ module Files
117
122
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
118
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)
119
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)
120
127
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
121
128
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
122
129
 
123
- response, options = Api.send_request("/history/folders(/*path)", :get, params, options)
124
- response.data.map do |entity_data|
125
- Action.new(entity_data, options)
130
+ List.new(Action, params) do
131
+ Api.send_request("/history/folders/#{params[:path]}", :get, params, options)
126
132
  end
127
133
  end
128
134
 
@@ -133,6 +139,8 @@ module Files
133
139
  # page - int64 - Current page number.
134
140
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
135
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`.
136
144
  # user_id (required) - int64 - User ID.
137
145
  def self.list_for_user(user_id, params = {}, options = {})
138
146
  params ||= {}
@@ -143,12 +151,13 @@ module Files
143
151
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
144
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)
145
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)
146
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)
147
157
  raise MissingParameterError.new("Parameter missing: user_id") unless params.dig(:user_id)
148
158
 
149
- response, options = Api.send_request("/history/users/#{params[:user_id]}", :get, params, options)
150
- response.data.map do |entity_data|
151
- Action.new(entity_data, options)
159
+ List.new(Action, params) do
160
+ Api.send_request("/history/users/#{params[:user_id]}", :get, params, options)
152
161
  end
153
162
  end
154
163
 
@@ -159,6 +168,8 @@ module Files
159
168
  # page - int64 - Current page number.
160
169
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
161
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`.
162
173
  def self.list_logins(params = {}, options = {})
163
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)
164
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)
@@ -166,10 +177,11 @@ module Files
166
177
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
167
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)
168
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)
169
182
 
170
- response, options = Api.send_request("/history/login", :get, params, options)
171
- response.data.map do |entity_data|
172
- Action.new(entity_data, options)
183
+ List.new(Action, params) do
184
+ Api.send_request("/history/login", :get, params, options)
173
185
  end
174
186
  end
175
187
 
@@ -180,6 +192,14 @@ module Files
180
192
  # page - int64 - Current page number.
181
193
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
182
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`.
183
203
  def self.list(params = {}, options = {})
184
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)
185
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)
@@ -187,10 +207,17 @@ module Files
187
207
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
188
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)
189
209
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
190
-
191
- response, options = Api.send_request("/history", :get, params, options)
192
- response.data.map do |entity_data|
193
- Action.new(entity_data, options)
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)
194
221
  end
195
222
  end
196
223
 
@@ -47,5 +47,20 @@ module Files
47
47
  def self.all(params = {}, options = {})
48
48
  list(params, options)
49
49
  end
50
+
51
+ # Parameters:
52
+ # page - int64 - Current page number.
53
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
54
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
55
+ def self.get_reserved(params = {}, options = {})
56
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
57
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
58
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
59
+
60
+ response, options = Api.send_request("/ip_addresses/reserved", :get, params, options)
61
+ response.data.map do |entity_data|
62
+ PublicIpAddress.new(entity_data, options)
63
+ end
64
+ end
50
65
  end
51
66
  end
@@ -101,7 +101,7 @@ module Files
101
101
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
102
102
  raise MissingParameterError.new("Parameter missing: token") unless params.dig(:token)
103
103
 
104
- Api.send_request("/locks/#{Addressable::URI.encode_component(params[:path])}", :delete, params, @options)
104
+ Api.send_request("/locks/#{@attributes[:path]}", :delete, params, @options)
105
105
  end
106
106
 
107
107
  def destroy(params = {})
@@ -132,7 +132,7 @@ module Files
132
132
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
133
133
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
134
134
 
135
- response, options = Api.send_request("/locks/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
135
+ response, options = Api.send_request("/locks/#{params[:path]}", :get, params, options)
136
136
  response.data.map do |entity_data|
137
137
  Lock.new(entity_data, options)
138
138
  end
@@ -148,7 +148,7 @@ module Files
148
148
  raise InvalidParameterError.new("Bad parameter: timeout must be an Integer") if params.dig(:timeout) and !params.dig(:timeout).is_a?(Integer)
149
149
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
150
150
 
151
- response, options = Api.send_request("/locks/#{Addressable::URI.encode_component(params[:path])}", :post, params, options)
151
+ response, options = Api.send_request("/locks/#{params[:path]}", :post, params, options)
152
152
  Lock.new(response.data, options)
153
153
  end
154
154
 
@@ -162,7 +162,7 @@ module Files
162
162
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
163
163
  raise MissingParameterError.new("Parameter missing: token") unless params.dig(:token)
164
164
 
165
- response, _options = Api.send_request("/locks/#{Addressable::URI.encode_component(params[:path])}", :delete, params, options)
165
+ response, _options = Api.send_request("/locks/#{params[:path]}", :delete, params, options)
166
166
  response.data
167
167
  end
168
168
 
@@ -156,11 +156,19 @@ module Files
156
156
  end
157
157
 
158
158
  # Parameters:
159
- # user_id - int64 - Show notifications for this User ID.
159
+ # user_id - int64 - DEPRECATED: Show notifications for this User ID. Use `filter[user_id]` instead.
160
160
  # page - int64 - Current page number.
161
161
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
162
162
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
163
- # group_id - int64 - Show notifications for this Group ID.
163
+ # 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.
164
+ # 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`, `user_id` or `group_id`.
165
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `user_id`, `group_id` or `path`.
166
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `user_id`, `group_id` or `path`.
167
+ # 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`, `group_id` or `path`.
168
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `user_id`, `group_id` or `path`.
169
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `user_id`, `group_id` or `path`.
170
+ # 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`, `group_id` or `path`.
171
+ # group_id - int64 - DEPRECATED: Show notifications for this Group ID. Use `filter[group_id]` instead.
164
172
  # path - string - Show notifications for this Path.
165
173
  # include_ancestors - boolean - If `include_ancestors` is `true` and `path` is specified, include notifications for any parent paths. Ignored if `path` is not specified.
166
174
  def self.list(params = {}, options = {})
@@ -168,12 +176,19 @@ module Files
168
176
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
169
177
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
170
178
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
179
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
180
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
181
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
182
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
183
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
184
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
185
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
186
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
171
187
  raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
172
188
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
173
189
 
174
- response, options = Api.send_request("/notifications", :get, params, options)
175
- response.data.map do |entity_data|
176
- Notification.new(entity_data, options)
190
+ List.new(Notification, params) do
191
+ Api.send_request("/notifications", :get, params, options)
177
192
  end
178
193
  end
179
194
 
@@ -94,9 +94,17 @@ module Files
94
94
  # page - int64 - Current page number.
95
95
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
96
96
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
97
- # path - string - Permission path. If provided, will scope permissions to this path.
98
- # group_id - string - Group ID. If provided, will scope permissions to this group.
99
- # user_id - string - User ID. If provided, will scope permissions to this user.
97
+ # 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.
98
+ # 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 `deleted_at`, `group_id`, `path`, `user_id` or `permission`.
99
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `group_id`, `user_id` or `path`.
100
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `group_id`, `user_id` or `path`.
101
+ # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `group_id`, `user_id` or `path`.
102
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `group_id`, `user_id` or `path`.
103
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `group_id`, `user_id` or `path`.
104
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `group_id`, `user_id` or `path`.
105
+ # path - string - DEPRECATED: Permission path. If provided, will scope permissions to this path. Use `filter[path]` instead.
106
+ # group_id - string - DEPRECATED: Group ID. If provided, will scope permissions to this group. Use `filter[group_id]` instead.`
107
+ # user_id - string - DEPRECATED: User ID. If provided, will scope permissions to this user. Use `filter[user_id]` instead.`
100
108
  # include_groups - boolean - If searching by user or group, also include user's permissions that are inherited from its groups?
101
109
  def self.list(path, params = {}, options = {})
102
110
  params ||= {}
@@ -104,13 +112,20 @@ module Files
104
112
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
105
113
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
106
114
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
115
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
116
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
117
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
118
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
119
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
120
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
121
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
122
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
107
123
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
108
124
  raise InvalidParameterError.new("Bad parameter: group_id must be an String") if params.dig(:group_id) and !params.dig(:group_id).is_a?(String)
109
125
  raise InvalidParameterError.new("Bad parameter: user_id must be an String") if params.dig(:user_id) and !params.dig(:user_id).is_a?(String)
110
126
 
111
- response, options = Api.send_request("/permissions", :get, params, options)
112
- response.data.map do |entity_data|
113
- Permission.new(entity_data, options)
127
+ List.new(Permission, params) do
128
+ Api.send_request("/permissions", :get, params, options)
114
129
  end
115
130
  end
116
131
 
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class PublicIpAddress
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # string - The public IP address.
13
+ def ip_address
14
+ @attributes[:ip_address]
15
+ end
16
+
17
+ # string - The name of the frontend server.
18
+ def server_name
19
+ @attributes[:server_name]
20
+ end
21
+ end
22
+ end
@@ -81,25 +81,6 @@ module Files
81
81
  @attributes[:group_ids] = value
82
82
  end
83
83
 
84
- # List Requests
85
- #
86
- # Parameters:
87
- # page - int64 - Current page number.
88
- # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
89
- # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
90
- # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
91
- def folders(params = {})
92
- params ||= {}
93
- params[:path] = @attributes[:path]
94
- raise MissingParameterError.new("Current object doesn't have a path") unless @attributes[:path]
95
- raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
96
- raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
97
- raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
98
- raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
99
-
100
- Api.send_request("/requests/folders/#{Addressable::URI.encode_component(params[:path])}", :get, params, @options)
101
- end
102
-
103
84
  def save
104
85
  if @attributes[:path]
105
86
  raise NotImplementedError.new("The Request object doesn't support updates.")
@@ -113,6 +94,8 @@ module Files
113
94
  # page - int64 - Current page number.
114
95
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
115
96
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
97
+ # 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.
98
+ # 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`, `folder_id` or `destination`.
116
99
  # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
117
100
  # path - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
118
101
  def self.list(path, params = {}, options = {})
@@ -121,11 +104,12 @@ module Files
121
104
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
122
105
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
123
106
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
107
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
108
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
124
109
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
125
110
 
126
- response, options = Api.send_request("/requests", :get, params, options)
127
- response.data.map do |entity_data|
128
- Request.new(entity_data, options)
111
+ List.new(Request, params) do
112
+ Api.send_request("/requests", :get, params, options)
129
113
  end
130
114
  end
131
115
 
@@ -133,24 +117,27 @@ module Files
133
117
  list(path, params, options)
134
118
  end
135
119
 
136
- # List Requests
137
- #
138
120
  # Parameters:
139
121
  # page - int64 - Current page number.
140
122
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
141
123
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
124
+ # 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.
125
+ # 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`, `folder_id` or `destination`.
142
126
  # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
143
- def self.folders(path, params = {}, options = {})
127
+ # path (required) - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
128
+ def self.find_folder(path, params = {}, options = {})
144
129
  params ||= {}
145
130
  params[:path] = path
146
131
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
147
132
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
148
133
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
134
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
135
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
149
136
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
137
+ raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
150
138
 
151
- response, options = Api.send_request("/requests/folders/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
152
- response.data.map do |entity_data|
153
- Request.new(entity_data, options)
139
+ List.new(Request, params) do
140
+ Api.send_request("/requests/folders/#{params[:path]}", :get, params, options)
154
141
  end
155
142
  end
156
143