losant_rest 1.20.0 → 1.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +139 -13
  3. data/docs/_schemas.md +7585 -2999
  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/applicationDashboardPost.json +94 -8
  13. data/schemas/applicationSearchResult.json +46 -6
  14. data/schemas/credentialLinkedResources.json +426 -0
  15. data/schemas/dashboard.json +94 -8
  16. data/schemas/dashboardPatch.json +94 -8
  17. data/schemas/dashboardPost.json +94 -8
  18. data/schemas/dashboards.json +94 -8
  19. data/schemas/experienceEndpoint.json +6 -1
  20. data/schemas/experienceEndpointPatch.json +6 -1
  21. data/schemas/experienceEndpointPost.json +6 -1
  22. data/schemas/experienceEndpoints.json +6 -1
  23. data/schemas/experienceLinkedResources.json +432 -1
  24. data/schemas/flow.json +142 -0
  25. data/schemas/flowPatch.json +142 -0
  26. data/schemas/flowPost.json +142 -0
  27. data/schemas/flowVersion.json +284 -0
  28. data/schemas/flowVersionPost.json +142 -0
  29. data/schemas/flowVersions.json +284 -0
  30. data/schemas/flows.json +142 -0
  31. data/schemas/flowsImportPost.json +284 -0
  32. data/schemas/flowsImportResult.json +426 -0
  33. data/schemas/githubLogin.json +9 -0
  34. data/schemas/instance.json +9 -0
  35. data/schemas/instanceAuditLog.json +2 -1
  36. data/schemas/instanceAuditLogFilter.json +2 -1
  37. data/schemas/instanceOrg.json +4 -0
  38. data/schemas/instanceOrgs.json +4 -0
  39. data/schemas/instances.json +9 -0
  40. data/schemas/notificationRule.json +161 -0
  41. data/schemas/notificationRuleDeliveryLogs.json +123 -0
  42. data/schemas/notificationRuleEvaluationOptions.json +10 -0
  43. data/schemas/notificationRulePatch.json +128 -0
  44. data/schemas/notificationRulePost.json +140 -0
  45. data/schemas/notificationRules.json +212 -0
  46. data/schemas/samlResponse.json +9 -0
  47. data/schemas/userCredentials.json +9 -0
  48. data/schemas/userPost.json +9 -0
  49. metadata +12 -2
