losant_rest 1.20.1 → 1.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +139 -13
  3. data/docs/_schemas.md +1413 -17
  4. data/docs/instanceNotificationRule.md +219 -0
  5. data/docs/instanceNotificationRules.md +91 -0
  6. data/lib/platform_rest/client.rb +10 -2
  7. data/lib/platform_rest/instance_notification_rule.rb +275 -0
  8. data/lib/platform_rest/instance_notification_rules.rb +136 -0
  9. data/lib/platform_rest/version.rb +1 -1
  10. data/lib/platform_rest.rb +2 -0
  11. data/schemas/apiTokenPost.json +9 -0
  12. data/schemas/applicationSearchResult.json +46 -6
  13. data/schemas/credentialLinkedResources.json +12 -0
  14. data/schemas/experienceEndpoint.json +6 -1
  15. data/schemas/experienceEndpointPatch.json +6 -1
  16. data/schemas/experienceEndpointPost.json +6 -1
  17. data/schemas/experienceEndpoints.json +6 -1
  18. data/schemas/experienceLinkedResources.json +18 -1
  19. data/schemas/flow.json +4 -0
  20. data/schemas/flowPatch.json +4 -0
  21. data/schemas/flowPost.json +4 -0
  22. data/schemas/flowVersion.json +8 -0
  23. data/schemas/flowVersionPost.json +4 -0
  24. data/schemas/flowVersions.json +8 -0
  25. data/schemas/flows.json +4 -0
  26. data/schemas/flowsImportPost.json +8 -0
  27. data/schemas/flowsImportResult.json +12 -0
  28. data/schemas/githubLogin.json +9 -0
  29. data/schemas/instance.json +9 -0
  30. data/schemas/instanceAuditLog.json +2 -1
  31. data/schemas/instanceAuditLogFilter.json +2 -1
  32. data/schemas/instanceOrg.json +4 -0
  33. data/schemas/instanceOrgs.json +4 -0
  34. data/schemas/instances.json +9 -0
  35. data/schemas/notificationRule.json +161 -0
  36. data/schemas/notificationRuleDeliveryLogs.json +123 -0
  37. data/schemas/notificationRuleEvaluationOptions.json +10 -0
  38. data/schemas/notificationRulePatch.json +128 -0
  39. data/schemas/notificationRulePost.json +140 -0
  40. data/schemas/notificationRules.json +212 -0
  41. data/schemas/samlResponse.json +9 -0
  42. data/schemas/userCredentials.json +9 -0
  43. data/schemas/userPost.json +9 -0
  44. metadata +12 -2
