losant_rest 1.8.9 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/docs/_schemas.md +26390 -4889
- data/docs/device.md +1 -1
- data/docs/devices.md +44 -4
- data/lib/losant_rest/client.rb +2 -2
- data/lib/losant_rest/device.rb +1 -1
- data/lib/losant_rest/devices.rb +52 -4
- data/lib/losant_rest/version.rb +1 -1
- data/schemas/application.json +25 -0
- data/schemas/applicationApiTokenPost.json +1 -0
- data/schemas/applicationPatch.json +25 -0
- data/schemas/applicationPost.json +25 -0
- data/schemas/applications.json +25 -0
- data/schemas/authedDevice.json +2 -1
- data/schemas/dashboard.json +34 -11
- data/schemas/dashboardPatch.json +34 -11
- data/schemas/dashboardPost.json +34 -11
- data/schemas/dashboards.json +34 -11
- data/schemas/device.json +110 -1
- data/schemas/deviceClassFilter.json +31 -0
- data/schemas/devicePatch.json +110 -1
- data/schemas/devicePost.json +110 -1
- data/schemas/deviceRecipe.json +110 -1
- data/schemas/deviceRecipePatch.json +110 -1
- data/schemas/deviceRecipePost.json +110 -1
- data/schemas/deviceRecipes.json +110 -1
- data/schemas/devices.json +123 -2
- data/schemas/devicesPatch.json +209 -0
- data/schemas/flow.json +1491 -54
- data/schemas/flowPatch.json +1491 -54
- data/schemas/flowPost.json +1491 -54
- data/schemas/flowVersion.json +3319 -445
- data/schemas/flowVersionPost.json +1491 -54
- data/schemas/flowVersions.json +3319 -445
- data/schemas/flows.json +1491 -54
- data/schemas/flowsImportPost.json +3313 -439
- data/schemas/flowsImportResult.json +5129 -818
- data/schemas/githubLogin.json +1 -0
- data/schemas/userCredentials.json +1 -0
- data/schemas/userPost.json +1 -0
- metadata +5 -3
data/docs/device.md
CHANGED
@@ -87,7 +87,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
87
87
|
| start | string | N | Start time of export (ms since epoch - 0 means now, negative is relative to now) | 1 | 1465790400000 |
|
88
88
|
| end | string | N | End time of export (ms since epoch - 0 means now, negative is relative to now) | 0 | 1465790400000 |
|
89
89
|
| email | string | N | Email address to send export to. Defaults to current user's email. | | email@example.com |
|
90
|
-
| callbackUrl | string | N | Callback URL to call with export result
|
90
|
+
| callbackUrl | string | N | Callback URL to call with export result | | https://example.com/cburl |
|
91
91
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
92
92
|
|
93
93
|
#### Successful Responses
|
data/docs/devices.md
CHANGED
@@ -8,6 +8,7 @@ parameters and the potential responses.
|
|
8
8
|
|
9
9
|
* [Export](#export)
|
10
10
|
* [Get](#get)
|
11
|
+
* [Patch](#patch)
|
11
12
|
* [Post](#post)
|
12
13
|
* [Send Command](#send-command)
|
13
14
|
|
@@ -15,7 +16,7 @@ parameters and the potential responses.
|
|
15
16
|
|
16
17
|
## Export
|
17
18
|
|
18
|
-
Creates an export of all device metadata
|
19
|
+
Creates an export of all device metadata
|
19
20
|
|
20
21
|
```ruby
|
21
22
|
result = client.devices.export(applicationId: my_application_id)
|
@@ -34,7 +35,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
34
35
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
35
36
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
36
37
|
| email | string | N | Email address to send export to. Defaults to current user's email. | | email@example.com |
|
37
|
-
| callbackUrl | string | N | Callback URL to call with export result
|
38
|
+
| callbackUrl | string | N | Callback URL to call with export result | | https://example.com/cburl |
|
38
39
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
39
40
|
|
40
41
|
#### Successful Responses
|
@@ -78,9 +79,10 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
78
79
|
| perPage | string | N | How many items to return per page | 1000 | 10 |
|
79
80
|
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | name |
|
80
81
|
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my * device |
|
81
|
-
| deviceClass |
|
82
|
-
| tagFilter | [Device Tag Filter](_schemas.md#device-tag-filter) | N | Array of tag pairs to filter by
|
82
|
+
| deviceClass | [Device Class Filter](_schemas.md#device-class-filter) | N | Filter the devices by the given device class or classes | | [Device Class Filter Example](_schemas.md#device-class-filter-example) |
|
83
|
+
| tagFilter | [Device Tag Filter](_schemas.md#device-tag-filter) | N | Array of tag pairs to filter by | | [Device Tag Filter Example](_schemas.md#device-tag-filter-example) |
|
83
84
|
| excludeConnectionInfo | string | N | If set, do not return connection info | | true |
|
85
|
+
| parentId | string | N | Filter devices as children of a given system id | | 575ecf887ae143cd83dc4aa2 |
|
84
86
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
85
87
|
|
86
88
|
#### Successful Responses
|
@@ -98,6 +100,44 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
98
100
|
|
99
101
|
<br/>
|
100
102
|
|
103
|
+
## Patch
|
104
|
+
|
105
|
+
Update the fields of one or more devices
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
result = client.devices.patch(applicationId: my_application_id)
|
109
|
+
|
110
|
+
puts result
|
111
|
+
```
|
112
|
+
|
113
|
+
#### Authentication
|
114
|
+
The client must be configured with a valid api access token to call this
|
115
|
+
action. The token must include at least one of the following scopes:
|
116
|
+
all.Application, all.Organization, all.User, devices.*, or devices.patch.
|
117
|
+
|
118
|
+
#### Available Parameters
|
119
|
+
|
120
|
+
| Name | Type | Required | Description | Default | Example |
|
121
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
122
|
+
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
123
|
+
| patchInfo | [Devices Patch](_schemas.md#devices-patch) | N | Object containing device filter fields and updated properties | | [Devices Patch Example](_schemas.md#devices-patch-example) |
|
124
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
125
|
+
|
126
|
+
#### Successful Responses
|
127
|
+
|
128
|
+
| Code | Type | Description |
|
129
|
+
| ---- | ---- | ----------- |
|
130
|
+
| 201 | [Success](_schemas.md#success) | Successfully queued bulk update job |
|
131
|
+
|
132
|
+
#### Error Responses
|
133
|
+
|
134
|
+
| Code | Type | Description |
|
135
|
+
| ---- | ---- | ----------- |
|
136
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
137
|
+
| 404 | [Error](_schemas.md#error) | Error if application was not found |
|
138
|
+
|
139
|
+
<br/>
|
140
|
+
|
101
141
|
## Post
|
102
142
|
|
103
143
|
Create a new device for an application
|
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.
|
30
|
+
# Built For Version 1.16.0
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -274,7 +274,7 @@ module LosantRest
|
|
274
274
|
|
275
275
|
headers["Accept"] = "application/json"
|
276
276
|
headers["Content-Type"] = "application/json"
|
277
|
-
headers["Accept-Version"] = "^1.
|
277
|
+
headers["Accept-Version"] = "^1.16.0"
|
278
278
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
279
279
|
path = self.url + options.fetch(:path, "")
|
280
280
|
|
data/lib/losant_rest/device.rb
CHANGED
@@ -91,7 +91,7 @@ module LosantRest
|
|
91
91
|
# * {string} start - Start time of export (ms since epoch - 0 means now, negative is relative to now)
|
92
92
|
# * {string} end - End time of export (ms since epoch - 0 means now, negative is relative to now)
|
93
93
|
# * {string} email - Email address to send export to. Defaults to current user's email.
|
94
|
-
# * {string} callbackUrl - Callback URL to call with export result
|
94
|
+
# * {string} callbackUrl - Callback URL to call with export result
|
95
95
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
96
96
|
# * {boolean} _actions - Return resource actions in response
|
97
97
|
# * {boolean} _links - Return resource link in response
|
data/lib/losant_rest/devices.rb
CHANGED
@@ -31,7 +31,7 @@ module LosantRest
|
|
31
31
|
@client = client
|
32
32
|
end
|
33
33
|
|
34
|
-
# Creates an export of all device metadata
|
34
|
+
# Creates an export of all device metadata
|
35
35
|
#
|
36
36
|
# Authentication:
|
37
37
|
# The client must be configured with a valid api
|
@@ -42,7 +42,7 @@ module LosantRest
|
|
42
42
|
# Parameters:
|
43
43
|
# * {string} applicationId - ID associated with the application
|
44
44
|
# * {string} email - Email address to send export to. Defaults to current user's email.
|
45
|
-
# * {string} callbackUrl - Callback URL to call with export result
|
45
|
+
# * {string} callbackUrl - Callback URL to call with export result
|
46
46
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
47
47
|
# * {boolean} _actions - Return resource actions in response
|
48
48
|
# * {boolean} _links - Return resource link in response
|
@@ -95,9 +95,10 @@ module LosantRest
|
|
95
95
|
# * {string} perPage - How many items to return per page
|
96
96
|
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
97
97
|
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
98
|
-
# * {
|
99
|
-
# * {hash} tagFilter - Array of tag pairs to filter by
|
98
|
+
# * {hash} deviceClass - Filter the devices by the given device class or classes (https://api.losant.com/#/definitions/deviceClassFilter)
|
99
|
+
# * {hash} tagFilter - Array of tag pairs to filter by (https://api.losant.com/#/definitions/deviceTagFilter)
|
100
100
|
# * {string} excludeConnectionInfo - If set, do not return connection info
|
101
|
+
# * {string} parentId - Filter devices as children of a given system id
|
101
102
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
102
103
|
# * {boolean} _actions - Return resource actions in response
|
103
104
|
# * {boolean} _links - Return resource link in response
|
@@ -126,6 +127,7 @@ module LosantRest
|
|
126
127
|
query_params[:deviceClass] = params[:deviceClass] if params.has_key?(:deviceClass)
|
127
128
|
query_params[:tagFilter] = params[:tagFilter] if params.has_key?(:tagFilter)
|
128
129
|
query_params[:excludeConnectionInfo] = params[:excludeConnectionInfo] if params.has_key?(:excludeConnectionInfo)
|
130
|
+
query_params[:parentId] = params[:parentId] if params.has_key?(:parentId)
|
129
131
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
130
132
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
131
133
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
@@ -141,6 +143,52 @@ module LosantRest
|
|
141
143
|
body: body)
|
142
144
|
end
|
143
145
|
|
146
|
+
# Update the fields of one or more devices
|
147
|
+
#
|
148
|
+
# Authentication:
|
149
|
+
# The client must be configured with a valid api
|
150
|
+
# access token to call this action. The token
|
151
|
+
# must include at least one of the following scopes:
|
152
|
+
# all.Application, all.Organization, all.User, devices.*, or devices.patch.
|
153
|
+
#
|
154
|
+
# Parameters:
|
155
|
+
# * {string} applicationId - ID associated with the application
|
156
|
+
# * {hash} patchInfo - Object containing device filter fields and updated properties (https://api.losant.com/#/definitions/devicesPatch)
|
157
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
158
|
+
# * {boolean} _actions - Return resource actions in response
|
159
|
+
# * {boolean} _links - Return resource link in response
|
160
|
+
# * {boolean} _embedded - Return embedded resources in response
|
161
|
+
#
|
162
|
+
# Responses:
|
163
|
+
# * 201 - Successfully queued bulk update job (https://api.losant.com/#/definitions/success)
|
164
|
+
#
|
165
|
+
# Errors:
|
166
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
167
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
168
|
+
def patch(params = {})
|
169
|
+
params = Utils.symbolize_hash_keys(params)
|
170
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
171
|
+
headers = {}
|
172
|
+
body = nil
|
173
|
+
|
174
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
175
|
+
|
176
|
+
body = params[:patchInfo] if params.has_key?(:patchInfo)
|
177
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
178
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
179
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
180
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
181
|
+
|
182
|
+
path = "/applications/#{params[:applicationId]}/devices"
|
183
|
+
|
184
|
+
@client.request(
|
185
|
+
method: :patch,
|
186
|
+
path: path,
|
187
|
+
query: query_params,
|
188
|
+
headers: headers,
|
189
|
+
body: body)
|
190
|
+
end
|
191
|
+
|
144
192
|
# Create a new device for an application
|
145
193
|
#
|
146
194
|
# Authentication:
|
data/lib/losant_rest/version.rb
CHANGED
data/schemas/application.json
CHANGED
@@ -307,6 +307,31 @@
|
|
307
307
|
"bucket"
|
308
308
|
],
|
309
309
|
"additionalProperties": false
|
310
|
+
},
|
311
|
+
"azure": {
|
312
|
+
"type": "object",
|
313
|
+
"properties": {
|
314
|
+
"account": {
|
315
|
+
"type": "string",
|
316
|
+
"min": 3,
|
317
|
+
"max": 24
|
318
|
+
},
|
319
|
+
"accountKey": {
|
320
|
+
"type": "string",
|
321
|
+
"max": 255
|
322
|
+
},
|
323
|
+
"bucket": {
|
324
|
+
"type": "string",
|
325
|
+
"min": 3,
|
326
|
+
"max": 63
|
327
|
+
}
|
328
|
+
},
|
329
|
+
"required": [
|
330
|
+
"account",
|
331
|
+
"accountKey",
|
332
|
+
"bucket"
|
333
|
+
],
|
334
|
+
"additionalProperties": false
|
310
335
|
}
|
311
336
|
},
|
312
337
|
"additionalProperties": false
|
@@ -204,6 +204,31 @@
|
|
204
204
|
"bucket"
|
205
205
|
],
|
206
206
|
"additionalProperties": false
|
207
|
+
},
|
208
|
+
"azure": {
|
209
|
+
"type": "object",
|
210
|
+
"properties": {
|
211
|
+
"account": {
|
212
|
+
"type": "string",
|
213
|
+
"min": 3,
|
214
|
+
"max": 24
|
215
|
+
},
|
216
|
+
"accountKey": {
|
217
|
+
"type": "string",
|
218
|
+
"max": 255
|
219
|
+
},
|
220
|
+
"bucket": {
|
221
|
+
"type": "string",
|
222
|
+
"min": 3,
|
223
|
+
"max": 63
|
224
|
+
}
|
225
|
+
},
|
226
|
+
"required": [
|
227
|
+
"account",
|
228
|
+
"accountKey",
|
229
|
+
"bucket"
|
230
|
+
],
|
231
|
+
"additionalProperties": false
|
207
232
|
}
|
208
233
|
},
|
209
234
|
"additionalProperties": false
|
@@ -179,6 +179,31 @@
|
|
179
179
|
"bucket"
|
180
180
|
],
|
181
181
|
"additionalProperties": false
|
182
|
+
},
|
183
|
+
"azure": {
|
184
|
+
"type": "object",
|
185
|
+
"properties": {
|
186
|
+
"account": {
|
187
|
+
"type": "string",
|
188
|
+
"min": 3,
|
189
|
+
"max": 24
|
190
|
+
},
|
191
|
+
"accountKey": {
|
192
|
+
"type": "string",
|
193
|
+
"max": 255
|
194
|
+
},
|
195
|
+
"bucket": {
|
196
|
+
"type": "string",
|
197
|
+
"min": 3,
|
198
|
+
"max": 63
|
199
|
+
}
|
200
|
+
},
|
201
|
+
"required": [
|
202
|
+
"account",
|
203
|
+
"accountKey",
|
204
|
+
"bucket"
|
205
|
+
],
|
206
|
+
"additionalProperties": false
|
182
207
|
}
|
183
208
|
},
|
184
209
|
"additionalProperties": false
|
data/schemas/applications.json
CHANGED
@@ -314,6 +314,31 @@
|
|
314
314
|
"bucket"
|
315
315
|
],
|
316
316
|
"additionalProperties": false
|
317
|
+
},
|
318
|
+
"azure": {
|
319
|
+
"type": "object",
|
320
|
+
"properties": {
|
321
|
+
"account": {
|
322
|
+
"type": "string",
|
323
|
+
"min": 3,
|
324
|
+
"max": 24
|
325
|
+
},
|
326
|
+
"accountKey": {
|
327
|
+
"type": "string",
|
328
|
+
"max": 255
|
329
|
+
},
|
330
|
+
"bucket": {
|
331
|
+
"type": "string",
|
332
|
+
"min": 3,
|
333
|
+
"max": 63
|
334
|
+
}
|
335
|
+
},
|
336
|
+
"required": [
|
337
|
+
"account",
|
338
|
+
"accountKey",
|
339
|
+
"bucket"
|
340
|
+
],
|
341
|
+
"additionalProperties": false
|
317
342
|
}
|
318
343
|
},
|
319
344
|
"additionalProperties": false
|
data/schemas/authedDevice.json
CHANGED
data/schemas/dashboard.json
CHANGED
@@ -82,11 +82,11 @@
|
|
82
82
|
"properties": {
|
83
83
|
"id": {
|
84
84
|
"type": "string",
|
85
|
-
"
|
85
|
+
"maxLength": 48
|
86
86
|
},
|
87
87
|
"cron": {
|
88
88
|
"type": "string",
|
89
|
-
"
|
89
|
+
"maxLength": 255
|
90
90
|
},
|
91
91
|
"toEmail": {
|
92
92
|
"type": "array",
|
@@ -100,11 +100,11 @@
|
|
100
100
|
},
|
101
101
|
"subject": {
|
102
102
|
"type": "string",
|
103
|
-
"
|
103
|
+
"maxLength": 255
|
104
104
|
},
|
105
105
|
"message": {
|
106
106
|
"type": "string",
|
107
|
-
"
|
107
|
+
"maxLength": 32767
|
108
108
|
},
|
109
109
|
"theme": {
|
110
110
|
"type": "string",
|
@@ -115,7 +115,7 @@
|
|
115
115
|
},
|
116
116
|
"timezone": {
|
117
117
|
"type": "string",
|
118
|
-
"
|
118
|
+
"maxLength": 255
|
119
119
|
}
|
120
120
|
},
|
121
121
|
"additionalProperties": false,
|
@@ -191,7 +191,7 @@
|
|
191
191
|
"properties": {
|
192
192
|
"id": {
|
193
193
|
"type": "string",
|
194
|
-
"maxLength":
|
194
|
+
"maxLength": 48
|
195
195
|
},
|
196
196
|
"title": {
|
197
197
|
"type": "string",
|
@@ -393,15 +393,34 @@
|
|
393
393
|
"blockType": {
|
394
394
|
"type": "string",
|
395
395
|
"enum": [
|
396
|
-
"custom-chart"
|
396
|
+
"custom-chart",
|
397
|
+
"custom-html"
|
397
398
|
]
|
398
399
|
},
|
399
400
|
"config": {
|
400
401
|
"type": "object",
|
401
402
|
"properties": {
|
402
403
|
"configuration": {
|
403
|
-
"
|
404
|
-
|
404
|
+
"oneOf": [
|
405
|
+
{
|
406
|
+
"type": "object",
|
407
|
+
"properties": {
|
408
|
+
"headContent": {
|
409
|
+
"type": "string",
|
410
|
+
"maxLength": 32767
|
411
|
+
},
|
412
|
+
"bodyContent": {
|
413
|
+
"type": "string",
|
414
|
+
"maxLength": 32767
|
415
|
+
}
|
416
|
+
},
|
417
|
+
"additionalProperties": false
|
418
|
+
},
|
419
|
+
{
|
420
|
+
"type": "string",
|
421
|
+
"maxLength": 32767
|
422
|
+
}
|
423
|
+
]
|
405
424
|
},
|
406
425
|
"segments": {
|
407
426
|
"type": "array",
|
@@ -1089,7 +1108,7 @@
|
|
1089
1108
|
"properties": {
|
1090
1109
|
"id": {
|
1091
1110
|
"type": "string",
|
1092
|
-
"maxLength":
|
1111
|
+
"maxLength": 48
|
1093
1112
|
},
|
1094
1113
|
"title": {
|
1095
1114
|
"type": "string",
|
@@ -1555,6 +1574,10 @@
|
|
1555
1574
|
"detectDataGaps": {
|
1556
1575
|
"type": "boolean"
|
1557
1576
|
},
|
1577
|
+
"expression": {
|
1578
|
+
"type": "string",
|
1579
|
+
"maxLength": 255
|
1580
|
+
},
|
1558
1581
|
"graphType": {
|
1559
1582
|
"type": "string",
|
1560
1583
|
"enum": [
|
@@ -2459,7 +2482,7 @@
|
|
2459
2482
|
"properties": {
|
2460
2483
|
"id": {
|
2461
2484
|
"type": "string",
|
2462
|
-
"maxLength":
|
2485
|
+
"maxLength": 48
|
2463
2486
|
},
|
2464
2487
|
"title": {
|
2465
2488
|
"type": "string",
|