files.com 1.1.130 → 1.1.131

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e4169efeb72ee02d2d20d7bd0ed7c2e2374765043f7210dc4942ab5596a7856
4
- data.tar.gz: eac3fe346a83378aa43975d0916d83c416336ee843f0acd2f4fc3981b07f1d45
3
+ metadata.gz: 87b62527b02e1b2c1bf9a3ef13de4d0ee943a324006aa9d9cd0cca31cfbef3e2
4
+ data.tar.gz: 203318579966bd24bb678fc8f8f8d96770b6510dea43ce0183a141fb88132830
5
5
  SHA512:
6
- metadata.gz: 4691bd6a6d43239fcc5fb4d205d46b44c801fe062cda8ff555f1016aca5499f2bebe144fb81c73813bf8255fbc85b78dc80768548a5b507ea189ee479aed525e
7
- data.tar.gz: 69f3f8f83c8d3e3fbef38b0fa519e0d2f8eec280a615cce1ba3dd9efce526d5629f0682edae642f770857fe473b5d27099bd254dd489e2b73c52c7debebd41fe
6
+ metadata.gz: 946fef63c7906b1455e9ede3f3582701c0663de3a52b37315c113efc900ca8acb7bc3aace91e6484e65ade5ddf71aeb66191c673f58e9b2b608c67d6c545c76a
7
+ data.tar.gz: eb645b1e5877752256ba09da1fd0697b5496869aad336efe00d3c163aff4e5687afd2b76ae361cd2237fefe92c2a99d20a764064c7a0cdc8158e9bceea4b38ed
data/README.md CHANGED
@@ -192,6 +192,93 @@ Maximum number of retries. The default value is 3.
192
192
  Files.max_network_retries = 5
193
193
  ```
194
194
 
195
+ ## Sort and Filter
196
+
197
+ Several of the Files.com API resources have list operations that return multiple instances of the resource. The List operations
198
+ can be sorted and filtered.
199
+
200
+ ### Sorting
201
+
202
+ The returned data can be sorted by passing in the ```sort_by``` method argument.
203
+
204
+ The argument value is a Ruby hash that has a key of the resource field name to sort on and a value of either ```"asc"``` or ```"desc"``` to specify the sort order.
205
+
206
+ Each resource has a set of valid fields for sorting and can be sorted by one field at a time.
207
+
208
+ ### Filters
209
+
210
+ Filters apply selection criteria to the underlying query that returns the results. Filters can be applied individually to select resource fields
211
+ and/or in a combination with each other. The results of applying filters and filter combinations can be sorted by a single field.
212
+
213
+ The passed in argument value is a Ruby hash that has a key of the resource field name to filter on and a passed in value to use in the filter comparison.
214
+
215
+ Each resource has their own set of valid filters and fields, valid combinations of filters, and sortable fields.
216
+
217
+ #### Types of Filters
218
+
219
+ ##### Exact Filter
220
+
221
+ `filter` - find resources that have an exact field value match to a passed in value. (i.e., FIELD_VALUE = PASS_IN_VALUE).
222
+
223
+ #### Range Filters
224
+
225
+ `filter_gt` - find resources that have a field value that is greater than the passed in value. (i.e., FIELD_VALUE > PASS_IN_VALUE).
226
+
227
+ `filter_gte` - find resources that have a field value that is greater than or equal to the passed in value. (i.e., FIELD_VALUE >= PASS_IN_VALUE).
228
+
229
+ `filter_lt` - find resources that have a field value that is less than the passed in value. (i.e., FIELD_VALUE < PASS_IN_VALUE).
230
+
231
+ `filter_lte` - find resources that have a field value that is less than or equal to the passed in value. (i.e., FIELD_VALUE \<= PASS_IN_VALUE).
232
+
233
+ ##### Pattern Filter
234
+
235
+ `filter_prefix` - find resources where the specified field is prefixed by the supplied value. This is applicable to values that are strings.
236
+
237
+ ```ruby title="Sort Example"
238
+ ## users sorted by username
239
+ Files.api_key = 'YOUR_API_KEY'
240
+ Files::User.list(
241
+ sort_by: { "username": "asc"}
242
+ )
243
+ ```
244
+
245
+ ```ruby title="Exact Filter Example"
246
+ ## non admin users
247
+ Files.api_key = 'YOUR_API_KEY'
248
+ Files::User.list(
249
+ filter: { not_site_admin: true },
250
+ sort_by: { "username": "asc"}
251
+ )
252
+ ```
253
+
254
+ ```ruby title="Range Filter Example"
255
+ #users who haven't logged in since 2024-01-01
256
+ Files.api_key = 'YOUR_API_KEY'
257
+ Files::User.list(
258
+ filter_gte: { "last_login_at": "2024-01-01" },
259
+ sort_by: { "last_login_at": "asc"}
260
+ )
261
+ ```
262
+
263
+ ```ruby title="Pattern Filter Example"
264
+ ## users who usernames start with 'test'
265
+ Files.api_key = 'YOUR_API_KEY'
266
+ Files::User.list(
267
+ filter_pre: { username: "test" },
268
+ sort_by: { "username": "asc"}
269
+ )
270
+ ```
271
+
272
+ ```ruby title="Combined Filter Example"
273
+ ## users who usernames start with 'test' and are not admins
274
+ Files.api_key = 'YOUR_API_KEY'
275
+ Files::User.list(
276
+ filter_prefix: { username: "test" },
277
+ filter: { not_site_admin: true },
278
+ sort_by: { "username": "asc"}
279
+ )
280
+ ```
281
+
195
282
  ## Errors
196
283
 
197
284
  The Files.com Ruby SDK will return errors by raising exceptions. There are many exception classes defined in the Files SDK that correspond
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.130
1
+ 1.1.131
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Files
4
- VERSION = "1.1.130"
4
+ VERSION = "1.1.131"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.130
4
+ version: 1.1.131
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com