@@ -0,0 +1,136 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2024 Losant IoT, Inc.
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ require "json"
24
+
25
+ module PlatformRest
26
+
27
+ # Class containing all the actions for the Instance Notification Rules Resource
28
+ class InstanceNotificationRules
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Returns the notification rules for an instance
35
+ #
36
+ # Authentication:
37
+ # The client must be configured with a valid api
38
+ # access token to call this action. The token
39
+ # must include at least one of the following scopes:
40
+ # all.Instance, all.Instance.read, all.User, all.User.read, instanceNotificationRules.*, or instanceNotificationRules.get.
41
+ #
42
+ # Parameters:
43
+ # * {string} instanceId - ID associated with the instance
44
+ # * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
45
+ # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
46
+ # * {string} page - Which page of results to return
47
+ # * {string} perPage - How many items to return per page
48
+ # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
49
+ # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
50
+ # * {string} losantdomain - Domain scope of request (rarely needed)
51
+ # * {boolean} _actions - Return resource actions in response
52
+ # * {boolean} _links - Return resource link in response
53
+ # * {boolean} _embedded - Return embedded resources in response
54
+ #
55
+ # Responses:
56
+ # * 200 - Collection of notification rules (https://api.losant.com/#/definitions/notificationRules)
57
+ #
58
+ # Errors:
59
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
60
+ def get(params = {})
61
+ params = Utils.symbolize_hash_keys(params)
62
+ query_params = { _actions: false, _links: true, _embedded: true }
63
+ headers = {}
64
+ body = nil
65
+
66
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
67
+
68
+ query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
69
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
70
+ query_params[:page] = params[:page] if params.has_key?(:page)
71
+ query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
72
+ query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
73
+ query_params[:filter] = params[:filter] if params.has_key?(:filter)
74
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
75
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
76
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
77
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
78
+
79
+ path = "/instances/#{params[:instanceId]}/notification-rules"
80
+
81
+ @client.request(
82
+ method: :get,
83
+ path: path,
84
+ query: query_params,
85
+ headers: headers,
86
+ body: body)
87
+ end
88
+
89
+ # Create a new notification rule for an instance
90
+ #
91
+ # Authentication:
92
+ # The client must be configured with a valid api
93
+ # access token to call this action. The token
94
+ # must include at least one of the following scopes:
95
+ # all.Instance, all.User, instanceNotificationRules.*, or instanceNotificationRules.post.
96
+ #
97
+ # Parameters:
98
+ # * {string} instanceId - ID associated with the instance
99
+ # * {hash} notificationRule - Notification rule information (https://api.losant.com/#/definitions/notificationRulePost)
100
+ # * {string} losantdomain - Domain scope of request (rarely needed)
101
+ # * {boolean} _actions - Return resource actions in response
102
+ # * {boolean} _links - Return resource link in response
103
+ # * {boolean} _embedded - Return embedded resources in response
104
+ #
105
+ # Responses:
106
+ # * 201 - The successfully created notification rule (https://api.losant.com/#/definitions/notificationRule)
107
+ #
108
+ # Errors:
109
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
110
+ def post(params = {})
111
+ params = Utils.symbolize_hash_keys(params)
112
+ query_params = { _actions: false, _links: true, _embedded: true }
113
+ headers = {}
114
+ body = nil
115
+
116
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
117
+ raise ArgumentError.new("notificationRule is required") unless params.has_key?(:notificationRule)
118
+
119
+ body = params[:notificationRule] if params.has_key?(:notificationRule)
120
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
121
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
122
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
123
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
124
+
125
+ path = "/instances/#{params[:instanceId]}/notification-rules"
126
+
127
+ @client.request(
128
+ method: :post,
129
+ path: path,
130
+ query: query_params,
131
+ headers: headers,
132
+ body: body)
133
+ end
134
+
135
+ end
136
+ end
@@ -21,5 +21,5 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  module PlatformRest
24
- VERSION = "1.20.1"
24
+ VERSION = "1.21.0"
25
25
  end
data/lib/platform_rest.rb CHANGED
@@ -89,6 +89,8 @@ require_relative "platform_rest/instance_custom_node"
89
89
  require_relative "platform_rest/instance_custom_nodes"
90
90
  require_relative "platform_rest/instance_member"
91
91
  require_relative "platform_rest/instance_members"
92
+ require_relative "platform_rest/instance_notification_rule"
93
+ require_relative "platform_rest/instance_notification_rules"
92
94
  require_relative "platform_rest/instance_org"
93
95
  require_relative "platform_rest/instance_org_invite"
94
96
  require_relative "platform_rest/instance_org_invites"
@@ -430,6 +430,15 @@
430
430
  "instanceCustomNode.delete",
431
431
  "instanceCustomNode.errors",
432
432
  "instanceCustomNode.stats",
433
+ "instanceNotificationRules.*",
434
+ "instanceNotificationRules.get",
435
+ "instanceNotificationRules.post",
436
+ "instanceNotificationRule.*",
437
+ "instanceNotificationRule.get",
438
+ "instanceNotificationRule.patch",
439
+ "instanceNotificationRule.delete",
440
+ "instanceNotificationRule.evaluate",
441
+ "instanceNotificationRule.logs",
433
442
  "instanceSandbox.*",
434
443
  "instanceSandbox.get",
435
444
  "instanceSandbox.delete",
@@ -12,18 +12,57 @@
12
12
  "type": "string"
13
13
  },
14
14
  "metadata": {
15
- "type": "object"
16
- },
17
- "viewType": {
18
- "type": "string"
15
+ "type": "object",
16
+ "properties": {
17
+ "descriptor": {
18
+ "type": "string"
19
+ },
20
+ "parentDirectory": {
21
+ "type": "string"
22
+ },
23
+ "contentType": {
24
+ "type": "string"
25
+ }
26
+ }
19
27
  },
20
28
  "version": {
21
29
  "type": "string"
22
30
  },
