files.com 1.0.85 → 1.0.90

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/SECURITY.md +24 -0
  3. data/_VERSION +1 -1
  4. data/docs/api_key.md +13 -1
  5. data/docs/app.md +12 -0
  6. data/docs/automation.md +9 -1
  7. data/docs/behavior.md +30 -14
  8. data/docs/bundle.md +8 -0
  9. data/docs/file.md +0 -4
  10. data/docs/group.md +8 -0
  11. data/docs/history.md +16 -0
  12. data/docs/ip_address.md +18 -0
  13. data/docs/message.md +11 -11
  14. data/docs/notification.md +10 -2
  15. data/docs/permission.md +11 -3
  16. data/docs/public_ip_address.md +13 -0
  17. data/docs/request.md +6 -25
  18. data/docs/session.md +2 -2
  19. data/docs/site.md +4 -0
  20. data/docs/style.md +1 -1
  21. data/docs/usage_daily_snapshot.md +8 -0
  22. data/docs/user.md +16 -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 +28 -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/message.rb +5 -5
  38. data/lib/files.com/models/notification.rb +20 -5
  39. data/lib/files.com/models/permission.rb +21 -6
  40. data/lib/files.com/models/public_ip_address.rb +22 -0
  41. data/lib/files.com/models/request.rb +15 -28
  42. data/lib/files.com/models/session.rb +1 -1
  43. data/lib/files.com/models/site.rb +6 -0
  44. data/lib/files.com/models/style.rb +8 -8
  45. data/lib/files.com/models/usage_daily_snapshot.rb +18 -3
  46. data/lib/files.com/models/user.rb +30 -5
  47. metadata +5 -2
@@ -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
 
@@ -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
 
@@ -54,7 +54,7 @@ module Files
54
54
  @attributes[:user_id] = value
55
55
  end
56
56
 
57
- # int64 - Project to attach the message to.
57
+ # int64 - Project to which the message should be attached.
58
58
  def project_id
59
59
  @attributes[:project_id]
60
60
  end
@@ -64,7 +64,7 @@ module Files
64
64
  end
65
65
 
66
66
  # Parameters:
67
- # project_id (required) - int64 - Project to attach the message to.
67
+ # project_id (required) - int64 - Project to which the message should be attached.
68
68
  # subject (required) - string - Message subject.
69
69
  # body (required) - string - Message body.
70
70
  def update(params = {})
@@ -111,7 +111,7 @@ module Files
111
111
  # page - int64 - Current page number.
112
112
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
113
113
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
114
- # project_id (required) - int64 - Project to return messages for.
114
+ # project_id (required) - int64 - Project for which to return messages.
115
115
  def self.list(params = {}, options = {})
116
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
117
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
@@ -148,7 +148,7 @@ module Files
148
148
 
149
149
  # Parameters:
150
150
  # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
151
- # project_id (required) - int64 - Project to attach the message to.
151
+ # project_id (required) - int64 - Project to which the message should be attached.
152
152
  # subject (required) - string - Message subject.
153
153
  # body (required) - string - Message body.
154
154
  def self.create(params = {}, options = {})
@@ -165,7 +165,7 @@ module Files
165
165
  end
166
166
 
167
167
  # Parameters:
168
- # project_id (required) - int64 - Project to attach the message to.
168
+ # project_id (required) - int64 - Project to which the message should be attached.
169
169
  # subject (required) - string - Message subject.
170
170
  # body (required) - string - Message body.
171
171
  def self.update(id, params = {}, options = {})