files.com 1.0.83 → 1.0.88

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/_VERSION +1 -1
  3. data/docs/api_key.md +13 -1
  4. data/docs/app.md +57 -0
  5. data/docs/automation.md +9 -1
  6. data/docs/behavior.md +30 -14
  7. data/docs/bundle.md +8 -0
  8. data/docs/file.md +0 -4
  9. data/docs/group.md +8 -0
  10. data/docs/history.md +16 -0
  11. data/docs/ip_address.md +19 -1
  12. data/docs/message.md +11 -11
  13. data/docs/notification.md +10 -2
  14. data/docs/permission.md +11 -3
  15. data/docs/public_ip_address.md +13 -0
  16. data/docs/remote_server.md +24 -4
  17. data/docs/request.md +6 -25
  18. data/docs/site.md +4 -0
  19. data/docs/style.md +1 -1
  20. data/docs/usage_daily_snapshot.md +8 -0
  21. data/docs/user.md +16 -2
  22. data/lib/files.com.rb +2 -0
  23. data/lib/files.com/models/api_key.rb +30 -4
  24. data/lib/files.com/models/app.rb +101 -0
  25. data/lib/files.com/models/automation.rb +19 -4
  26. data/lib/files.com/models/behavior.rb +53 -23
  27. data/lib/files.com/models/bundle.rb +19 -4
  28. data/lib/files.com/models/file.rb +7 -11
  29. data/lib/files.com/models/file_action.rb +6 -6
  30. data/lib/files.com/models/file_comment.rb +1 -1
  31. data/lib/files.com/models/folder.rb +2 -2
  32. data/lib/files.com/models/group.rb +18 -3
  33. data/lib/files.com/models/history.rb +43 -16
  34. data/lib/files.com/models/ip_address.rb +15 -0
  35. data/lib/files.com/models/lock.rb +4 -4
  36. data/lib/files.com/models/message.rb +5 -5
  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/remote_server.rb +45 -0
  41. data/lib/files.com/models/request.rb +15 -28
  42. data/lib/files.com/models/site.rb +6 -0
  43. data/lib/files.com/models/style.rb +8 -8
  44. data/lib/files.com/models/usage_daily_snapshot.rb +18 -3
  45. data/lib/files.com/models/user.rb +30 -5
  46. metadata +6 -2
@@ -183,16 +183,31 @@ module Files
183
183
  # page - int64 - Current page number.
184
184
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
185
185
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
186
- # automation - string - Type of automation to filter by.
186
+ # 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.
187
+ # 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 `automation`.
188
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `automation`.
189
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `automation`.
190
+ # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `automation`.
191
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `automation`.
192
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `automation`.
193
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `automation`.
194
+ # automation - string - DEPRECATED: Type of automation to filter by. Use `filter[automation]` instead.
187
195
  def self.list(params = {}, options = {})
188
196
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
189
197
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
190
198
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
199
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
200
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
201
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
202
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
203
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
204
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
205
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
206
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
191
207
  raise InvalidParameterError.new("Bad parameter: automation must be an String") if params.dig(:automation) and !params.dig(:automation).is_a?(String)
192
208
 
193
- response, options = Api.send_request("/automations", :get, params, options)
194
- response.data.map do |entity_data|
195
- Automation.new(entity_data, options)
209
+ List.new(Automation, params) do
210
+ Api.send_request("/automations", :get, params, options)
196
211
  end
197
212
  end
198
213
 
@@ -108,16 +108,31 @@ module Files
108
108
  # page - int64 - Current page number.
109
109
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
110
110
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
111
+ # 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.
112
+ # 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`.
113
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `behavior`.
114
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `behavior`.
115
+ # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `behavior`.
116
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `behavior`.
117
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `behavior`.
118
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `behavior`.
111
119
  # behavior - string - If set, only shows folder behaviors matching this behavior type.
112
120
  def self.list(params = {}, options = {})
113
121
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
114
122
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
115
123
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
124
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
125
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
126
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
127
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
128
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
129
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
130
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
131
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
116
132
  raise InvalidParameterError.new("Bad parameter: behavior must be an String") if params.dig(:behavior) and !params.dig(:behavior).is_a?(String)
117
133
 
118
- response, options = Api.send_request("/behaviors", :get, params, options)
119
- response.data.map do |entity_data|
120
- Behavior.new(entity_data, options)
134
+ List.new(Behavior, params) do
135
+ Api.send_request("/behaviors", :get, params, options)
121
136
  end