31
+ "viewType": {
32
+ "type": "string",
33
+ "enum": [
34
+ "layout",
35
+ "page",
36
+ "component"
37
+ ]
38
+ },
39
+ "flowClass": {
40
+ "type": "string",
41
+ "enum": [
42
+ "standalone",
43
+ "gateway",
44
+ "peripheral",
45
+ "floating",
46
+ "edgeCompute",
47
+ "system",
48
+ "embedded"
49
+ ]
50
+ },
51
+ "deviceClass": {
52
+ "type": "string",
53
+ "enum": [
54
+ "cloud",
55
+ "edge",
56
+ "embedded",
57
+ "experience",
58
+ "customNode"
59
+ ]
60
+ },
23
61
  "_type": {
24
62
  "type": "string",
25
63
  "enum": [
26
64
  "applicationApiToken",
65
+ "credential",
27
66
  "dashboard",
28
67
  "dataTable",
29
68
  "deviceRecipe",
@@ -39,8 +78,9 @@
39
78
  "file",
40
79
  "flow",
41
80
  "integration",
42
- "webhook",
43
- "notebook"
81
+ "notebook",
82
+ "resourceJob",
83
+ "webhook"
44
84
  ]
45
85
  }
46
86
  },
@@ -798,6 +798,10 @@
798
798
  }
799
799
  },
800
800
  "maxItems": 100
801
+ },
802
+ "configName": {
803
+ "type": "string",
804
+ "maxLength": 1024
801
805
  }
802
806
  },
803
807
  "additionalProperties": false
@@ -3925,6 +3929,10 @@
3925
3929
  }
3926
3930
  },
3927
3931
  "maxItems": 100
3932
+ },
3933
+ "configName": {
3934
+ "type": "string",
3935
+ "maxLength": 1024
3928
3936
  }
3929
3937
  },
3930
3938
  "additionalProperties": false
@@ -6961,6 +6969,10 @@
6961
6969
  }
6962
6970
  },
6963
6971
  "maxItems": 100
6972
+ },
6973
+ "configName": {
6974
+ "type": "string",
6975
+ "maxLength": 1024
6964
6976
  }
6965
6977
  },
6966
6978
  "additionalProperties": false
@@ -74,9 +74,14 @@
74
74
  "enum": [
75
75
  "public",
76
76
  "authenticated",
77
- "group"
77
+ "group",
78
+ "device"
78
79
  ]
79
80
  },
81
+ "deviceIdTemplate": {
82
+ "type": "string",
83
+ "maxLength": 255
84
+ },
80
85
  "endpointTags": {
81
86
  "type": "object",
82
87
  "patternProperties": {
@@ -30,9 +30,14 @@
30
30
  "enum": [
31
31
  "public",
32
32
  "authenticated",
33
- "group"
33
+ "group",
34
+ "device"
34
35
  ]
35
36
  },
37
+ "deviceIdTemplate": {
38
+ "type": "string",
39
+ "maxLength": 255
40
+ },
36
41
  "endpointTags": {
37
42
  "type": "object",
38
43
  "patternProperties": {
@@ -30,9 +30,14 @@
30
30
  "enum": [
31
31
  "public",
32
32
  "authenticated",
33
- "group"
33
+ "group",
34
+ "device"
34
35
  ]
35
36
  },
37
+ "deviceIdTemplate": {
38
+ "type": "string",
39
+ "maxLength": 255
40
+ },
36
41
  "endpointTags": {
37
42
  "type": "object",
38
43
  "patternProperties": {
@@ -81,9 +81,14 @@
81
81
  "enum": [
82
82
  "public",
83
83
  "authenticated",
84
- "group"
84
+ "group",
85
+ "device"
85
86
  ]
86
87
  },
88
+ "deviceIdTemplate": {
89
+ "type": "string",
90
+ "maxLength": 255
91
+ },
87
92
  "endpointTags": {
88
93
  "type": "object",
89
94
  "patternProperties": {
@@ -245,9 +245,14 @@
245
245
  "enum": [
246
246
  "public",
247
247
  "authenticated",
248
- "group"
248
+ "group",
249
+ "device"
249
250
  ]
250
251
  },
252
+ "deviceIdTemplate": {
253
+ "type": "string",
254
+ "maxLength": 255
255
+ },
251
256
  "endpointTags": {
252
257
  "type": "object",
253
258
  "patternProperties": {
@@ -780,6 +785,10 @@
780
785
  }
781
786
  },
782
787
  "maxItems": 100
788
+ },
789
+ "configName": {
790
+ "type": "string",
791
+ "maxLength": 1024
783
792
  }
784
793
  },
785
794
  "additionalProperties": false
@@ -3907,6 +3916,10 @@
3907
3916
  }
3908
3917
  },
3909
3918
  "maxItems": 100
3919
+ },
3920
+ "configName": {
3921
+ "type": "string",
3922
+ "maxLength": 1024
3910
3923
  }
3911
3924
  },
3912
3925
  "additionalProperties": false
@@ -6943,6 +6956,10 @@
6943
6956
  }
6944
6957
  },
6945
6958
  "maxItems": 100
6959
+ },
6960
+ "configName": {
6961
+ "type": "string",
6962
+ "maxLength": 1024
6946
6963
  }
6947
6964
  },
6948
6965
  "additionalProperties": false
data/schemas/flow.json CHANGED
@@ -389,6 +389,10 @@
389
389
  }
390
390
  },
391
391
  "maxItems": 100
392
+ },
393
+ "configName": {
394
+ "type": "string",
395
+ "maxLength": 1024
392
396
  }
393
397
  },
394
398
  "additionalProperties": false
@@ -346,6 +346,10 @@
346
346
  }
347
347
  },
348
348
  "maxItems": 100
349
+ },
350
+ "configName": {
351
+ "type": "string",
352
+ "maxLength": 1024
349
353
  }
350
354
  },
351
355
  "additionalProperties": false
@@ -335,6 +335,10 @@
335
335
  }
336
336
  },
337
337
  "maxItems": 100
338
+ },
339
+ "configName": {
340
+ "type": "string",
341
+ "maxLength": 1024
338
342
  }
339
343
  },
340
344
  "additionalProperties": false
@@ -364,6 +364,10 @@
364
364
  }
365
365
  },
366
366
  "maxItems": 100
367
+ },
368
+ "configName": {
369
+ "type": "string",
370
+ "maxLength": 1024
367
371
  }
368
372
  },
369
373
  "additionalProperties": false
@@ -3400,6 +3404,10 @@
3400
3404
  }
3401
3405
  },
3402
3406
  "maxItems": 100
3407
+ },
3408
+ "configName": {
3409
+ "type": "string",
3410
+ "maxLength": 1024
3403
3411
  }
3404
3412
  },
3405
3413
  "additionalProperties": false
@@ -304,6 +304,10 @@
304
304
  }
305
305
  },
306
306
  "maxItems": 100
307
+ },
308
+ "configName": {
309
+ "type": "string",
310
+ "maxLength": 1024
307
311
  }
308
312
  },
309
313
  "additionalProperties": false
@@ -371,6 +371,10 @@
371
371
  }
372
372
  },
373
373
  "maxItems": 100
374
+ },
375
+ "configName": {
376
+ "type": "string",
377
+ "maxLength": 1024
374
378
  }
375
379
  },
376
380
  "additionalProperties": false
@@ -3407,6 +3411,10 @@
3407
3411
  }
3408
3412
  },
3409
3413
  "maxItems": 100
3414
+ },
3415
+ "configName": {
3416
+ "type": "string",
3417
+ "maxLength": 1024
3410
3418
  }
3411
3419
  },
3412
3420
  "additionalProperties": false
data/schemas/flows.json CHANGED
@@ -396,6 +396,10 @@
396
396
  }
397
397
  },
398
398
  "maxItems": 100
399
+ },
400
+ "configName": {
401
+ "type": "string",
402
+ "maxLength": 1024
399
403
  }
400
404
  },
401
405
  "additionalProperties": false
@@ -349,6 +349,10 @@
349
349
  }
350
350
  },
351
351
  "maxItems": 100
352
+ },
353
+ "configName": {
354
+ "type": "string",
355
+ "maxLength": 1024
352
356
  }
353
357
  },
354
358
  "additionalProperties": false
@@ -3374,6 +3378,10 @@
3374
3378
  }
3375
3379
  },
3376
3380
  "maxItems": 100