@@ -0,0 +1,219 @@
1
+ # Instance Notification Rule Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Instance Notification Rule resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Delete](#delete)
10
+ * [Evaluate](#evaluate)
11
+ * [Get](#get)
12
+ * [Logs](#logs)
13
+ * [Patch](#patch)
14
+
15
+ <br/>
16
+
17
+ ## Delete
18
+
19
+ Deletes a notification rule
20
+
21
+ ```ruby
22
+ result = client.instance_notification_rule.delete(
23
+ instanceId: my_instance_id,
24
+ notificationRuleId: my_notification_rule_id)
25
+
26
+ puts result
27
+ ```
28
+
29
+ #### Authentication
30
+ The client must be configured with a valid api access token to call this
31
+ action. The token must include at least one of the following scopes:
32
+ all.Instance, all.User, instanceNotificationRule.*, or instanceNotificationRule.delete.
33
+
34
+ #### Available Parameters
35
+
36
+ | Name | Type | Required | Description | Default | Example |
37
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
38
+ | instanceId | string | Y | ID associated with the instance | | 575ec7417ae143cd83dc4a96 |
39
+ | notificationRuleId | string | Y | ID associated with the notification rule | | 575ec7417ae143cd83dc4a95 |
40
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
41
+
42
+ #### Successful Responses
43
+
44
+ | Code | Type | Description |
45
+ | ---- | ---- | ----------- |
46
+ | 200 | [Success](_schemas.md#success) | If notification rule was successfully deleted |
47
+
48
+ #### Error Responses
49
+
50
+ | Code | Type | Description |
51
+ | ---- | ---- | ----------- |
52
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
53
+ | 404 | [Error](_schemas.md#error) | Error if notification rule was not found |
54
+
55
+ <br/>
56
+
57
+ ## Evaluate
58
+
59
+ Queues the evaluation of a notification rule
60
+
61
+ ```ruby
62
+ result = client.instance_notification_rule.evaluate(
63
+ instanceId: my_instance_id,
64
+ notificationRuleId: my_notification_rule_id,
65
+ evaluationOptions: my_evaluation_options)
66
+
67
+ puts result
68
+ ```
69
+
70
+ #### Authentication
71
+ The client must be configured with a valid api access token to call this
72
+ action. The token must include at least one of the following scopes:
73
+ all.Instance, all.User, instanceNotificationRule.*, or instanceNotificationRule.evaluate.
74
+
75
+ #### Available Parameters
76
+
77
+ | Name | Type | Required | Description | Default | Example |
78
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
79
+ | instanceId | string | Y | ID associated with the instance | | 575ec7417ae143cd83dc4a96 |
80
+ | notificationRuleId | string | Y | ID associated with the notification rule | | 575ec7417ae143cd83dc4a95 |
81
+ | evaluationOptions | [Notification Rule Evaluation Options](_schemas.md#notification-rule-evaluation-options) | Y | The options for the evaluation | | [Notification Rule Evaluation Options Example](_schemas.md#notification-rule-evaluation-options-example) |
82
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
83
+
84
+ #### Successful Responses
85
+
86
+ | Code | Type | Description |
87
+ | ---- | ---- | ----------- |
88
+ | 202 | [Job Enqueued API Result](_schemas.md#job-enqueued-api-result) | If the evaluation was successfully queued |
89
+
90
+ #### Error Responses
91
+
92
+ | Code | Type | Description |
93
+ | ---- | ---- | ----------- |
94
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
95
+ | 404 | [Error](_schemas.md#error) | Error if notification rule was not found |
96
+
97
+ <br/>
98
+
99
+ ## Get
100
+
101
+ Retrieves information on a notification rule
102
+
103
+ ```ruby
104
+ result = client.instance_notification_rule.get(
105
+ instanceId: my_instance_id,
106
+ notificationRuleId: my_notification_rule_id)
107
+
108
+ puts result
109
+ ```
110
+
111
+ #### Authentication
112
+ The client must be configured with a valid api access token to call this
113
+ action. The token must include at least one of the following scopes:
114
+ all.Instance, all.Instance.read, all.User, all.User.read, instanceNotificationRule.*, or instanceNotificationRule.get.
115
+
116
+ #### Available Parameters
117
+
118
+ | Name | Type | Required | Description | Default | Example |
119
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
120
+ | instanceId | string | Y | ID associated with the instance | | 575ec7417ae143cd83dc4a96 |
121
+ | notificationRuleId | string | Y | ID associated with the notification rule | | 575ec7417ae143cd83dc4a95 |
122
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
123
+
124
+ #### Successful Responses
125
+
126
+ | Code | Type | Description |
127
+ | ---- | ---- | ----------- |
128
+ | 200 | [Notification Rule](_schemas.md#notification-rule) | Notification rule information |
129
+
130
+ #### Error Responses
131
+
132
+ | Code | Type | Description |
133
+ | ---- | ---- | ----------- |
134
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
135
+ | 404 | [Error](_schemas.md#error) | Error if notification rule was not found |
136
+
137
+ <br/>
138
+
139
+ ## Logs
140
+
141
+ Retrieves information on notification rule deliveries
142
+
143
+ ```ruby
144
+ result = client.instance_notification_rule.logs(
145
+ instanceId: my_instance_id,
146
+ notificationRuleId: my_notification_rule_id)
147
+
148
+ puts result
149
+ ```
150
+
151
+ #### Authentication
152
+ The client must be configured with a valid api access token to call this
153
+ action. The token must include at least one of the following scopes:
154
+ all.Instance, all.User, instanceNotificationRule.*, or instanceNotificationRule.logs.
155
+
156
+ #### Available Parameters
157
+
158
+ | Name | Type | Required | Description | Default | Example |
159
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
160
+ | instanceId | string | Y | ID associated with the instance | | 575ec7417ae143cd83dc4a96 |
161
+ | notificationRuleId | string | Y | ID associated with the notification rule | | 575ec7417ae143cd83dc4a95 |
162
+ | limit | string | N | Max log entries to return (ordered by time descending) | 1 | 10 |
163
+ | since | string | N | Look for log entries since this time (ms since epoch) | | 1465790400000 |
164
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
165
+
166
+ #### Successful Responses
167
+
168
+ | Code | Type | Description |
169
+ | ---- | ---- | ----------- |
170
+ | 200 | [Notification Rule Delivery Logs](_schemas.md#notification-rule-delivery-logs) | Notification delivery information |
171
+
172
+ #### Error Responses
173
+
174
+ | Code | Type | Description |
175
+ | ---- | ---- | ----------- |
176
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
177
+ | 404 | [Error](_schemas.md#error) | Error if notification rule was not found |
178
+
179
+ <br/>
180
+
181
+ ## Patch
182
+
183
+ Updates information about a notification rule
184
+
185
+ ```ruby
186
+ result = client.instance_notification_rule.patch(
187
+ instanceId: my_instance_id,
188
+ notificationRuleId: my_notification_rule_id,
189
+ notificationRule: my_notification_rule)
190
+
191
+ puts result
192
+ ```
193
+
194
+ #### Authentication
195
+ The client must be configured with a valid api access token to call this
196
+ action. The token must include at least one of the following scopes:
197
+ all.Instance, all.User, instanceNotificationRule.*, or instanceNotificationRule.patch.
198
+
199
+ #### Available Parameters
200
+
201
+ | Name | Type | Required | Description | Default | Example |
202
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
203
+ | instanceId | string | Y | ID associated with the instance | | 575ec7417ae143cd83dc4a96 |
204
+ | notificationRuleId | string | Y | ID associated with the notification rule | | 575ec7417ae143cd83dc4a95 |
205
+ | notificationRule | [Notification Rule Patch](_schemas.md#notification-rule-patch) | Y | Object containing new properties of the notification rule | | [Notification Rule Patch Example](_schemas.md#notification-rule-patch-example) |
206
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
207
+
208
+ #### Successful Responses
209
+
210
+ | Code | Type | Description |
211
+ | ---- | ---- | ----------- |
212
+ | 200 | [Notification Rule](_schemas.md#notification-rule) | Updated notification rule information |
213
+
214
+ #### Error Responses
215
+
216
+ | Code | Type | Description |
217
+ | ---- | ---- | ----------- |
218
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
219
+ | 404 | [Error](_schemas.md#error) | Error if notification rule was not found |
@@ -0,0 +1,91 @@
1
+ # Instance Notification Rules Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Instance Notification Rules resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Get](#get)
10
+ * [Post](#post)
11
+
12
+ <br/>
13
+
14
+ ## Get
15
+
16
+ Returns the notification rules for an instance
17
+
18
+ ```ruby
19
+ result = client.instance_notification_rules.get(instanceId: my_instance_id)
20
+
21
+ puts result
22
+ ```
23
+
24
+ #### Authentication
25
+ The client must be configured with a valid api access token to call this
26
+ action. The token must include at least one of the following scopes:
27
+ all.Instance, all.Instance.read, all.User, all.User.read, instanceNotificationRules.*, or instanceNotificationRules.get.
28
+
29
+ #### Available Parameters
30
+
31
+ | Name | Type | Required | Description | Default | Example |
32
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
33
+ | instanceId | string | Y | ID associated with the instance | | 575ec7417ae143cd83dc4a96 |
34
+ | sortField | string | N | Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated | name | name |
35
+ | sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
36
+ | page | string | N | Which page of results to return | 0 | 0 |
37
+ | perPage | string | N | How many items to return per page | 100 | 10 |
38
+ | filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | key |
39
+ | filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*rule |
40
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
41
+
42
+ #### Successful Responses
43
+
44
+ | Code | Type | Description |
45
+ | ---- | ---- | ----------- |
46
+ | 200 | [Notification Rules](_schemas.md#notification-rules) | Collection of notification rules |
47
+
48
+ #### Error Responses
49
+
50
+ | Code | Type | Description |
51
+ | ---- | ---- | ----------- |
52
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
53
+
54
+ <br/>
55
+
56
+ ## Post
57
+
58
+ Create a new notification rule for an instance
59
+
60
+ ```ruby
61
+ result = client.instance_notification_rules.post(
62
+ instanceId: my_instance_id,
63
+ notificationRule: my_notification_rule)
64
+
65
+ puts result
66
+ ```
67
+
68
+ #### Authentication
69
+ The client must be configured with a valid api access token to call this
70
+ action. The token must include at least one of the following scopes:
71
+ all.Instance, all.User, instanceNotificationRules.*, or instanceNotificationRules.post.
72
+
73
+ #### Available Parameters
74
+
75
+ | Name | Type | Required | Description | Default | Example |
76
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
77
+ | instanceId | string | Y | ID associated with the instance | | 575ec7417ae143cd83dc4a96 |
78
+ | notificationRule | [Notification Rule Post](_schemas.md#notification-rule-post) | Y | Notification rule information | | [Notification Rule Post Example](_schemas.md#notification-rule-post-example) |
79
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
80
+
81
+ #### Successful Responses
82
+
83
+ | Code | Type | Description |
84
+ | ---- | ---- | ----------- |
85
+ | 201 | [Notification Rule](_schemas.md#notification-rule) | The successfully created notification rule |
86
+
87
+ #### Error Responses
88
+
89
+ | Code | Type | Description |
90
+ | ---- | ---- | ----------- |
91
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
@@ -27,7 +27,7 @@ module PlatformRest
27
27
  #
28
28
  # User API for accessing platform data
29
29
  #
30
- # Built For Version 1.26.9
30
+ # Built For Version 1.27.0
31
31
  class Client
32
32
  attr_accessor :auth_token, :url
33
33
 
@@ -300,6 +300,14 @@ module PlatformRest
300
300
  @instance_members ||= InstanceMembers.new(self)
301
301
  end
302
302
 
303
+ def instance_notification_rule
304
+ @instance_notification_rule ||= InstanceNotificationRule.new(self)
305
+ end
306
+
307
+ def instance_notification_rules
308
+ @instance_notification_rules ||= InstanceNotificationRules.new(self)
309
+ end
310
+
303
311
  def instance_org
304
312
  @instance_org ||= InstanceOrg.new(self)
305
313
  end
@@ -398,7 +406,7 @@ module PlatformRest
398
406
 
399
407
  headers["Accept"] = "application/json"
400
408
  headers["Content-Type"] = "application/json"
401
- headers["Accept-Version"] = "^1.26.9"
409
+ headers["Accept-Version"] = "^1.27.0"
402
410
  headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
403
411
  path = self.url + options.fetch(:path, "")
404
412
 
@@ -0,0 +1,275 @@
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 Rule Resource
28
+ class InstanceNotificationRule
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Deletes a notification rule
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.User, instanceNotificationRule.*, or instanceNotificationRule.delete.
41
+ #
42
+ # Parameters:
43
+ # * {string} instanceId - ID associated with the instance
44
+ # * {string} notificationRuleId - ID associated with the notification rule
45
+ # * {string} losantdomain - Domain scope of request (rarely needed)
46
+ # * {boolean} _actions - Return resource actions in response
47
+ # * {boolean} _links - Return resource link in response
48
+ # * {boolean} _embedded - Return embedded resources in response
49
+ #
50
+ # Responses:
51
+ # * 200 - If notification rule was successfully deleted (https://api.losant.com/#/definitions/success)
52
+ #
53
+ # Errors:
54
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
55
+ # * 404 - Error if notification rule was not found (https://api.losant.com/#/definitions/error)
56
+ def delete(params = {})
57
+ params = Utils.symbolize_hash_keys(params)
58
+ query_params = { _actions: false, _links: true, _embedded: true }
59
+ headers = {}
60
+ body = nil
61
+
62
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
63
+ raise ArgumentError.new("notificationRuleId is required") unless params.has_key?(:notificationRuleId)
64
+
65
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
66
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
67
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
68
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
69
+
70
+ path = "/instances/#{params[:instanceId]}/notification-rules/#{params[:notificationRuleId]}"
71
+
72
+ @client.request(
73
+ method: :delete,
74
+ path: path,
75
+ query: query_params,
76
+ headers: headers,
77
+ body: body)
78
+ end
79
+
80
+ # Queues the evaluation of a notification rule
81
+ #
82
+ # Authentication:
83
+ # The client must be configured with a valid api
84
+ # access token to call this action. The token
85
+ # must include at least one of the following scopes:
86
+ # all.Instance, all.User, instanceNotificationRule.*, or instanceNotificationRule.evaluate.
87
+ #
88
+ # Parameters:
89
+ # * {string} instanceId - ID associated with the instance
90
+ # * {string} notificationRuleId - ID associated with the notification rule
91
+ # * {hash} evaluationOptions - The options for the evaluation (https://api.losant.com/#/definitions/notificationRuleEvaluationOptions)
92
+ # * {string} losantdomain - Domain scope of request (rarely needed)
93
+ # * {boolean} _actions - Return resource actions in response
94
+ # * {boolean} _links - Return resource link in response
95
+ # * {boolean} _embedded - Return embedded resources in response
96
+ #
97
+ # Responses:
98
+ # * 202 - If the evaluation was successfully queued (https://api.losant.com/#/definitions/jobEnqueuedResult)
99
+ #
100
+ # Errors:
101
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
102
+ # * 404 - Error if notification rule was not found (https://api.losant.com/#/definitions/error)
103
+ def evaluate(params = {})
104
+ params = Utils.symbolize_hash_keys(params)
105
+ query_params = { _actions: false, _links: true, _embedded: true }
106
+ headers = {}
107
+ body = nil
108
+
109
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
110
+ raise ArgumentError.new("notificationRuleId is required") unless params.has_key?(:notificationRuleId)
111
+ raise ArgumentError.new("evaluationOptions is required") unless params.has_key?(:evaluationOptions)
112
+
113
+ body = params[:evaluationOptions] if params.has_key?(:evaluationOptions)
114
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
115
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
116
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
117
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
118
+
119
+ path = "/instances/#{params[:instanceId]}/notification-rules/#{params[:notificationRuleId]}/evaluate"
120
+
121
+ @client.request(
122
+ method: :post,
123
+ path: path,
124
+ query: query_params,
125
+ headers: headers,
126
+ body: body)
127
+ end
128
+
129
+ # Retrieves information on a notification rule
130
+ #
131
+ # Authentication:
132
+ # The client must be configured with a valid api
133
+ # access token to call this action. The token
134
+ # must include at least one of the following scopes:
135
+ # all.Instance, all.Instance.read, all.User, all.User.read, instanceNotificationRule.*, or instanceNotificationRule.get.
136
+ #
137
+ # Parameters:
138
+ # * {string} instanceId - ID associated with the instance
139
+ # * {string} notificationRuleId - ID associated with the notification rule
140
+ # * {string} losantdomain - Domain scope of request (rarely needed)
141
+ # * {boolean} _actions - Return resource actions in response
142
+ # * {boolean} _links - Return resource link in response
143
+ # * {boolean} _embedded - Return embedded resources in response
144
+ #
145
+ # Responses:
146
+ # * 200 - Notification rule information (https://api.losant.com/#/definitions/notificationRule)
147
+ #
148
+ # Errors:
149
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
150
+ # * 404 - Error if notification rule was not found (https://api.losant.com/#/definitions/error)
151
+ def get(params = {})
152
+ params = Utils.symbolize_hash_keys(params)
153
+ query_params = { _actions: false, _links: true, _embedded: true }
154
+ headers = {}
155
+ body = nil
156
+
157
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
158
+ raise ArgumentError.new("notificationRuleId is required") unless params.has_key?(:notificationRuleId)
159
+
160
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
161
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
162
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
163
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
164
+
165
+ path = "/instances/#{params[:instanceId]}/notification-rules/#{params[:notificationRuleId]}"
166
+
167
+ @client.request(
168
+ method: :get,
169
+ path: path,
170
+ query: query_params,
171
+ headers: headers,
172
+ body: body)
173
+ end
174
+
175
+ # Retrieves information on notification rule deliveries
176
+ #
177
+ # Authentication:
178
+ # The client must be configured with a valid api
179
+ # access token to call this action. The token
180
+ # must include at least one of the following scopes:
181
+ # all.Instance, all.User, instanceNotificationRule.*, or instanceNotificationRule.logs.
182
+ #
183
+ # Parameters:
184
+ # * {string} instanceId - ID associated with the instance
185
+ # * {string} notificationRuleId - ID associated with the notification rule
186
+ # * {string} limit - Max log entries to return (ordered by time descending)
187
+ # * {string} since - Look for log entries since this time (ms since epoch)
188
+ # * {string} losantdomain - Domain scope of request (rarely needed)
189
+ # * {boolean} _actions - Return resource actions in response
190
+ # * {boolean} _links - Return resource link in response
191
+ # * {boolean} _embedded - Return embedded resources in response
192
+ #
193
+ # Responses:
194
+ # * 200 - Notification delivery information (https://api.losant.com/#/definitions/notificationRuleDeliveryLogs)
195
+ #
196
+ # Errors:
197
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
198
+ # * 404 - Error if notification rule was not found (https://api.losant.com/#/definitions/error)
199
+ def logs(params = {})
200
+ params = Utils.symbolize_hash_keys(params)
201
+ query_params = { _actions: false, _links: true, _embedded: true }
202
+ headers = {}
203
+ body = nil
204
+
205
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
206
+ raise ArgumentError.new("notificationRuleId is required") unless params.has_key?(:notificationRuleId)
207
+
208
+ query_params[:limit] = params[:limit] if params.has_key?(:limit)
209
+ query_params[:since] = params[:since] if params.has_key?(:since)
210
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
211
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
212
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
213
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
214
+
215
+ path = "/instances/#{params[:instanceId]}/notification-rules/#{params[:notificationRuleId]}/logs"
216
+
217
+ @client.request(
218
+ method: :get,
219
+ path: path,
220
+ query: query_params,
221
+ headers: headers,
222
+ body: body)
223
+ end
224
+
225
+ # Updates information about a notification rule
226
+ #
227
+ # Authentication:
228
+ # The client must be configured with a valid api
229
+ # access token to call this action. The token
230
+ # must include at least one of the following scopes:
231
+ # all.Instance, all.User, instanceNotificationRule.*, or instanceNotificationRule.patch.
232
+ #
233
+ # Parameters:
234
+ # * {string} instanceId - ID associated with the instance
235
+ # * {string} notificationRuleId - ID associated with the notification rule
236
+ # * {hash} notificationRule - Object containing new properties of the notification rule (https://api.losant.com/#/definitions/notificationRulePatch)
237
+ # * {string} losantdomain - Domain scope of request (rarely needed)
238
+ # * {boolean} _actions - Return resource actions in response
239
+ # * {boolean} _links - Return resource link in response
240
+ # * {boolean} _embedded - Return embedded resources in response
241
+ #
242
+ # Responses:
243
+ # * 200 - Updated notification rule information (https://api.losant.com/#/definitions/notificationRule)
244
+ #
245
+ # Errors:
246
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
247
+ # * 404 - Error if notification rule was not found (https://api.losant.com/#/definitions/error)
248
+ def patch(params = {})
249
+ params = Utils.symbolize_hash_keys(params)
250
+ query_params = { _actions: false, _links: true, _embedded: true }
251
+ headers = {}
252
+ body = nil
253
+
254
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
255
+ raise ArgumentError.new("notificationRuleId is required") unless params.has_key?(:notificationRuleId)
256
+ raise ArgumentError.new("notificationRule is required") unless params.has_key?(:notificationRule)
257
+
258
+ body = params[:notificationRule] if params.has_key?(:notificationRule)
259
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
260
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
261
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
262
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
263
+
264
+ path = "/instances/#{params[:instanceId]}/notification-rules/#{params[:notificationRuleId]}"
265
+
266
+ @client.request(
267
+ method: :patch,
268
+ path: path,
269
+ query: query_params,
270
+ headers: headers,
271
+ body: body)
272
+ end
273
+
274
+ end
275
+ end