122
137
  end
123
138
 
@@ -125,46 +140,61 @@ module Files
125
140
  list(params, options)
126
141
  end
127
142
 
143
+ # Parameters:
144
+ # id (required) - int64 - Behavior ID.
145
+ def self.find(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 MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
150
+
151
+ response, options = Api.send_request("/behaviors/#{params[:id]}", :get, params, options)
152
+ Behavior.new(response.data, options)
153
+ end
154
+
155
+ def self.get(id, params = {}, options = {})
156
+ find(id, params, options)
157
+ end
158
+
128
159
  # Parameters:
129
160
  # page - int64 - Current page number.
130
161
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
131
162
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
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` and `behavior`.
165
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `behavior`.
166
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `behavior`.
167
+ # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `behavior`.
168
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `behavior`.
169
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `behavior`.
170
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `behavior`.
132
171
  # path (required) - string - Path to operate on.
133
172
  # recursive - string - Show behaviors above this path?
134
- # behavior - string - If set only shows folder behaviors matching this behavior type.
173
+ # behavior - string - DEPRECATED: If set only shows folder behaviors matching this behavior type. Use `filter[behavior]` instead.
135
174
  def self.list_for(path, params = {}, options = {})
136
175
  params ||= {}
137
176
  params[:path] = path
138
177
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
139
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)
140
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
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
183
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
184
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
185
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
186
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
187
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
141
188
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
142
189
  raise InvalidParameterError.new("Bad parameter: recursive must be an String") if params.dig(:recursive) and !params.dig(:recursive).is_a?(String)
143
190
  raise InvalidParameterError.new("Bad parameter: behavior must be an String") if params.dig(:behavior) and !params.dig(:behavior).is_a?(String)
144
191
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
145
192
 
146
- response, options = Api.send_request("/behaviors/folders/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
147
- response.data.map do |entity_data|
148
- Behavior.new(entity_data, options)
193
+ List.new(Behavior, params) do
194
+ Api.send_request("/behaviors/folders/#{params[:path]}", :get, params, options)
149
195
  end
150
196
  end
151
197
 
152
- # Parameters:
153
- # id (required) - int64 - Behavior ID.
154
- def self.find(id, params = {}, options = {})
155
- params ||= {}
156
- params[:id] = id
157
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
158
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
159
-
160
- response, options = Api.send_request("/behaviors/#{params[:id]}", :get, params, options)
161
- Behavior.new(response.data, options)
162
- end
163
-
164
- def self.get(id, params = {}, options = {})
165
- find(id, params, options)
166
- end
167
-
168
198
  # Parameters:
169
199
  # value - string - The value of the folder behavior. Can be a integer, array, or hash depending on the type of folder behavior.
170
200
  # attachment_file - file - Certain behaviors may require a file, for instance, the "watermark" behavior requires a watermark image
@@ -232,15 +232,30 @@ module Files
232
232
  # page - int64 - Current page number.
233
233
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
234
234
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
235
+ # 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.
236
+ # 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`.
237
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `created_at`.
238
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `created_at`.
239
+ # 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`.
240
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `created_at`.
241
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `created_at`.
242
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `created_at`.
235
243
  def self.list(params = {}, options = {})
236
244
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
237
245
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
238
246
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
239
247
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
240
-
241
- response, options = Api.send_request("/bundles", :get, params, options)
242
- response.data.map do |entity_data|
243
- Bundle.new(entity_data, options)
248
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
249
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
250
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
251
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
252
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
253
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
254
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
255
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
256
+
257
+ List.new(Bundle, params) do
258
+ Api.send_request("/bundles", :get, params, options)
244
259
  end
245
260
  end
246
261
 
@@ -826,7 +826,6 @@ module Files
826
826
  #
827
827
  # Parameters:
828
828
  # action - string - Can be blank, `redirect` or `stat`. If set to `stat`, we will return file information but without a download URL, and without logging a download. If set to `redirect` we will serve a 302 redirect directly to the file. This is used for integrations with Zapier, and is not recommended for most integrations.
829
- # id - int64 - If provided, lookup the file by id instead of path.
830
829
  # preview_size - string - Request a preview size. Can be `small` (default), `large`, `xlarge`, or `pdf`.
831
830
  # with_previews - boolean - Include file preview information?
832
831
  # with_priority_color - boolean - Include file priority color information?
@@ -836,11 +835,10 @@ module Files
836
835
  raise MissingParameterError.new("Current object doesn't have a path") unless @attributes[:path]
837
836
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
838
837
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
839
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
840
838
  raise InvalidParameterError.new("Bad parameter: preview_size must be an String") if params.dig(:preview_size) and !params.dig(:preview_size).is_a?(String)
841
839
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
842
840
 
843
- Api.send_request("/files/#{Addressable::URI.encode_component(params[:path])}", :get, params, @options)
841
+ Api.send_request("/files/#{@attributes[:path]}", :get, params, @options)
844
842
  end
845
843
 
846
844
  # Parameters:
@@ -855,7 +853,7 @@ module Files
855
853
  raise InvalidParameterError.new("Bad parameter: priority_color must be an String") if params.dig(:priority_color) and !params.dig(:priority_color).is_a?(String)
856
854
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
857
855
 
858
- Api.send_request("/files/#{Addressable::URI.encode_component(params[:path])}", :patch, params, @options)
856
+ Api.send_request("/files/#{@attributes[:path]}", :patch, params, @options)
859
857
  end
860
858
 
861
859
  # Parameters:
@@ -867,7 +865,7 @@ module Files
867
865
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
868
866
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
869
867
 
870
- Api.send_request("/files/#{Addressable::URI.encode_component(params[:path])}", :delete, params, @options)
868
+ Api.send_request("/files/#{@attributes[:path]}", :delete, params, @options)
871
869
  end
872
870
 
873
871
  def destroy(params = {})
@@ -887,7 +885,6 @@ module Files
887
885
  #
888
886
  # Parameters:
889
887
  # action - string - Can be blank, `redirect` or `stat`. If set to `stat`, we will return file information but without a download URL, and without logging a download. If set to `redirect` we will serve a 302 redirect directly to the file. This is used for integrations with Zapier, and is not recommended for most integrations.
890
- # id - int64 - If provided, lookup the file by id instead of path.
891
888
  # preview_size - string - Request a preview size. Can be `small` (default), `large`, `xlarge`, or `pdf`.
892
889
  # with_previews - boolean - Include file preview information?
893
890
  # with_priority_color - boolean - Include file priority color information?
@@ -896,11 +893,10 @@ module Files
896
893
  params[:path] = path
897
894
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
898
895
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
899
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
900
896
  raise InvalidParameterError.new("Bad parameter: preview_size must be an String") if params.dig(:preview_size) and !params.dig(:preview_size).is_a?(String)
901
897
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
902
898
 
903
- response, options = Api.send_request("/files/#{Addressable::URI.encode_component(params[:path])}", :get, params, options)
899
+ response, options = Api.send_request("/files/#{params[:path]}", :get, params, options)
904
900
  File.new(response.data, options)
905
901
  end
906
902
 
@@ -934,7 +930,7 @@ module Files
934
930
  raise InvalidParameterError.new("Bad parameter: structure must be an String") if params.dig(:structure) and !params.dig(:structure).is_a?(String)
935
931
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
936
932
 
937
- response, options = Api.send_request("/files/#{Addressable::URI.encode_component(params[:path])}", :post, params, options)
933
+ response, options = Api.send_request("/files/#{params[:path]}", :post, params, options)
938
934
  File.new(response.data, options)
939
935
  end
940
936
 
@@ -949,7 +945,7 @@ module Files
949
945
  raise InvalidParameterError.new("Bad parameter: priority_color must be an String") if params.dig(:priority_color) and !params.dig(:priority_color).is_a?(String)
950
946
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
951
947
 
952
- response, options = Api.send_request("/files/#{Addressable::URI.encode_component(params[:path])}", :patch, params, options)
948
+ response, options = Api.send_request("/files/#{params[:path]}", :patch, params, options)
953
949
  File.new(response.data, options)
954
950
  end
955
951
 
@@ -961,7 +957,7 @@ module Files
961
957
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
962
958
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
963
959
 
964
- response, _options = Api.send_request("/files/#{Addressable::URI.encode_component(params[:path])}", :delete, params, options)
960
+ response, _options = Api.send_request("/files/#{params[:path]}", :delete, params, options)
965
961
  response.data
966
962
  end
967
963
 
@@ -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