3381
+ },
3382
+ "configName": {
3383
+ "type": "string",
3384
+ "maxLength": 1024
3377
3385
  }
3378
3386
  },
3379
3387
  "additionalProperties": false
@@ -397,6 +397,10 @@
397
397
  }
398
398
  },
399
399
  "maxItems": 100
400
+ },
401
+ "configName": {
402
+ "type": "string",
403
+ "maxLength": 1024
400
404
  }
401
405
  },
402
406
  "additionalProperties": false
@@ -3473,6 +3477,10 @@
3473
3477
  }
3474
3478
  },
3475
3479
  "maxItems": 100
3480
+ },
3481
+ "configName": {
3482
+ "type": "string",
3483
+ "maxLength": 1024
3476
3484
  }
3477
3485
  },
3478
3486
  "additionalProperties": false
@@ -6509,6 +6517,10 @@
6509
6517
  }
6510
6518
  },
6511
6519
  "maxItems": 100
6520
+ },
6521
+ "configName": {
6522
+ "type": "string",
6523
+ "maxLength": 1024
6512
6524
  }
6513
6525
  },
6514
6526
  "additionalProperties": false
@@ -422,6 +422,15 @@
422
422
  "instanceCustomNode.delete",
423
423
  "instanceCustomNode.errors",
424
424
  "instanceCustomNode.stats",
425
+ "instanceNotificationRules.*",
426
+ "instanceNotificationRules.get",
427
+ "instanceNotificationRules.post",
428
+ "instanceNotificationRule.*",
429
+ "instanceNotificationRule.get",
430
+ "instanceNotificationRule.patch",
431
+ "instanceNotificationRule.delete",
432
+ "instanceNotificationRule.evaluate",
433
+ "instanceNotificationRule.logs",
425
434
  "instanceSandbox.*",
426
435
  "instanceSandbox.get",
427
436
  "instanceSandbox.delete",
@@ -93,6 +93,15 @@
93
93
  "organization": {
94
94
  "type": "integer"
95
95
  },
96
+ "instanceApiToken": {
97
+ "type": "integer"
98
+ },
99
+ "instanceNotificationRule": {
100
+ "type": "integer"
101
+ },
102
+ "instanceCustomNode": {
103
+ "type": "integer"
104
+ },
96
105
  "apitoken": {
97
106
  "type": "integer"
98
107
  },
@@ -28,7 +28,8 @@
28
28
  "Organization",
29
29
  "ApiToken",
30
30
  "User",
31
- "InstanceCustomNode"
31
+ "InstanceCustomNode",
32
+ "NotificationRule"
32
33
  ]
33
34
  },
34
35
  "primaryTargetName": {
@@ -17,7 +17,8 @@
17
17
  "Organization",
18
18
  "ApiToken",
19
19
  "User",
20
- "InstanceCustomNode"
20
+ "InstanceCustomNode",
21
+ "NotificationRule"
21
22
  ]
22
23
  },
23
24
  "name": {
@@ -19,6 +19,10 @@
19
19
  "type": "string",
20
20
  "pattern": "^[A-Fa-f\\d]{24}$"
21
21
  },
22
+ "orgId": {
23
+ "type": "string",
24
+ "pattern": "^[A-Fa-f\\d]{24}$"
25
+ },
22
26
  "instanceId": {
23
27
  "type": "string",
24
28
  "pattern": "^[A-Fa-f\\d]{24}$"
@@ -26,6 +26,10 @@
26
26
  "type": "string",
27
27
  "pattern": "^[A-Fa-f\\d]{24}$"
28
28
  },
29
+ "orgId": {
30
+ "type": "string",
31
+ "pattern": "^[A-Fa-f\\d]{24}$"
32
+ },
29
33
  "instanceId": {
30
34
  "type": "string",
31
35
  "pattern": "^[A-Fa-f\\d]{24}$"
@@ -100,6 +100,15 @@
100
100
  "organization": {
101
101
  "type": "integer"
102
102
  },
103
+ "instanceApiToken": {
104
+ "type": "integer"
105
+ },
106
+ "instanceNotificationRule": {
107
+ "type": "integer"
108
+ },
109
+ "instanceCustomNode": {
110
+ "type": "integer"
111
+ },
103
112
  "apitoken": {
104
113
  "type": "integer"
105
114
  },