files.com 1.1.129 → 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: 3c960b9d5d4b80d65f84c05f3354cab4788805a81e360747b57d717ff4c54cba
4
- data.tar.gz: 6a0ebb8cd98134f2e5c0585f6aa22967dcdb913a25b9ffc8ff58ffd23cfe1c5c
3
+ metadata.gz: 87b62527b02e1b2c1bf9a3ef13de4d0ee943a324006aa9d9cd0cca31cfbef3e2
4
+ data.tar.gz: 203318579966bd24bb678fc8f8f8d96770b6510dea43ce0183a141fb88132830
5
5
  SHA512:
6
- metadata.gz: d61d61aad27a0451446182948ff03fb111a65e4742652c3b59abd09a51786a888247c4c0ea826b3e2948539732664a9cc740dfc2af1bdf6d3a7afe2ed77c73d9
7
- data.tar.gz: 75589ac8a351977f6a7ca868b5bdf53848ffb1b418d4847411aa94e03e413cf3cfb58c570925e3f2f7830e7254464e7cb5af34c62954bc128d8a128977498f9a
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.129
1
+ 1.1.131
data/docs/site.md CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  ```
6
6
  {
7
+ "id": 1,
7
8
  "name": "My Site",
8
9
  "additional_text_file_types": [
9
10
  "example"
@@ -285,6 +286,7 @@
285
286
  }
286
287
  ```
287
288
 
289
+ * `id` (int64): Site Id
288
290
  * `name` (string): Site name
289
291
  * `additional_text_file_types` (array(string)): Additional extensions that are considered text files
290
292
  * `allowed_2fa_method_sms` (boolean): Is SMS two factor authentication allowed?
@@ -9,6 +9,11 @@ module Files
9
9
  @options = options || {}
10
10
  end
11
11
 
12
+ # int64 - Site Id
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
12
17
  # string - Site name
13
18
  def name
14
19
  @attributes[:name]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Files
4
- VERSION = "1.1.129"
4
+ VERSION = "1.1.131"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.129
4
+ version: 1.1.131
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-09 00:00:00.000000000 Z
11
+ date: 2024-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable