losant_rest 1.16.1 → 1.16.5
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 +5525 -738
- data/docs/applications.md +1 -1
- data/docs/dashboard.md +2 -0
- data/docs/device.md +4 -0
- data/docs/devices.md +4 -0
- data/docs/instanceSandbox.md +135 -0
- data/docs/instanceSandboxes.md +55 -0
- data/docs/me.md +36 -0
- data/lib/losant_rest/client.rb +10 -2
- data/lib/losant_rest/dashboard.rb +4 -0
- data/lib/losant_rest/device.rb +8 -0
- data/lib/losant_rest/devices.rb +8 -0
- data/lib/losant_rest/instance_sandbox.rb +181 -0
- data/lib/losant_rest/instance_sandboxes.rb +98 -0
- data/lib/losant_rest/me.rb +41 -0
- data/lib/losant_rest/version.rb +1 -1
- data/lib/losant_rest.rb +2 -0
- data/schemas/advancedApplicationKeyQuery.json +88 -0
- data/schemas/advancedDeviceQuery.json +264 -0
- data/schemas/advancedEventQuery.json +88 -0
- data/schemas/advancedFlowByVersionQuery.json +88 -0
- data/schemas/advancedFlowQuery.json +88 -0
- data/schemas/advancedFlowVersionQuery.json +44 -0
- data/schemas/apiTokenPost.json +8 -1
- data/schemas/applicationDashboardPost.json +155 -24
- data/schemas/applicationExportPost.json +1 -0
- data/schemas/applicationSearchResult.json +2 -1
- data/schemas/applicationTemplateCategories.json +11 -0
- data/schemas/applicationTemplateCategory.json +11 -0
- data/schemas/dashboard.json +155 -24
- data/schemas/dashboardPatch.json +155 -24
- data/schemas/dashboardPost.json +155 -24
- data/schemas/dashboardSendReport.json +3 -0
- data/schemas/dashboards.json +155 -24
- data/schemas/dataExport.json +1 -0
- data/schemas/dataTableRowsExport.json +5 -0
- data/schemas/deviceRecipeBulkCreatePost.json +5 -0
- data/schemas/devicesDeletePost.json +269 -0
- data/schemas/devicesExportPayloadCountPost.json +265 -0
- data/schemas/devicesExportPost.json +265 -0
- data/schemas/devicesPatch.json +269 -0
- data/schemas/devicesRemoveDataPost.json +264 -0
- data/schemas/embeddedDeploymentExport.json +5 -0
- data/schemas/enableTwoFactorAuth.json +5 -1
- data/schemas/eventsExport.json +89 -0
- data/schemas/experienceLinkedResources.json +3 -0
- data/schemas/experienceUser.json +11 -0
- data/schemas/experienceUsers.json +11 -0
- data/schemas/experienceVersion.json +27 -0
- data/schemas/experienceVersionPatch.json +27 -0
- data/schemas/experienceVersionPost.json +39 -0
- data/schemas/experienceVersions.json +27 -0
- data/schemas/flow.json +1 -0
- data/schemas/flowPatch.json +1 -0
- data/schemas/flowPost.json +1 -0
- data/schemas/flowVersion.json +2 -0
- data/schemas/flowVersionPost.json +1 -0
- data/schemas/flowVersions.json +2 -0
- data/schemas/flowVersionsDeletePost.json +49 -0
- data/schemas/flows.json +1 -0
- data/schemas/flowsImportPost.json +2 -0
- data/schemas/flowsImportResult.json +3 -0
- data/schemas/githubLogin.json +8 -1
- data/schemas/importIntoApplicationOptions.json +58 -0
- data/schemas/importNewApplicationOptions.json +45 -0
- data/schemas/instance.json +1 -0
- data/schemas/instanceCustomNodePatch.json +1 -0
- data/schemas/instanceCustomNodePost.json +1 -0
- data/schemas/instanceOrg.json +30 -0
- data/schemas/instanceOrgPatch.json +29 -0
- data/schemas/instanceOrgPost.json +29 -0
- data/schemas/instanceOrgs.json +30 -0
- data/schemas/instancePatch.json +1 -0
- data/schemas/instanceReportOptionsPost.json +1 -0
- data/schemas/instanceSandbox.json +423 -0
- data/schemas/instanceSandboxes.json +48 -0
- data/schemas/integration.json +34 -1
- data/schemas/integrationPatch.json +34 -1
- data/schemas/integrationPost.json +34 -1
- data/schemas/integrations.json +34 -1
- data/schemas/multiDeviceCommand.json +264 -0
- data/schemas/notebookDataExportOptions.json +5 -0
- data/schemas/org.json +17 -0
- data/schemas/orgs.json +17 -0
- data/schemas/samlResponse.json +432 -0
- data/schemas/twoFactorAuthInfo.json +15 -0
- data/schemas/userCredentials.json +8 -1
- data/schemas/userPost.json +8 -1
- data/schemas/validateContextError.json +3 -0
- data/schemas/validateContextSuccess.json +27 -0
- metadata +12 -3
data/docs/applications.md
CHANGED
@@ -82,7 +82,7 @@ all.Organization, all.User, applications.*, or applications.import.
|
|
82
82
|
| includeDataTableRows | string | N | If set, import data table rows from import bundle | | true |
|
83
83
|
| includeFiles | string | N | If set, import files from import bundle | | true |
|
84
84
|
| email | string | N | Email address to notify the user when the job to import the application has completed or errored, defaults to the email address of the user making the request | | email@example.com |
|
85
|
-
| options | [
|
85
|
+
| options | [Applications Import Options](_schemas.md#applications-import-options) | N | Additional import options | | [Applications Import Options Example](_schemas.md#applications-import-options-example) |
|
86
86
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
87
87
|
|
88
88
|
#### Successful Responses
|
data/docs/dashboard.md
CHANGED
@@ -189,6 +189,8 @@ No api access token is required to call this action.
|
|
189
189
|
| dashboardId | string | Y | ID of the associated dashboard | | 575ece2b7ae143cd83dc4a9b |
|
190
190
|
| ctx | [Dashboard Context Instance](_schemas.md#dashboard-context-instance) | Y | The context object to validate | | [Dashboard Context Instance Example](_schemas.md#dashboard-context-instance-example) |
|
191
191
|
| password | string | N | Password for password-protected dashboards | | myPassword |
|
192
|
+
| duration | string | N | Duration of data to fetch in milliseconds | | 3600000 |
|
193
|
+
| resolution | string | N | Resolution in milliseconds | | 60000 |
|
192
194
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
193
195
|
|
194
196
|
#### Successful Responses
|
data/docs/device.md
CHANGED
@@ -131,6 +131,8 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
131
131
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
132
132
|
| deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
|
133
133
|
| excludeConnectionInfo | string | N | If set, do not return connection info | | true |
|
134
|
+
| tagsAsObject | string | N | Return tags as an object map instead of an array. | | true |
|
135
|
+
| attributesAsObject | string | N | Return attributes as an object map instead of an array. | | false |
|
134
136
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
135
137
|
|
136
138
|
#### Successful Responses
|
@@ -345,6 +347,8 @@ all.Application, all.Organization, all.User, device.*, or device.patch.
|
|
345
347
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
346
348
|
| deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
|
347
349
|
| device | [Device Patch](_schemas.md#device-patch) | Y | Object containing new properties of the device | | [Device Patch Example](_schemas.md#device-patch-example) |
|
350
|
+
| tagsAsObject | string | N | Return tags as an object map instead of an array. | | true |
|
351
|
+
| attributesAsObject | string | N | Return attributes as an object map instead of an array. | | false |
|
348
352
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
349
353
|
|
350
354
|
#### Successful Responses
|
data/docs/devices.md
CHANGED
@@ -212,6 +212,8 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
212
212
|
| excludeConnectionInfo | string | N | If set, do not return connection info | | true |
|
213
213
|
| parentId | string | N | Filter devices as children of a given system id | | 575ecf887ae143cd83dc4aa2 |
|
214
214
|
| query | [Advanced Device Query](_schemas.md#advanced-device-query) | N | Device filter JSON object which overrides the filterField, filter, deviceClass, tagFilter, and parentId parameters. | | [Advanced Device Query Example](_schemas.md#advanced-device-query-example) |
|
215
|
+
| tagsAsObject | string | N | Return tags as an object map instead of an array. | | true |
|
216
|
+
| attributesAsObject | string | N | Return attributes as an object map instead of an array. | | false |
|
215
217
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
216
218
|
|
217
219
|
#### Successful Responses
|
@@ -331,6 +333,8 @@ all.Application, all.Organization, all.User, devices.*, or devices.post.
|
|
331
333
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
332
334
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
333
335
|
| device | [Device Post](_schemas.md#device-post) | Y | New device information | | [Device Post Example](_schemas.md#device-post-example) |
|
336
|
+
| tagsAsObject | string | N | Return tags as an object map instead of an array. | | true |
|
337
|
+
| attributesAsObject | string | N | Return attributes as an object map instead of an array. | | false |
|
334
338
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
335
339
|
|
336
340
|
#### Successful Responses
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# Instance Sandbox Actions
|
2
|
+
|
3
|
+
Details on the various actions that can be performed on the
|
4
|
+
Instance Sandbox resource, including the expected
|
5
|
+
parameters and the potential responses.
|
6
|
+
|
7
|
+
##### Contents
|
8
|
+
|
9
|
+
* [Delete](#delete)
|
10
|
+
* [Get](#get)
|
11
|
+
* [Undelete](#undelete)
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
## Delete
|
16
|
+
|
17
|
+
Deletes a sandbox user account
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
result = client.instance_sandbox.delete(
|
21
|
+
instanceId: my_instance_id,
|
22
|
+
instanceSandboxId: my_instance_sandbox_id)
|
23
|
+
|
24
|
+
puts result
|
25
|
+
```
|
26
|
+
|
27
|
+
#### Authentication
|
28
|
+
The client must be configured with a valid api access token to call this
|
29
|
+
action. The token must include at least one of the following scopes:
|
30
|
+
all.Instance, all.User, instanceSandbox.*, or instanceSandbox.delete.
|
31
|
+
|
32
|
+
#### Available Parameters
|
33
|
+
|
34
|
+
| Name | Type | Required | Description | Default | Example |
|
35
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
36
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
37
|
+
| instanceSandboxId | string | Y | ID associated with the sandbox user | | 575ec8687ae143cd83dc4a97 |
|
38
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
39
|
+
|
40
|
+
#### Successful Responses
|
41
|
+
|
42
|
+
| Code | Type | Description |
|
43
|
+
| ---- | ---- | ----------- |
|
44
|
+
| 200 | [Success](_schemas.md#success) | If a sandbox was successfully deleted |
|
45
|
+
|
46
|
+
#### Error Responses
|
47
|
+
|
48
|
+
| Code | Type | Description |
|
49
|
+
| ---- | ---- | ----------- |
|
50
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
51
|
+
| 404 | [Error](_schemas.md#error) | Error if instance, organization or invite was not found |
|
52
|
+
|
53
|
+
<br/>
|
54
|
+
|
55
|
+
## Get
|
56
|
+
|
57
|
+
Returns a sandbox user
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
result = client.instance_sandbox.get(
|
61
|
+
instanceId: my_instance_id,
|
62
|
+
instanceSandboxId: my_instance_sandbox_id)
|
63
|
+
|
64
|
+
puts result
|
65
|
+
```
|
66
|
+
|
67
|
+
#### Authentication
|
68
|
+
The client must be configured with a valid api access token to call this
|
69
|
+
action. The token must include at least one of the following scopes:
|
70
|
+
all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.get.
|
71
|
+
|
72
|
+
#### Available Parameters
|
73
|
+
|
74
|
+
| Name | Type | Required | Description | Default | Example |
|
75
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
76
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
77
|
+
| instanceSandboxId | string | Y | ID associated with the sandbox user | | 575ec8687ae143cd83dc4a97 |
|
78
|
+
| summaryExclude | string | N | Comma-separated list of summary fields to exclude from user summary | | payloadCount |
|
79
|
+
| summaryInclude | string | N | Comma-separated list of summary fields to include in user summary | | payloadCount |
|
80
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
81
|
+
|
82
|
+
#### Successful Responses
|
83
|
+
|
84
|
+
| Code | Type | Description |
|
85
|
+
| ---- | ---- | ----------- |
|
86
|
+
| 200 | [Instance Sandbox User](_schemas.md#instance-sandbox-user) | A single sandbox user |
|
87
|
+
|
88
|
+
#### Error Responses
|
89
|
+
|
90
|
+
| Code | Type | Description |
|
91
|
+
| ---- | ---- | ----------- |
|
92
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
93
|
+
| 404 | [Error](_schemas.md#error) | Error if sandbox was not found |
|
94
|
+
|
95
|
+
<br/>
|
96
|
+
|
97
|
+
## Undelete
|
98
|
+
|
99
|
+
Restores a sandbox user account
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
result = client.instance_sandbox.undelete(
|
103
|
+
instanceId: my_instance_id,
|
104
|
+
instanceSandboxId: my_instance_sandbox_id)
|
105
|
+
|
106
|
+
puts result
|
107
|
+
```
|
108
|
+
|
109
|
+
#### Authentication
|
110
|
+
The client must be configured with a valid api access token to call this
|
111
|
+
action. The token must include at least one of the following scopes:
|
112
|
+
all.Instance, all.User, instanceSandbox.*, or instanceSandbox.undelete.
|
113
|
+
|
114
|
+
#### Available Parameters
|
115
|
+
|
116
|
+
| Name | Type | Required | Description | Default | Example |
|
117
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
118
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
119
|
+
| instanceSandboxId | string | Y | ID associated with the sandbox user | | 575ec8687ae143cd83dc4a97 |
|
120
|
+
| summaryExclude | string | N | Comma-separated list of summary fields to exclude from user summary | | payloadCount |
|
121
|
+
| summaryInclude | string | N | Comma-separated list of summary fields to include in user summary | | payloadCount |
|
122
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
123
|
+
|
124
|
+
#### Successful Responses
|
125
|
+
|
126
|
+
| Code | Type | Description |
|
127
|
+
| ---- | ---- | ----------- |
|
128
|
+
| 200 | [Instance Sandbox User](_schemas.md#instance-sandbox-user) | A single restored sandbox user |
|
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 sandbox was not found |
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Instance Sandboxes Actions
|
2
|
+
|
3
|
+
Details on the various actions that can be performed on the
|
4
|
+
Instance Sandboxes resource, including the expected
|
5
|
+
parameters and the potential responses.
|
6
|
+
|
7
|
+
##### Contents
|
8
|
+
|
9
|
+
* [Get](#get)
|
10
|
+
|
11
|
+
<br/>
|
12
|
+
|
13
|
+
## Get
|
14
|
+
|
15
|
+
Returns a collection of instance sandboxes
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
result = client.instance_sandboxes.get(instanceId: my_instance_id)
|
19
|
+
|
20
|
+
puts result
|
21
|
+
```
|
22
|
+
|
23
|
+
#### Authentication
|
24
|
+
The client must be configured with a valid api access token to call this
|
25
|
+
action. The token must include at least one of the following scopes:
|
26
|
+
all.Instance, all.Instance.read, all.User, all.User.read, instanceSandboxes.*, or instanceSandboxes.get.
|
27
|
+
|
28
|
+
#### Available Parameters
|
29
|
+
|
30
|
+
| Name | Type | Required | Description | Default | Example |
|
31
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
32
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
33
|
+
| summaryExclude | string | N | Comma-separated list of summary fields to exclude from user summary | | payloadCount |
|
34
|
+
| summaryInclude | string | N | Comma-separated list of summary fields to include in user summary | | payloadCount |
|
35
|
+
| sortField | string | N | Field to sort the results by. Accepted values are: firstName, lastName, email, id, creationDate, lastSuccessfulLogin, lastFailedLogin, failedLoginCount, lastUpdated | email | firstName |
|
36
|
+
| sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
|
37
|
+
| startingAfterId | string | N | Exclusive ID from which to begin querying | | 575ec8687ae143cd83dc4a97 |
|
38
|
+
| endingBeforeId | string | N | Exclusive ID at which to end querying | | 575ec8687ae143cd83dc4a97 |
|
39
|
+
| limit | string | N | How many items to return | 100 | 10 |
|
40
|
+
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: firstName, lastName, email | | firstName |
|
41
|
+
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my * instance |
|
42
|
+
| includeDeleted | string | N | If the result of the request should also include deleted sandboxes. | | true |
|
43
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
44
|
+
|
45
|
+
#### Successful Responses
|
46
|
+
|
47
|
+
| Code | Type | Description |
|
48
|
+
| ---- | ---- | ----------- |
|
49
|
+
| 200 | [Instance Sandboxes](_schemas.md#instance-sandboxes) | Collection of instance sandboxes |
|
50
|
+
|
51
|
+
#### Error Responses
|
52
|
+
|
53
|
+
| Code | Type | Description |
|
54
|
+
| ---- | ---- | ----------- |
|
55
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
data/docs/me.md
CHANGED
@@ -13,6 +13,7 @@ parameters and the potential responses.
|
|
13
13
|
* [Disconnect Github](#disconnect-github)
|
14
14
|
* [Enable Two Factor Auth](#enable-two-factor-auth)
|
15
15
|
* [Fetch Recent Items](#fetch-recent-items)
|
16
|
+
* [Generate Two Factor Auth](#generate-two-factor-auth)
|
16
17
|
* [Get](#get)
|
17
18
|
* [Patch](#patch)
|
18
19
|
* [Payload Counts](#payload-counts)
|
@@ -274,6 +275,41 @@ all.User, all.User.read, me.*, or me.fetchRecentItems.
|
|
274
275
|
|
275
276
|
<br/>
|
276
277
|
|
278
|
+
## Generate Two Factor Auth
|
279
|
+
|
280
|
+
Returns the two factor auth key for a user
|
281
|
+
|
282
|
+
```ruby
|
283
|
+
result = client.me.generate_two_factor_auth(optional_params)
|
284
|
+
|
285
|
+
puts result
|
286
|
+
```
|
287
|
+
|
288
|
+
#### Authentication
|
289
|
+
The client must be configured with a valid api access token to call this
|
290
|
+
action. The token must include at least one of the following scopes:
|
291
|
+
all.User, me.*, or me.generateTwoFactorAuth.
|
292
|
+
|
293
|
+
#### Available Parameters
|
294
|
+
|
295
|
+
| Name | Type | Required | Description | Default | Example |
|
296
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
297
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
298
|
+
|
299
|
+
#### Successful Responses
|
300
|
+
|
301
|
+
| Code | Type | Description |
|
302
|
+
| ---- | ---- | ----------- |
|
303
|
+
| 200 | [Two Factor Auth Info](_schemas.md#two-factor-auth-info) | Updated user information |
|
304
|
+
|
305
|
+
#### Error Responses
|
306
|
+
|
307
|
+
| Code | Type | Description |
|
308
|
+
| ---- | ---- | ----------- |
|
309
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
310
|
+
|
311
|
+
<br/>
|
312
|
+
|
277
313
|
## Get
|
278
314
|
|
279
315
|
Retrieves information on the current user
|
data/lib/losant_rest/client.rb
CHANGED
@@ -27,7 +27,7 @@ module LosantRest
|
|
27
27
|
#
|
28
28
|
# User API for accessing Losant data
|
29
29
|
#
|
30
|
-
# Built For Version 1.23.
|
30
|
+
# Built For Version 1.23.5
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -308,6 +308,14 @@ module LosantRest
|
|
308
308
|
@instance_orgs ||= InstanceOrgs.new(self)
|
309
309
|
end
|
310
310
|
|
311
|
+
def instance_sandbox
|
312
|
+
@instance_sandbox ||= InstanceSandbox.new(self)
|
313
|
+
end
|
314
|
+
|
315
|
+
def instance_sandboxes
|
316
|
+
@instance_sandboxes ||= InstanceSandboxes.new(self)
|
317
|
+
end
|
318
|
+
|
311
319
|
def instances
|
312
320
|
@instances ||= Instances.new(self)
|
313
321
|
end
|
@@ -366,7 +374,7 @@ module LosantRest
|
|
366
374
|
|
367
375
|
headers["Accept"] = "application/json"
|
368
376
|
headers["Content-Type"] = "application/json"
|
369
|
-
headers["Accept-Version"] = "^1.23.
|
377
|
+
headers["Accept-Version"] = "^1.23.5"
|
370
378
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
371
379
|
path = self.url + options.fetch(:path, "")
|
372
380
|
|
@@ -221,6 +221,8 @@ module LosantRest
|
|
221
221
|
# * {string} dashboardId - ID of the associated dashboard
|
222
222
|
# * {hash} ctx - The context object to validate (https://api.losant.com/#/definitions/dashboardContextInstance)
|
223
223
|
# * {string} password - Password for password-protected dashboards
|
224
|
+
# * {string} duration - Duration of data to fetch in milliseconds
|
225
|
+
# * {string} resolution - Resolution in milliseconds
|
224
226
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
225
227
|
# * {boolean} _actions - Return resource actions in response
|
226
228
|
# * {boolean} _links - Return resource link in response
|
@@ -243,6 +245,8 @@ module LosantRest
|
|
243
245
|
|
244
246
|
body = params[:ctx] if params.has_key?(:ctx)
|
245
247
|
query_params[:password] = params[:password] if params.has_key?(:password)
|
248
|
+
query_params[:duration] = params[:duration] if params.has_key?(:duration)
|
249
|
+
query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
|
246
250
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
247
251
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
248
252
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/losant_rest/device.rb
CHANGED
@@ -145,6 +145,8 @@ module LosantRest
|
|
145
145
|
# * {string} applicationId - ID associated with the application
|
146
146
|
# * {string} deviceId - ID associated with the device
|
147
147
|
# * {string} excludeConnectionInfo - If set, do not return connection info
|
148
|
+
# * {string} tagsAsObject - Return tags as an object map instead of an array.
|
149
|
+
# * {string} attributesAsObject - Return attributes as an object map instead of an array.
|
148
150
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
149
151
|
# * {boolean} _actions - Return resource actions in response
|
150
152
|
# * {boolean} _links - Return resource link in response
|
@@ -166,6 +168,8 @@ module LosantRest
|
|
166
168
|
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
167
169
|
|
168
170
|
query_params[:excludeConnectionInfo] = params[:excludeConnectionInfo] if params.has_key?(:excludeConnectionInfo)
|
171
|
+
query_params[:tagsAsObject] = params[:tagsAsObject] if params.has_key?(:tagsAsObject)
|
172
|
+
query_params[:attributesAsObject] = params[:attributesAsObject] if params.has_key?(:attributesAsObject)
|
169
173
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
170
174
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
171
175
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
@@ -401,6 +405,8 @@ module LosantRest
|
|
401
405
|
# * {string} applicationId - ID associated with the application
|
402
406
|
# * {string} deviceId - ID associated with the device
|
403
407
|
# * {hash} device - Object containing new properties of the device (https://api.losant.com/#/definitions/devicePatch)
|
408
|
+
# * {string} tagsAsObject - Return tags as an object map instead of an array.
|
409
|
+
# * {string} attributesAsObject - Return attributes as an object map instead of an array.
|
404
410
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
405
411
|
# * {boolean} _actions - Return resource actions in response
|
406
412
|
# * {boolean} _links - Return resource link in response
|
@@ -423,6 +429,8 @@ module LosantRest
|
|
423
429
|
raise ArgumentError.new("device is required") unless params.has_key?(:device)
|
424
430
|
|
425
431
|
body = params[:device] if params.has_key?(:device)
|
432
|
+
query_params[:tagsAsObject] = params[:tagsAsObject] if params.has_key?(:tagsAsObject)
|
433
|
+
query_params[:attributesAsObject] = params[:attributesAsObject] if params.has_key?(:attributesAsObject)
|
426
434
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
427
435
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
428
436
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/losant_rest/devices.rb
CHANGED
@@ -250,6 +250,8 @@ module LosantRest
|
|
250
250
|
# * {string} excludeConnectionInfo - If set, do not return connection info
|
251
251
|
# * {string} parentId - Filter devices as children of a given system id
|
252
252
|
# * {hash} query - Device filter JSON object which overrides the filterField, filter, deviceClass, tagFilter, and parentId parameters. (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
253
|
+
# * {string} tagsAsObject - Return tags as an object map instead of an array.
|
254
|
+
# * {string} attributesAsObject - Return attributes as an object map instead of an array.
|
253
255
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
254
256
|
# * {boolean} _actions - Return resource actions in response
|
255
257
|
# * {boolean} _links - Return resource link in response
|
@@ -281,6 +283,8 @@ module LosantRest
|
|
281
283
|
query_params[:parentId] = params[:parentId] if params.has_key?(:parentId)
|
282
284
|
query_params[:query] = params[:query] if params.has_key?(:query)
|
283
285
|
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
286
|
+
query_params[:tagsAsObject] = params[:tagsAsObject] if params.has_key?(:tagsAsObject)
|
287
|
+
query_params[:attributesAsObject] = params[:attributesAsObject] if params.has_key?(:attributesAsObject)
|
284
288
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
285
289
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
286
290
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
@@ -401,6 +405,8 @@ module LosantRest
|
|
401
405
|
# Parameters:
|
402
406
|
# * {string} applicationId - ID associated with the application
|
403
407
|
# * {hash} device - New device information (https://api.losant.com/#/definitions/devicePost)
|
408
|
+
# * {string} tagsAsObject - Return tags as an object map instead of an array.
|
409
|
+
# * {string} attributesAsObject - Return attributes as an object map instead of an array.
|
404
410
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
405
411
|
# * {boolean} _actions - Return resource actions in response
|
406
412
|
# * {boolean} _links - Return resource link in response
|
@@ -422,6 +428,8 @@ module LosantRest
|
|
422
428
|
raise ArgumentError.new("device is required") unless params.has_key?(:device)
|
423
429
|
|
424
430
|
body = params[:device] if params.has_key?(:device)
|
431
|
+
query_params[:tagsAsObject] = params[:tagsAsObject] if params.has_key?(:tagsAsObject)
|
432
|
+
query_params[:attributesAsObject] = params[:attributesAsObject] if params.has_key?(:attributesAsObject)
|
425
433
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
426
434
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
427
435
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
@@ -0,0 +1,181 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2022 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 Instance Sandbox Resource
|
28
|
+
class InstanceSandbox
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# Deletes a sandbox user account
|
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, instanceSandbox.*, or instanceSandbox.delete.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} instanceId - ID associated with the instance
|
44
|
+
# * {string} instanceSandboxId - ID associated with the sandbox user
|
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 a sandbox 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 instance, organization or invite 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("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId)
|
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]}/sandboxes/#{params[:instanceSandboxId]}"
|
71
|
+
|
72
|
+
@client.request(
|
73
|
+
method: :delete,
|
74
|
+
path: path,
|
75
|
+
query: query_params,
|
76
|
+
headers: headers,
|
77
|
+
body: body)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Returns a sandbox user
|
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.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.get.
|
87
|
+
#
|
88
|
+
# Parameters:
|
89
|
+
# * {string} instanceId - ID associated with the instance
|
90
|
+
# * {string} instanceSandboxId - ID associated with the sandbox user
|
91
|
+
# * {string} summaryExclude - Comma-separated list of summary fields to exclude from user summary
|
92
|
+
# * {string} summaryInclude - Comma-separated list of summary fields to include in user summary
|
93
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
94
|
+
# * {boolean} _actions - Return resource actions in response
|
95
|
+
# * {boolean} _links - Return resource link in response
|
96
|
+
# * {boolean} _embedded - Return embedded resources in response
|
97
|
+
#
|
98
|
+
# Responses:
|
99
|
+
# * 200 - A single sandbox user (https://api.losant.com/#/definitions/instanceSandbox)
|
100
|
+
#
|
101
|
+
# Errors:
|
102
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
103
|
+
# * 404 - Error if sandbox was not found (https://api.losant.com/#/definitions/error)
|
104
|
+
def get(params = {})
|
105
|
+
params = Utils.symbolize_hash_keys(params)
|
106
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
107
|
+
headers = {}
|
108
|
+
body = nil
|
109
|
+
|
110
|
+
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
111
|
+
raise ArgumentError.new("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId)
|
112
|
+
|
113
|
+
query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
|
114
|
+
query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
|
115
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
116
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
117
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
118
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
119
|
+
|
120
|
+
path = "/instances/#{params[:instanceId]}/sandboxes/#{params[:instanceSandboxId]}"
|
121
|
+
|
122
|
+
@client.request(
|
123
|
+
method: :get,
|
124
|
+
path: path,
|
125
|
+
query: query_params,
|
126
|
+
headers: headers,
|
127
|
+
body: body)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Restores a sandbox user account
|
131
|
+
#
|
132
|
+
# Authentication:
|
133
|
+
# The client must be configured with a valid api
|
134
|
+
# access token to call this action. The token
|
135
|
+
# must include at least one of the following scopes:
|
136
|
+
# all.Instance, all.User, instanceSandbox.*, or instanceSandbox.undelete.
|
137
|
+
#
|
138
|
+
# Parameters:
|
139
|
+
# * {string} instanceId - ID associated with the instance
|
140
|
+
# * {string} instanceSandboxId - ID associated with the sandbox user
|
141
|
+
# * {string} summaryExclude - Comma-separated list of summary fields to exclude from user summary
|
142
|
+
# * {string} summaryInclude - Comma-separated list of summary fields to include in user summary
|
143
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
144
|
+
# * {boolean} _actions - Return resource actions in response
|
145
|
+
# * {boolean} _links - Return resource link in response
|
146
|
+
# * {boolean} _embedded - Return embedded resources in response
|
147
|
+
#
|
148
|
+
# Responses:
|
149
|
+
# * 200 - A single restored sandbox user (https://api.losant.com/#/definitions/instanceSandbox)
|
150
|
+
#
|
151
|
+
# Errors:
|
152
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
153
|
+
# * 404 - Error if sandbox was not found (https://api.losant.com/#/definitions/error)
|
154
|
+
def undelete(params = {})
|
155
|
+
params = Utils.symbolize_hash_keys(params)
|
156
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
157
|
+
headers = {}
|
158
|
+
body = nil
|
159
|
+
|
160
|
+
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
161
|
+
raise ArgumentError.new("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId)
|
162
|
+
|
163
|
+
query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
|
164
|
+
query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
|
165
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
166
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
167
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
168
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
169
|
+
|
170
|
+
path = "/instances/#{params[:instanceId]}/sandboxes/#{params[:instanceSandboxId]}/undelete"
|
171
|
+
|
172
|
+
@client.request(
|
173
|
+
method: :patch,
|
174
|
+
path: path,
|
175
|
+
query: query_params,
|
176
|
+
headers: headers,
|
177
|
+
body: body)
|
178
|
+
end
|
179
|
+
|
180
|
+
end
|
181
|
+
end
|