losant_rest 1.9.3 → 1.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/_schemas.md +17405 -2766
- data/docs/application.md +85 -0
- data/docs/applicationApiTokens.md +1 -1
- data/docs/applicationTemplate.md +46 -0
- data/docs/applicationTemplates.md +76 -1
- data/docs/device.md +7 -3
- data/docs/devices.md +92 -4
- data/docs/experienceEndpoints.md +1 -0
- data/docs/file.md +4 -4
- data/docs/flow.md +94 -1
- data/docs/flowVersion.md +96 -1
- data/docs/me.md +0 -36
- data/lib/losant_rest.rb +1 -0
- data/lib/losant_rest/application.rb +48 -0
- data/lib/losant_rest/application_api_tokens.rb +1 -1
- data/lib/losant_rest/application_template.rb +79 -0
- data/lib/losant_rest/application_templates.rb +89 -1
- data/lib/losant_rest/client.rb +6 -2
- data/lib/losant_rest/device.rb +11 -3
- data/lib/losant_rest/devices.rb +103 -3
- data/lib/losant_rest/experience_endpoints.rb +2 -0
- data/lib/losant_rest/file.rb +3 -3
- data/lib/losant_rest/flow.rb +115 -1
- data/lib/losant_rest/flow_version.rb +115 -1
- data/lib/losant_rest/me.rb +0 -41
- data/lib/losant_rest/version.rb +1 -1
- data/schemas/advancedDeviceQuery.json +117 -0
- data/schemas/advancedEventQuery.json +205 -0
- data/schemas/advancedQuery.json +34 -3
- data/schemas/application.json +13 -0
- data/schemas/applicationApiTokenPost.json +9 -1
- data/schemas/applicationApplyTemplatePatch.json +19 -0
- data/schemas/applicationCreationByTemplateResult.json +13 -0
- data/schemas/applicationPatch.json +5 -0
- data/schemas/applicationPost.json +13 -0
- data/schemas/applicationTemplate.json +32 -0
- data/schemas/applicationTemplateCategories.json +43 -0
- data/schemas/applicationTemplateCategory.json +23 -0
- data/schemas/applicationTemplates.json +44 -0
- data/schemas/applications.json +13 -0
- data/schemas/changePassword.json +2 -2
- data/schemas/dashboard.json +1285 -145
- data/schemas/dashboardPatch.json +1285 -145
- data/schemas/dashboardPost.json +1285 -145
- data/schemas/dashboards.json +1285 -145
- data/schemas/dataExport.json +142 -0
- data/schemas/dataTableRowsExport.json +34 -3
- data/schemas/device.json +16 -3
- data/schemas/devicePatch.json +16 -3
- data/schemas/devicePost.json +16 -3
- data/schemas/deviceRecipe.json +16 -3
- data/schemas/deviceRecipePatch.json +16 -3
- data/schemas/deviceRecipePost.json +16 -3
- data/schemas/deviceRecipes.json +16 -3
- data/schemas/devices.json +16 -3
- data/schemas/devicesDataRemoved.json +12 -0
- data/schemas/devicesDeletePost.json +1034 -0
- data/schemas/devicesDeleted.json +12 -0
- data/schemas/devicesExportPost.json +1035 -0
- data/schemas/devicesPatch.json +1773 -7
- data/schemas/devicesRemoveDataPost.json +1056 -0
- data/schemas/devicesUpdated.json +18 -0
- data/schemas/eventPost.json +22 -0
- data/schemas/eventsExport.json +205 -0
- data/schemas/experienceDomain.json +1 -1
- data/schemas/experienceDomainPatch.json +1 -1
- data/schemas/experienceDomainPost.json +1 -1
- data/schemas/experienceDomains.json +1 -1
- data/schemas/experienceGroup.json +7 -0
- data/schemas/experienceGroupPatch.json +7 -0
- data/schemas/experienceGroupPost.json +7 -0
- data/schemas/experienceGroups.json +7 -0
- data/schemas/experienceLinkedResources.json +348 -3
- data/schemas/experienceVersion.json +1 -1
- data/schemas/experienceVersions.json +1 -1
- data/schemas/flow.json +116 -1
- data/schemas/flowErrors.json +87 -0
- data/schemas/flowPatch.json +116 -1
- data/schemas/flowPost.json +116 -1
- data/schemas/flowStats.json +54 -0
- data/schemas/flowVersion.json +232 -2
- data/schemas/flowVersionPost.json +116 -1
- data/schemas/flowVersions.json +232 -2
- data/schemas/flows.json +116 -1
- data/schemas/flowsImportPost.json +232 -2
- data/schemas/flowsImportResult.json +348 -3
- data/schemas/githubLogin.json +15 -4
- data/schemas/me.json +0 -3
- data/schemas/mePatch.json +2 -2
- data/schemas/multiDeviceCommand.json +1019 -0
- data/schemas/notebook.json +99 -2
- data/schemas/notebookPatch.json +99 -2
- data/schemas/notebookPost.json +99 -2
- data/schemas/notebooks.json +99 -2
- data/schemas/org.json +1 -1
- data/schemas/orgInviteInfo.json +3 -0
- data/schemas/orgInvitePost.json +3 -0
- data/schemas/orgInvites.json +3 -0
- data/schemas/orgPatch.json +1 -1
- data/schemas/orgPost.json +0 -9
- data/schemas/orgs.json +1 -1
- data/schemas/passwordResetFinish.json +2 -2
- data/schemas/samlResponse.json +1 -1
- data/schemas/templateKeywords.json +14 -0
- data/schemas/timeSeriesData.json +101 -12
- data/schemas/timeSeriesQuery.json +101 -12
- data/schemas/userCredentials.json +13 -3
- data/schemas/userPost.json +21 -7
- metadata +19 -5
data/docs/experienceEndpoints.md
CHANGED
@@ -118,6 +118,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
118
118
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
119
119
|
| statGrouping | string | N | Field to group the statistics by. Accepted values are: statusCode, endpointId, version, domain | statusCode | statusCode |
|
120
120
|
| duration | string | N | Duration in milliseconds | 86400000 | 86400000 |
|
121
|
+
| end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
|
121
122
|
| resolution | string | N | Resolution in milliseconds | 3600000 | 3600000 |
|
122
123
|
| versionFilter | string | N | Filters the stats to a particular experience version | | myVersion |
|
123
124
|
| domainFilter | string | N | Filters the stats to a particular experience domain or slug | | mycustomdomain.com |
|
data/docs/file.md
CHANGED
@@ -50,7 +50,7 @@ all.Application, all.Organization, all.User, file.*, or file.delete.
|
|
50
50
|
| Code | Type | Description |
|
51
51
|
| ---- | ---- | ----------- |
|
52
52
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
53
|
-
| 404 | [Error](_schemas.md#error) | Error if
|
53
|
+
| 404 | [Error](_schemas.md#error) | Error if file was not found |
|
54
54
|
|
55
55
|
<br/>
|
56
56
|
|
@@ -132,7 +132,7 @@ all.Application, all.Organization, all.User, file.*, or file.move.
|
|
132
132
|
| Code | Type | Description |
|
133
133
|
| ---- | ---- | ----------- |
|
134
134
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
135
|
-
| 404 | [Error](_schemas.md#error) | Error if
|
135
|
+
| 404 | [Error](_schemas.md#error) | Error if file was not found |
|
136
136
|
|
137
137
|
<br/>
|
138
138
|
|
@@ -174,7 +174,7 @@ all.Application, all.Organization, all.User, file.*, or file.patch.
|
|
174
174
|
| Code | Type | Description |
|
175
175
|
| ---- | ---- | ----------- |
|
176
176
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
177
|
-
| 404 | [Error](_schemas.md#error) | Error if
|
177
|
+
| 404 | [Error](_schemas.md#error) | Error if file was not found |
|
178
178
|
|
179
179
|
<br/>
|
180
180
|
|
@@ -216,4 +216,4 @@ all.Application, all.Organization, all.User, file.*, or file.upload.
|
|
216
216
|
| Code | Type | Description |
|
217
217
|
| ---- | ---- | ----------- |
|
218
218
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
219
|
-
| 404 | [Error](_schemas.md#error) | Error if
|
219
|
+
| 404 | [Error](_schemas.md#error) | Error if file was not found |
|
data/docs/flow.md
CHANGED
@@ -8,12 +8,14 @@ parameters and the potential responses.
|
|
8
8
|
|
9
9
|
* [Clear Storage Entries](#clear-storage-entries)
|
10
10
|
* [Delete](#delete)
|
11
|
+
* [Errors](#errors)
|
11
12
|
* [Get](#get)
|
12
13
|
* [Get Log Entries](#get-log-entries)
|
13
14
|
* [Get Storage Entries](#get-storage-entries)
|
14
15
|
* [Patch](#patch)
|
15
16
|
* [Press Virtual Button](#press-virtual-button)
|
16
17
|
* [Set Storage Entry](#set-storage-entry)
|
18
|
+
* [Stats](#stats)
|
17
19
|
|
18
20
|
<br/>
|
19
21
|
|
@@ -97,6 +99,52 @@ all.Application, all.Organization, all.User, flow.*, or flow.delete.
|
|
97
99
|
|
98
100
|
<br/>
|
99
101
|
|
102
|
+
## Errors
|
103
|
+
|
104
|
+
Get information about errors that occurred during runs of this workflow
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
result = client.flow.errors(
|
108
|
+
applicationId: my_application_id,
|
109
|
+
flowId: my_flow_id)
|
110
|
+
|
111
|
+
puts result
|
112
|
+
```
|
113
|
+
|
114
|
+
#### Authentication
|
115
|
+
The client must be configured with a valid api access token to call this
|
116
|
+
action. The token must include at least one of the following scopes:
|
117
|
+
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.errors.
|
118
|
+
|
119
|
+
#### Available Parameters
|
120
|
+
|
121
|
+
| Name | Type | Required | Description | Default | Example |
|
122
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
123
|
+
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
124
|
+
| flowId | string | Y | ID associated with the flow | | 575ed18f7ae143cd83dc4aa6 |
|
125
|
+
| duration | string | N | Duration of time range in milliseconds | 86400000 | 86400000 |
|
126
|
+
| end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
|
127
|
+
| limit | string | N | Maximum number of errors to return | 25 | 25 |
|
128
|
+
| sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | desc | desc |
|
129
|
+
| flowVersion | string | N | Flow version name or ID. When not included, will be errors for all versions. Pass develop for just the develop version. | | develop |
|
130
|
+
| deviceId | string | N | For edge workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs. | | 575ed18f7ae143cd83dc4bb6 |
|
131
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
132
|
+
|
133
|
+
#### Successful Responses
|
134
|
+
|
135
|
+
| Code | Type | Description |
|
136
|
+
| ---- | ---- | ----------- |
|
137
|
+
| 200 | [Workflow Errors](_schemas.md#workflow-errors) | Workflow error information |
|
138
|
+
|
139
|
+
#### Error Responses
|
140
|
+
|
141
|
+
| Code | Type | Description |
|
142
|
+
| ---- | ---- | ----------- |
|
143
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
144
|
+
| 404 | [Error](_schemas.md#error) | Error if flow was not found |
|
145
|
+
|
146
|
+
<br/>
|
147
|
+
|
100
148
|
## Get
|
101
149
|
|
102
150
|
Retrieves information on a flow
|
@@ -176,7 +224,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
176
224
|
| Code | Type | Description |
|
177
225
|
| ---- | ---- | ----------- |
|
178
226
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
179
|
-
| 404 | [Error](_schemas.md#error) | Error if
|
227
|
+
| 404 | [Error](_schemas.md#error) | Error if flow was not found |
|
180
228
|
|
181
229
|
<br/>
|
182
230
|
|
@@ -344,3 +392,48 @@ all.Application, all.Organization, all.User, flow.*, or flow.setStorageEntry.
|
|
344
392
|
| ---- | ---- | ----------- |
|
345
393
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
346
394
|
| 404 | [Error](_schemas.md#error) | Error if flow was not found |
|
395
|
+
|
396
|
+
<br/>
|
397
|
+
|
398
|
+
## Stats
|
399
|
+
|
400
|
+
Get statistics about workflow runs for this workflow
|
401
|
+
|
402
|
+
```ruby
|
403
|
+
result = client.flow.stats(
|
404
|
+
applicationId: my_application_id,
|
405
|
+
flowId: my_flow_id)
|
406
|
+
|
407
|
+
puts result
|
408
|
+
```
|
409
|
+
|
410
|
+
#### Authentication
|
411
|
+
The client must be configured with a valid api access token to call this
|
412
|
+
action. The token must include at least one of the following scopes:
|
413
|
+
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.stats.
|
414
|
+
|
415
|
+
#### Available Parameters
|
416
|
+
|
417
|
+
| Name | Type | Required | Description | Default | Example |
|
418
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
419
|
+
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
420
|
+
| flowId | string | Y | ID associated with the flow | | 575ed18f7ae143cd83dc4aa6 |
|
421
|
+
| duration | string | N | Duration of time range in milliseconds | 86400000 | 86400000 |
|
422
|
+
| end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
|
423
|
+
| resolution | string | N | Resolution in milliseconds | 3600000 | 3600000 |
|
424
|
+
| flowVersion | string | N | Flow version name or ID. When not included, will be aggregate for all versions. Pass develop for just the develop version. | | develop |
|
425
|
+
| deviceId | string | N | For edge workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs. | | 575ed18f7ae143cd83dc4bb6 |
|
426
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
427
|
+
|
428
|
+
#### Successful Responses
|
429
|
+
|
430
|
+
| Code | Type | Description |
|
431
|
+
| ---- | ---- | ----------- |
|
432
|
+
| 200 | [Workflow Statistics](_schemas.md#workflow-statistics) | Statistics for workflow runs |
|
433
|
+
|
434
|
+
#### Error Responses
|
435
|
+
|
436
|
+
| Code | Type | Description |
|
437
|
+
| ---- | ---- | ----------- |
|
438
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
439
|
+
| 404 | [Error](_schemas.md#error) | Error if flow was not found |
|
data/docs/flowVersion.md
CHANGED
@@ -7,9 +7,11 @@ parameters and the potential responses.
|
|
7
7
|
##### Contents
|
8
8
|
|
9
9
|
* [Delete](#delete)
|
10
|
+
* [Errors](#errors)
|
10
11
|
* [Get](#get)
|
11
12
|
* [Get Log Entries](#get-log-entries)
|
12
13
|
* [Patch](#patch)
|
14
|
+
* [Stats](#stats)
|
13
15
|
|
14
16
|
<br/>
|
15
17
|
|
@@ -55,6 +57,53 @@ all.Application, all.Organization, all.User, flowVersion.*, or flowVersion.delet
|
|
55
57
|
|
56
58
|
<br/>
|
57
59
|
|
60
|
+
## Errors
|
61
|
+
|
62
|
+
Get information about errors that occurred during runs of this workflow version
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
result = client.flow_version.errors(
|
66
|
+
applicationId: my_application_id,
|
67
|
+
flowId: my_flow_id,
|
68
|
+
flowVersionId: my_flow_version_id)
|
69
|
+
|
70
|
+
puts result
|
71
|
+
```
|
72
|
+
|
73
|
+
#### Authentication
|
74
|
+
The client must be configured with a valid api access token to call this
|
75
|
+
action. The token must include at least one of the following scopes:
|
76
|
+
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.errors.
|
77
|
+
|
78
|
+
#### Available Parameters
|
79
|
+
|
80
|
+
| Name | Type | Required | Description | Default | Example |
|
81
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
82
|
+
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
83
|
+
| flowId | string | Y | ID associated with the flow | | 575ed18f7ae143cd83dc4aa6 |
|
84
|
+
| flowVersionId | string | Y | Version ID or version name associated with the flow version | | 675ed18f7ae143cd83dc4bb7 |
|
85
|
+
| duration | string | N | Duration of time range in milliseconds | 86400000 | 86400000 |
|
86
|
+
| end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
|
87
|
+
| limit | string | N | Maximum number of errors to return | 25 | 25 |
|
88
|
+
| sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | desc | desc |
|
89
|
+
| deviceId | string | N | For edge workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs. | | 575ed18f7ae143cd83dc4bb6 |
|
90
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
91
|
+
|
92
|
+
#### Successful Responses
|
93
|
+
|
94
|
+
| Code | Type | Description |
|
95
|
+
| ---- | ---- | ----------- |
|
96
|
+
| 200 | [Workflow Errors](_schemas.md#workflow-errors) | Workflow error information |
|
97
|
+
|
98
|
+
#### Error Responses
|
99
|
+
|
100
|
+
| Code | Type | Description |
|
101
|
+
| ---- | ---- | ----------- |
|
102
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
103
|
+
| 404 | [Error](_schemas.md#error) | Error if flow version was not found |
|
104
|
+
|
105
|
+
<br/>
|
106
|
+
|
58
107
|
## Get
|
59
108
|
|
60
109
|
Retrieves information on a flow version
|
@@ -138,7 +187,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
138
187
|
| Code | Type | Description |
|
139
188
|
| ---- | ---- | ----------- |
|
140
189
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
141
|
-
| 404 | [Error](_schemas.md#error) | Error if
|
190
|
+
| 404 | [Error](_schemas.md#error) | Error if flow version was not found |
|
142
191
|
|
143
192
|
<br/>
|
144
193
|
|
@@ -184,3 +233,49 @@ all.Application, all.Organization, all.User, flowVersion.*, or flowVersion.patch
|
|
184
233
|
| ---- | ---- | ----------- |
|
185
234
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
186
235
|
| 404 | [Error](_schemas.md#error) | Error if flow version was not found |
|
236
|
+
|
237
|
+
<br/>
|
238
|
+
|
239
|
+
## Stats
|
240
|
+
|
241
|
+
Get statistics about workflow runs for this workflow version
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
result = client.flow_version.stats(
|
245
|
+
applicationId: my_application_id,
|
246
|
+
flowId: my_flow_id,
|
247
|
+
flowVersionId: my_flow_version_id)
|
248
|
+
|
249
|
+
puts result
|
250
|
+
```
|
251
|
+
|
252
|
+
#### Authentication
|
253
|
+
The client must be configured with a valid api access token to call this
|
254
|
+
action. The token must include at least one of the following scopes:
|
255
|
+
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.stats.
|
256
|
+
|
257
|
+
#### Available Parameters
|
258
|
+
|
259
|
+
| Name | Type | Required | Description | Default | Example |
|
260
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
261
|
+
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
262
|
+
| flowId | string | Y | ID associated with the flow | | 575ed18f7ae143cd83dc4aa6 |
|
263
|
+
| flowVersionId | string | Y | Version ID or version name associated with the flow version | | 675ed18f7ae143cd83dc4bb7 |
|
264
|
+
| duration | string | N | Duration of time range in milliseconds | 86400000 | 86400000 |
|
265
|
+
| end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
|
266
|
+
| resolution | string | N | Resolution in milliseconds | 3600000 | 3600000 |
|
267
|
+
| deviceId | string | N | For edge workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs. | | 575ed18f7ae143cd83dc4bb6 |
|
268
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
269
|
+
|
270
|
+
#### Successful Responses
|
271
|
+
|
272
|
+
| Code | Type | Description |
|
273
|
+
| ---- | ---- | ----------- |
|
274
|
+
| 200 | [Workflow Statistics](_schemas.md#workflow-statistics) | Statistics for workflow runs |
|
275
|
+
|
276
|
+
#### Error Responses
|
277
|
+
|
278
|
+
| Code | Type | Description |
|
279
|
+
| ---- | ---- | ----------- |
|
280
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
281
|
+
| 404 | [Error](_schemas.md#error) | Error if flow version was not found |
|
data/docs/me.md
CHANGED
@@ -11,7 +11,6 @@ parameters and the potential responses.
|
|
11
11
|
* [Delete](#delete)
|
12
12
|
* [Disable Two Factor Auth](#disable-two-factor-auth)
|
13
13
|
* [Disconnect Github](#disconnect-github)
|
14
|
-
* [Disconnect Twitter](#disconnect-twitter)
|
15
14
|
* [Enable Two Factor Auth](#enable-two-factor-auth)
|
16
15
|
* [Fetch Recent Items](#fetch-recent-items)
|
17
16
|
* [Get](#get)
|
@@ -202,41 +201,6 @@ all.User, me.*, or me.disconnectGithub.
|
|
202
201
|
|
203
202
|
<br/>
|
204
203
|
|
205
|
-
## Disconnect Twitter
|
206
|
-
|
207
|
-
Disconnects the user from Twitter
|
208
|
-
|
209
|
-
```ruby
|
210
|
-
result = client.me.disconnect_twitter(optional_params)
|
211
|
-
|
212
|
-
puts result
|
213
|
-
```
|
214
|
-
|
215
|
-
#### Authentication
|
216
|
-
The client must be configured with a valid api access token to call this
|
217
|
-
action. The token must include at least one of the following scopes:
|
218
|
-
all.User, me.*, or me.disconnectTwitter.
|
219
|
-
|
220
|
-
#### Available Parameters
|
221
|
-
|
222
|
-
| Name | Type | Required | Description | Default | Example |
|
223
|
-
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
224
|
-
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
225
|
-
|
226
|
-
#### Successful Responses
|
227
|
-
|
228
|
-
| Code | Type | Description |
|
229
|
-
| ---- | ---- | ----------- |
|
230
|
-
| 200 | [Me](_schemas.md#me) | Updated user information |
|
231
|
-
|
232
|
-
#### Error Responses
|
233
|
-
|
234
|
-
| Code | Type | Description |
|
235
|
-
| ---- | ---- | ----------- |
|
236
|
-
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
237
|
-
|
238
|
-
<br/>
|
239
|
-
|
240
204
|
## Enable Two Factor Auth
|
241
205
|
|
242
206
|
Enables two factor auth for the current user
|
data/lib/losant_rest.rb
CHANGED
@@ -32,6 +32,7 @@ require_relative "losant_rest/application_certificate_authority"
|
|
32
32
|
require_relative "losant_rest/application_certificates"
|
33
33
|
require_relative "losant_rest/application_key"
|
34
34
|
require_relative "losant_rest/application_keys"
|
35
|
+
require_relative "losant_rest/application_template"
|
35
36
|
require_relative "losant_rest/application_templates"
|
36
37
|
require_relative "losant_rest/applications"
|
37
38
|
require_relative "losant_rest/audit_log"
|
@@ -31,6 +31,54 @@ module LosantRest
|
|
31
31
|
@client = client
|
32
32
|
end
|
33
33
|
|
34
|
+
# Add resources to an application via an application template
|
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.Application, all.Organization, all.User, application.*, or application.applyTemplate.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} applicationId - ID of the associated application
|
44
|
+
# * {hash} options - Object containing template import options (https://api.losant.com/#/definitions/applicationApplyTemplatePatch)
|
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 - Updated application information (https://api.losant.com/#/definitions/application)
|
52
|
+
# * 202 - If a job was enqueued for the resources to be imported into the application (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
53
|
+
#
|
54
|
+
# Errors:
|
55
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
56
|
+
# * 404 - Error if application is not found (https://api.losant.com/#/definitions/error)
|
57
|
+
def apply_template(params = {})
|
58
|
+
params = Utils.symbolize_hash_keys(params)
|
59
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
60
|
+
headers = {}
|
61
|
+
body = nil
|
62
|
+
|
63
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
64
|
+
raise ArgumentError.new("options is required") unless params.has_key?(:options)
|
65
|
+
|
66
|
+
body = params[:options] if params.has_key?(:options)
|
67
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
68
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
69
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
70
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
71
|
+
|
72
|
+
path = "/applications/#{params[:applicationId]}/applyTemplate"
|
73
|
+
|
74
|
+
@client.request(
|
75
|
+
method: :patch,
|
76
|
+
path: path,
|
77
|
+
query: query_params,
|
78
|
+
headers: headers,
|
79
|
+
body: body)
|
80
|
+
end
|
81
|
+
|
34
82
|
# Returns success when a job has been enqueued to archive this application's device data for a given day
|
35
83
|
#
|
36
84
|
# Authentication:
|
@@ -41,7 +41,7 @@ module LosantRest
|
|
41
41
|
#
|
42
42
|
# Parameters:
|
43
43
|
# * {string} applicationId - ID associated with the application
|
44
|
-
# * {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated
|
44
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated, expirationDate
|
45
45
|
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
46
46
|
# * {string} page - Which page of results to return
|
47
47
|
# * {string} perPage - How many items to return per page
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2020 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 LosantRest
|
26
|
+
|
27
|
+
# Class containing all the actions for the Application Template Resource
|
28
|
+
class ApplicationTemplate
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# Retrieves information on an application template
|
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.User, all.User.read, applicationTemplate.*, or applicationTemplate.get.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} templateId - ID associated with the template
|
44
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
45
|
+
# * {boolean} _actions - Return resource actions in response
|
46
|
+
# * {boolean} _links - Return resource link in response
|
47
|
+
# * {boolean} _embedded - Return embedded resources in response
|
48
|
+
#
|
49
|
+
# Responses:
|
50
|
+
# * 200 - Application template information (https://api.losant.com/#/definitions/applicationTemplate)
|
51
|
+
#
|
52
|
+
# Errors:
|
53
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
54
|
+
# * 404 - Error if template was not found (https://api.losant.com/#/definitions/error)
|
55
|
+
def get(params = {})
|
56
|
+
params = Utils.symbolize_hash_keys(params)
|
57
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
58
|
+
headers = {}
|
59
|
+
body = nil
|
60
|
+
|
61
|
+
raise ArgumentError.new("templateId is required") unless params.has_key?(:templateId)
|
62
|
+
|
63
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
64
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
65
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
66
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
67
|
+
|
68
|
+
path = "/applicationTemplates/#{params[:templateId]}"
|
69
|
+
|
70
|
+
@client.request(
|
71
|
+
method: :get,
|
72
|
+
path: path,
|
73
|
+
query: query_params,
|
74
|
+
headers: headers,
|
75
|
+
body: body)
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|