losant_rest 1.1.0 → 1.1.1
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 +387 -2
- data/docs/applicationApiTokens.md +6 -0
- data/docs/dashboard.md +38 -0
- data/lib/losant_rest/application_api_tokens.rb +12 -0
- data/lib/losant_rest/client.rb +2 -2
- data/lib/losant_rest/dashboard.rb +44 -0
- data/lib/losant_rest/version.rb +1 -1
- data/schemas/authedDevice.json +1 -1
- data/schemas/dashboard.json +88 -0
- data/schemas/dashboardContextInstance.json +13 -0
- data/schemas/dashboardPatch.json +88 -0
- data/schemas/dashboardPost.json +88 -0
- data/schemas/dashboards.json +88 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6903262043118870ff55033c47b172fad616e0b
|
4
|
+
data.tar.gz: f882c3508c9f3ba13edcf378fabddbe1c8f541b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64091cffad4184637d763254fd9dcafc5f194f5fae2219e9a3afa64e2fb681093464df45c6c3321bf18434c47c61c7485011c567be301ba06f5b3a99f1bed444
|
7
|
+
data.tar.gz: 9ae85b832a687debaee8d7794580f57214ea8d9dac270fe74344f5db76ffb95ae2b1be128dbcb806422d685750209d11c2833f4a84b94a36c431ef12d02637fe
|
data/docs/_schemas.md
CHANGED
@@ -19,6 +19,7 @@
|
|
19
19
|
* [Authenticated User](#authenticated-user)
|
20
20
|
* [Composite Device State](#composite-device-state)
|
21
21
|
* [Dashboard](#dashboard)
|
22
|
+
* [Dashboard Context Instance](#dashboard-context-instance)
|
22
23
|
* [Dashboard Patch](#dashboard-patch)
|
23
24
|
* [Dashboard Post](#dashboard-post)
|
24
25
|
* [Dashboards](#dashboards)
|
@@ -1534,7 +1535,7 @@ Schema for the successful response when authenticating a Device
|
|
1534
1535
|
"type": "string",
|
1535
1536
|
"pattern": "^[A-Fa-f\\d]{24}$"
|
1536
1537
|
},
|
1537
|
-
"
|
1538
|
+
"deviceClass": {
|
1538
1539
|
"type": "string",
|
1539
1540
|
"enum": [
|
1540
1541
|
"standalone",
|
@@ -1563,7 +1564,7 @@ Schema for the successful response when authenticating a Device
|
|
1563
1564
|
{
|
1564
1565
|
"applicationId": "575ec8687ae143cd83dc4a97",
|
1565
1566
|
"deviceId": "575ecf887ae143cd83dc4aa2",
|
1566
|
-
"
|
1567
|
+
"deviceClass": "standalone",
|
1567
1568
|
"token": "token_to_use_for_authenticating_subsequent_requests"
|
1568
1569
|
}
|
1569
1570
|
```
|
@@ -1815,6 +1816,94 @@ Schema for a single Dashboard
|
|
1815
1816
|
],
|
1816
1817
|
"additionalProperties": false
|
1817
1818
|
}
|
1819
|
+
},
|
1820
|
+
"contextConfiguration": {
|
1821
|
+
"type": "array",
|
1822
|
+
"items": {
|
1823
|
+
"type": "object",
|
1824
|
+
"properties": {
|
1825
|
+
"name": {
|
1826
|
+
"type": "string",
|
1827
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
1828
|
+
},
|
1829
|
+
"type": {
|
1830
|
+
"type": "string",
|
1831
|
+
"enum": [
|
1832
|
+
"deviceId",
|
1833
|
+
"deviceAttribute",
|
1834
|
+
"string",
|
1835
|
+
"number"
|
1836
|
+
]
|
1837
|
+
},
|
1838
|
+
"applicationId": {
|
1839
|
+
"type": "string",
|
1840
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
1841
|
+
},
|
1842
|
+
"defaultValue": {
|
1843
|
+
"type": [
|
1844
|
+
"string",
|
1845
|
+
"number"
|
1846
|
+
]
|
1847
|
+
},
|
1848
|
+
"validationEnabled": {
|
1849
|
+
"type": "boolean"
|
1850
|
+
},
|
1851
|
+
"validationConfig": {
|
1852
|
+
"type": "object",
|
1853
|
+
"properties": {
|
1854
|
+
"min": {
|
1855
|
+
"type": "number"
|
1856
|
+
},
|
1857
|
+
"max": {
|
1858
|
+
"type": "number"
|
1859
|
+
},
|
1860
|
+
"regExp": {
|
1861
|
+
"type": "string",
|
1862
|
+
"maxLength": 1024
|
1863
|
+
},
|
1864
|
+
"attributes": {
|
1865
|
+
"type": "array",
|
1866
|
+
"items": {
|
1867
|
+
"type": "string",
|
1868
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
1869
|
+
}
|
1870
|
+
},
|
1871
|
+
"deviceIds": {
|
1872
|
+
"type": "array",
|
1873
|
+
"items": {
|
1874
|
+
"type": "string",
|
1875
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
1876
|
+
}
|
1877
|
+
},
|
1878
|
+
"deviceTags": {
|
1879
|
+
"type": "array",
|
1880
|
+
"items": {
|
1881
|
+
"type": "object",
|
1882
|
+
"properties": {
|
1883
|
+
"key": {
|
1884
|
+
"type": "string",
|
1885
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
1886
|
+
},
|
1887
|
+
"value": {
|
1888
|
+
"type": "string",
|
1889
|
+
"minLength": 1,
|
1890
|
+
"maxLength": 255
|
1891
|
+
}
|
1892
|
+
},
|
1893
|
+
"additionalProperties": false
|
1894
|
+
}
|
1895
|
+
}
|
1896
|
+
},
|
1897
|
+
"additionalProperties": false
|
1898
|
+
}
|
1899
|
+
},
|
1900
|
+
"required": [
|
1901
|
+
"name",
|
1902
|
+
"type",
|
1903
|
+
"defaultValue"
|
1904
|
+
],
|
1905
|
+
"additionalProperties": false
|
1906
|
+
}
|
1818
1907
|
}
|
1819
1908
|
}
|
1820
1909
|
}
|
@@ -1839,6 +1928,38 @@ Schema for a single Dashboard
|
|
1839
1928
|
|
1840
1929
|
<br/>
|
1841
1930
|
|
1931
|
+
## Dashboard Context Instance
|
1932
|
+
|
1933
|
+
Schema for a dashboard context instance
|
1934
|
+
|
1935
|
+
### <a name="dashboard-context-instance-schema"></a> Schema
|
1936
|
+
|
1937
|
+
```json
|
1938
|
+
{
|
1939
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
1940
|
+
"type": "object",
|
1941
|
+
"patternProperties": {
|
1942
|
+
"^[0-9a-zA-Z_-]{1,255}$": {
|
1943
|
+
"type": [
|
1944
|
+
"string",
|
1945
|
+
"number"
|
1946
|
+
]
|
1947
|
+
}
|
1948
|
+
},
|
1949
|
+
"additionalProperties": false
|
1950
|
+
}
|
1951
|
+
```
|
1952
|
+
### <a name="dashboard-context-instance-example"></a> Example
|
1953
|
+
|
1954
|
+
```json
|
1955
|
+
{
|
1956
|
+
"myContextVariable": "myValue",
|
1957
|
+
"myOtherVariable": "575ecf887ae143cd83dc4aa2"
|
1958
|
+
}
|
1959
|
+
```
|
1960
|
+
|
1961
|
+
<br/>
|
1962
|
+
|
1842
1963
|
## Dashboard Patch
|
1843
1964
|
|
1844
1965
|
Schema for the body of a Dashboard modification request
|
@@ -1917,6 +2038,94 @@ Schema for the body of a Dashboard modification request
|
|
1917
2038
|
"string",
|
1918
2039
|
"null"
|
1919
2040
|
]
|
2041
|
+
},
|
2042
|
+
"contextConfiguration": {
|
2043
|
+
"type": "array",
|
2044
|
+
"items": {
|
2045
|
+
"type": "object",
|
2046
|
+
"properties": {
|
2047
|
+
"name": {
|
2048
|
+
"type": "string",
|
2049
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
2050
|
+
},
|
2051
|
+
"type": {
|
2052
|
+
"type": "string",
|
2053
|
+
"enum": [
|
2054
|
+
"deviceId",
|
2055
|
+
"deviceAttribute",
|
2056
|
+
"string",
|
2057
|
+
"number"
|
2058
|
+
]
|
2059
|
+
},
|
2060
|
+
"applicationId": {
|
2061
|
+
"type": "string",
|
2062
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
2063
|
+
},
|
2064
|
+
"defaultValue": {
|
2065
|
+
"type": [
|
2066
|
+
"string",
|
2067
|
+
"number"
|
2068
|
+
]
|
2069
|
+
},
|
2070
|
+
"validationEnabled": {
|
2071
|
+
"type": "boolean"
|
2072
|
+
},
|
2073
|
+
"validationConfig": {
|
2074
|
+
"type": "object",
|
2075
|
+
"properties": {
|
2076
|
+
"min": {
|
2077
|
+
"type": "number"
|
2078
|
+
},
|
2079
|
+
"max": {
|
2080
|
+
"type": "number"
|
2081
|
+
},
|
2082
|
+
"regExp": {
|
2083
|
+
"type": "string",
|
2084
|
+
"maxLength": 1024
|
2085
|
+
},
|
2086
|
+
"attributes": {
|
2087
|
+
"type": "array",
|
2088
|
+
"items": {
|
2089
|
+
"type": "string",
|
2090
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
2091
|
+
}
|
2092
|
+
},
|
2093
|
+
"deviceIds": {
|
2094
|
+
"type": "array",
|
2095
|
+
"items": {
|
2096
|
+
"type": "string",
|
2097
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
2098
|
+
}
|
2099
|
+
},
|
2100
|
+
"deviceTags": {
|
2101
|
+
"type": "array",
|
2102
|
+
"items": {
|
2103
|
+
"type": "object",
|
2104
|
+
"properties": {
|
2105
|
+
"key": {
|
2106
|
+
"type": "string",
|
2107
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
2108
|
+
},
|
2109
|
+
"value": {
|
2110
|
+
"type": "string",
|
2111
|
+
"minLength": 1,
|
2112
|
+
"maxLength": 255
|
2113
|
+
}
|
2114
|
+
},
|
2115
|
+
"additionalProperties": false
|
2116
|
+
}
|
2117
|
+
}
|
2118
|
+
},
|
2119
|
+
"additionalProperties": false
|
2120
|
+
}
|
2121
|
+
},
|
2122
|
+
"required": [
|
2123
|
+
"name",
|
2124
|
+
"type",
|
2125
|
+
"defaultValue"
|
2126
|
+
],
|
2127
|
+
"additionalProperties": false
|
2128
|
+
}
|
1920
2129
|
}
|
1921
2130
|
},
|
1922
2131
|
"additionalProperties": false
|
@@ -2017,6 +2226,94 @@ Schema for the body of a Dashboard creation request
|
|
2017
2226
|
"string",
|
2018
2227
|
"null"
|
2019
2228
|
]
|
2229
|
+
},
|
2230
|
+
"contextConfiguration": {
|
2231
|
+
"type": "array",
|
2232
|
+
"items": {
|
2233
|
+
"type": "object",
|
2234
|
+
"properties": {
|
2235
|
+
"name": {
|
2236
|
+
"type": "string",
|
2237
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
2238
|
+
},
|
2239
|
+
"type": {
|
2240
|
+
"type": "string",
|
2241
|
+
"enum": [
|
2242
|
+
"deviceId",
|
2243
|
+
"deviceAttribute",
|
2244
|
+
"string",
|
2245
|
+
"number"
|
2246
|
+
]
|
2247
|
+
},
|
2248
|
+
"applicationId": {
|
2249
|
+
"type": "string",
|
2250
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
2251
|
+
},
|
2252
|
+
"defaultValue": {
|
2253
|
+
"type": [
|
2254
|
+
"string",
|
2255
|
+
"number"
|
2256
|
+
]
|
2257
|
+
},
|
2258
|
+
"validationEnabled": {
|
2259
|
+
"type": "boolean"
|
2260
|
+
},
|
2261
|
+
"validationConfig": {
|
2262
|
+
"type": "object",
|
2263
|
+
"properties": {
|
2264
|
+
"min": {
|
2265
|
+
"type": "number"
|
2266
|
+
},
|
2267
|
+
"max": {
|
2268
|
+
"type": "number"
|
2269
|
+
},
|
2270
|
+
"regExp": {
|
2271
|
+
"type": "string",
|
2272
|
+
"maxLength": 1024
|
2273
|
+
},
|
2274
|
+
"attributes": {
|
2275
|
+
"type": "array",
|
2276
|
+
"items": {
|
2277
|
+
"type": "string",
|
2278
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
2279
|
+
}
|
2280
|
+
},
|
2281
|
+
"deviceIds": {
|
2282
|
+
"type": "array",
|
2283
|
+
"items": {
|
2284
|
+
"type": "string",
|
2285
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
2286
|
+
}
|
2287
|
+
},
|
2288
|
+
"deviceTags": {
|
2289
|
+
"type": "array",
|
2290
|
+
"items": {
|
2291
|
+
"type": "object",
|
2292
|
+
"properties": {
|
2293
|
+
"key": {
|
2294
|
+
"type": "string",
|
2295
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
2296
|
+
},
|
2297
|
+
"value": {
|
2298
|
+
"type": "string",
|
2299
|
+
"minLength": 1,
|
2300
|
+
"maxLength": 255
|
2301
|
+
}
|
2302
|
+
},
|
2303
|
+
"additionalProperties": false
|
2304
|
+
}
|
2305
|
+
}
|
2306
|
+
},
|
2307
|
+
"additionalProperties": false
|
2308
|
+
}
|
2309
|
+
},
|
2310
|
+
"required": [
|
2311
|
+
"name",
|
2312
|
+
"type",
|
2313
|
+
"defaultValue"
|
2314
|
+
],
|
2315
|
+
"additionalProperties": false
|
2316
|
+
}
|
2020
2317
|
}
|
2021
2318
|
},
|
2022
2319
|
"additionalProperties": false,
|
@@ -2145,6 +2442,94 @@ Schema for a collection of Dashboards
|
|
2145
2442
|
],
|
2146
2443
|
"additionalProperties": false
|
2147
2444
|
}
|
2445
|
+
},
|
2446
|
+
"contextConfiguration": {
|
2447
|
+
"type": "array",
|
2448
|
+
"items": {
|
2449
|
+
"type": "object",
|
2450
|
+
"properties": {
|
2451
|
+
"name": {
|
2452
|
+
"type": "string",
|
2453
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
2454
|
+
},
|
2455
|
+
"type": {
|
2456
|
+
"type": "string",
|
2457
|
+
"enum": [
|
2458
|
+
"deviceId",
|
2459
|
+
"deviceAttribute",
|
2460
|
+
"string",
|
2461
|
+
"number"
|
2462
|
+
]
|
2463
|
+
},
|
2464
|
+
"applicationId": {
|
2465
|
+
"type": "string",
|
2466
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
2467
|
+
},
|
2468
|
+
"defaultValue": {
|
2469
|
+
"type": [
|
2470
|
+
"string",
|
2471
|
+
"number"
|
2472
|
+
]
|
2473
|
+
},
|
2474
|
+
"validationEnabled": {
|
2475
|
+
"type": "boolean"
|
2476
|
+
},
|
2477
|
+
"validationConfig": {
|
2478
|
+
"type": "object",
|
2479
|
+
"properties": {
|
2480
|
+
"min": {
|
2481
|
+
"type": "number"
|
2482
|
+
},
|
2483
|
+
"max": {
|
2484
|
+
"type": "number"
|
2485
|
+
},
|
2486
|
+
"regExp": {
|
2487
|
+
"type": "string",
|
2488
|
+
"maxLength": 1024
|
2489
|
+
},
|
2490
|
+
"attributes": {
|
2491
|
+
"type": "array",
|
2492
|
+
"items": {
|
2493
|
+
"type": "string",
|
2494
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
2495
|
+
}
|
2496
|
+
},
|
2497
|
+
"deviceIds": {
|
2498
|
+
"type": "array",
|
2499
|
+
"items": {
|
2500
|
+
"type": "string",
|
2501
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
2502
|
+
}
|
2503
|
+
},
|
2504
|
+
"deviceTags": {
|
2505
|
+
"type": "array",
|
2506
|
+
"items": {
|
2507
|
+
"type": "object",
|
2508
|
+
"properties": {
|
2509
|
+
"key": {
|
2510
|
+
"type": "string",
|
2511
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
2512
|
+
},
|
2513
|
+
"value": {
|
2514
|
+
"type": "string",
|
2515
|
+
"minLength": 1,
|
2516
|
+
"maxLength": 255
|
2517
|
+
}
|
2518
|
+
},
|
2519
|
+
"additionalProperties": false
|
2520
|
+
}
|
2521
|
+
}
|
2522
|
+
},
|
2523
|
+
"additionalProperties": false
|
2524
|
+
}
|
2525
|
+
},
|
2526
|
+
"required": [
|
2527
|
+
"name",
|
2528
|
+
"type",
|
2529
|
+
"defaultValue"
|
2530
|
+
],
|
2531
|
+
"additionalProperties": false
|
2532
|
+
}
|
2148
2533
|
}
|
2149
2534
|
}
|
2150
2535
|
}
|
@@ -31,6 +31,12 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
31
31
|
| Name | Type | Required | Description | Default | Example |
|
32
32
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
33
33
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
34
|
+
| sortField | string | N | Field to sort the results by. Accepted values are: name, status, id, creationDate | 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 | 1000 | 10 |
|
38
|
+
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, status | | key |
|
39
|
+
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*token |
|
34
40
|
|
35
41
|
#### Successful Responses
|
36
42
|
|
data/docs/dashboard.md
CHANGED
@@ -9,6 +9,7 @@ parameters and the potential responses.
|
|
9
9
|
* [Delete](#delete)
|
10
10
|
* [Get](#get)
|
11
11
|
* [Patch](#patch)
|
12
|
+
* [Validate Context](#validate-context)
|
12
13
|
|
13
14
|
<br/>
|
14
15
|
|
@@ -119,3 +120,40 @@ all.Organization, all.User, dashboard.*, or dashboard.patch.
|
|
119
120
|
| ---- | ---- | ----------- |
|
120
121
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
121
122
|
| 404 | [Error](_schemas.md#error) | Error if dashboard was not found |
|
123
|
+
|
124
|
+
<br/>
|
125
|
+
|
126
|
+
## Validate Context
|
127
|
+
|
128
|
+
Validates a context object against the dashboard's context configuration
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
result = client.dashboard.validate_context(
|
132
|
+
dashboardId: my_dashboard_id,
|
133
|
+
ctx: my_ctx)
|
134
|
+
|
135
|
+
puts result
|
136
|
+
```
|
137
|
+
|
138
|
+
#### Authentication
|
139
|
+
No api access token is required to call this action.
|
140
|
+
|
141
|
+
#### Available Parameters
|
142
|
+
|
143
|
+
| Name | Type | Required | Description | Default | Example |
|
144
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
145
|
+
| dashboardId | string | Y | ID of the associated dashboard | | 575ece2b7ae143cd83dc4a9b |
|
146
|
+
| 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) |
|
147
|
+
|
148
|
+
#### Successful Responses
|
149
|
+
|
150
|
+
| Code | Type | Description |
|
151
|
+
| ---- | ---- | ----------- |
|
152
|
+
| 200 | [Success](_schemas.md#success) | If context is valid |
|
153
|
+
|
154
|
+
#### Error Responses
|
155
|
+
|
156
|
+
| Code | Type | Description |
|
157
|
+
| ---- | ---- | ----------- |
|
158
|
+
| 400 | [Error](_schemas.md#error) | Error if context is invalid |
|
159
|
+
| 404 | [Error](_schemas.md#error) | Error if dashboard or application was not found |
|
@@ -39,6 +39,12 @@ module LosantRest
|
|
39
39
|
#
|
40
40
|
# Parameters:
|
41
41
|
# * {string} applicationId - ID associated with the application
|
42
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate
|
43
|
+
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
44
|
+
# * {string} page - Which page of results to return
|
45
|
+
# * {string} perPage - How many items to return per page
|
46
|
+
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, status
|
47
|
+
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
42
48
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
43
49
|
# * {boolean} _actions - Return resource actions in response
|
44
50
|
# * {boolean} _links - Return resource link in response
|
@@ -57,6 +63,12 @@ module LosantRest
|
|
57
63
|
|
58
64
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
59
65
|
|
66
|
+
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
67
|
+
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
68
|
+
query_params[:page] = params[:page] if params.has_key?(:page)
|
69
|
+
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
70
|
+
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
71
|
+
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
60
72
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
61
73
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
62
74
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
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.5.
|
30
|
+
# Built For Version 1.5.4
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -162,7 +162,7 @@ module LosantRest
|
|
162
162
|
|
163
163
|
headers["Accept"] = "application/json"
|
164
164
|
headers["Content-Type"] = "application/json"
|
165
|
-
headers["Accept-Version"] = "^1.5.
|
165
|
+
headers["Accept-Version"] = "^1.5.4"
|
166
166
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
167
167
|
path = self.url + options.fetch(:path, "")
|
168
168
|
|
@@ -163,5 +163,49 @@ module LosantRest
|
|
163
163
|
body: body)
|
164
164
|
end
|
165
165
|
|
166
|
+
# Validates a context object against the dashboard's context configuration
|
167
|
+
#
|
168
|
+
# Authentication:
|
169
|
+
# No api access token is required to call this action.
|
170
|
+
#
|
171
|
+
# Parameters:
|
172
|
+
# * {string} dashboardId - ID of the associated dashboard
|
173
|
+
# * {hash} ctx - The context object to validate (https://api.losant.com/#/definitions/dashboardContextInstance)
|
174
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
175
|
+
# * {boolean} _actions - Return resource actions in response
|
176
|
+
# * {boolean} _links - Return resource link in response
|
177
|
+
# * {boolean} _embedded - Return embedded resources in response
|
178
|
+
#
|
179
|
+
# Responses:
|
180
|
+
# * 200 - If context is valid (https://api.losant.com/#/definitions/success)
|
181
|
+
#
|
182
|
+
# Errors:
|
183
|
+
# * 400 - Error if context is invalid (https://api.losant.com/#/definitions/error)
|
184
|
+
# * 404 - Error if dashboard or application was not found (https://api.losant.com/#/definitions/error)
|
185
|
+
def validate_context(params = {})
|
186
|
+
params = Utils.symbolize_hash_keys(params)
|
187
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
188
|
+
headers = {}
|
189
|
+
body = nil
|
190
|
+
|
191
|
+
raise ArgumentError.new("dashboardId is required") unless params.has_key?(:dashboardId)
|
192
|
+
raise ArgumentError.new("ctx is required") unless params.has_key?(:ctx)
|
193
|
+
|
194
|
+
body = params[:ctx] if params.has_key?(:ctx)
|
195
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
196
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
197
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
198
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
199
|
+
|
200
|
+
path = "/dashboards/#{params[:dashboardId]}/validateContext"
|
201
|
+
|
202
|
+
@client.request(
|
203
|
+
method: :post,
|
204
|
+
path: path,
|
205
|
+
query: query_params,
|
206
|
+
headers: headers,
|
207
|
+
body: body)
|
208
|
+
end
|
209
|
+
|
166
210
|
end
|
167
211
|
end
|
data/lib/losant_rest/version.rb
CHANGED
data/schemas/authedDevice.json
CHANGED
data/schemas/dashboard.json
CHANGED
@@ -93,6 +93,94 @@
|
|
93
93
|
],
|
94
94
|
"additionalProperties": false
|
95
95
|
}
|
96
|
+
},
|
97
|
+
"contextConfiguration": {
|
98
|
+
"type": "array",
|
99
|
+
"items": {
|
100
|
+
"type": "object",
|
101
|
+
"properties": {
|
102
|
+
"name": {
|
103
|
+
"type": "string",
|
104
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
105
|
+
},
|
106
|
+
"type": {
|
107
|
+
"type": "string",
|
108
|
+
"enum": [
|
109
|
+
"deviceId",
|
110
|
+
"deviceAttribute",
|
111
|
+
"string",
|
112
|
+
"number"
|
113
|
+
]
|
114
|
+
},
|
115
|
+
"applicationId": {
|
116
|
+
"type": "string",
|
117
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
118
|
+
},
|
119
|
+
"defaultValue": {
|
120
|
+
"type": [
|
121
|
+
"string",
|
122
|
+
"number"
|
123
|
+
]
|
124
|
+
},
|
125
|
+
"validationEnabled": {
|
126
|
+
"type": "boolean"
|
127
|
+
},
|
128
|
+
"validationConfig": {
|
129
|
+
"type": "object",
|
130
|
+
"properties": {
|
131
|
+
"min": {
|
132
|
+
"type": "number"
|
133
|
+
},
|
134
|
+
"max": {
|
135
|
+
"type": "number"
|
136
|
+
},
|
137
|
+
"regExp": {
|
138
|
+
"type": "string",
|
139
|
+
"maxLength": 1024
|
140
|
+
},
|
141
|
+
"attributes": {
|
142
|
+
"type": "array",
|
143
|
+
"items": {
|
144
|
+
"type": "string",
|
145
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
146
|
+
}
|
147
|
+
},
|
148
|
+
"deviceIds": {
|
149
|
+
"type": "array",
|
150
|
+
"items": {
|
151
|
+
"type": "string",
|
152
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
153
|
+
}
|
154
|
+
},
|
155
|
+
"deviceTags": {
|
156
|
+
"type": "array",
|
157
|
+
"items": {
|
158
|
+
"type": "object",
|
159
|
+
"properties": {
|
160
|
+
"key": {
|
161
|
+
"type": "string",
|
162
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
163
|
+
},
|
164
|
+
"value": {
|
165
|
+
"type": "string",
|
166
|
+
"minLength": 1,
|
167
|
+
"maxLength": 255
|
168
|
+
}
|
169
|
+
},
|
170
|
+
"additionalProperties": false
|
171
|
+
}
|
172
|
+
}
|
173
|
+
},
|
174
|
+
"additionalProperties": false
|
175
|
+
}
|
176
|
+
},
|
177
|
+
"required": [
|
178
|
+
"name",
|
179
|
+
"type",
|
180
|
+
"defaultValue"
|
181
|
+
],
|
182
|
+
"additionalProperties": false
|
183
|
+
}
|
96
184
|
}
|
97
185
|
}
|
98
186
|
}
|
data/schemas/dashboardPatch.json
CHANGED
@@ -69,6 +69,94 @@
|
|
69
69
|
"string",
|
70
70
|
"null"
|
71
71
|
]
|
72
|
+
},
|
73
|
+
"contextConfiguration": {
|
74
|
+
"type": "array",
|
75
|
+
"items": {
|
76
|
+
"type": "object",
|
77
|
+
"properties": {
|
78
|
+
"name": {
|
79
|
+
"type": "string",
|
80
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
81
|
+
},
|
82
|
+
"type": {
|
83
|
+
"type": "string",
|
84
|
+
"enum": [
|
85
|
+
"deviceId",
|
86
|
+
"deviceAttribute",
|
87
|
+
"string",
|
88
|
+
"number"
|
89
|
+
]
|
90
|
+
},
|
91
|
+
"applicationId": {
|
92
|
+
"type": "string",
|
93
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
94
|
+
},
|
95
|
+
"defaultValue": {
|
96
|
+
"type": [
|
97
|
+
"string",
|
98
|
+
"number"
|
99
|
+
]
|
100
|
+
},
|
101
|
+
"validationEnabled": {
|
102
|
+
"type": "boolean"
|
103
|
+
},
|
104
|
+
"validationConfig": {
|
105
|
+
"type": "object",
|
106
|
+
"properties": {
|
107
|
+
"min": {
|
108
|
+
"type": "number"
|
109
|
+
},
|
110
|
+
"max": {
|
111
|
+
"type": "number"
|
112
|
+
},
|
113
|
+
"regExp": {
|
114
|
+
"type": "string",
|
115
|
+
"maxLength": 1024
|
116
|
+
},
|
117
|
+
"attributes": {
|
118
|
+
"type": "array",
|
119
|
+
"items": {
|
120
|
+
"type": "string",
|
121
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
122
|
+
}
|
123
|
+
},
|
124
|
+
"deviceIds": {
|
125
|
+
"type": "array",
|
126
|
+
"items": {
|
127
|
+
"type": "string",
|
128
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
129
|
+
}
|
130
|
+
},
|
131
|
+
"deviceTags": {
|
132
|
+
"type": "array",
|
133
|
+
"items": {
|
134
|
+
"type": "object",
|
135
|
+
"properties": {
|
136
|
+
"key": {
|
137
|
+
"type": "string",
|
138
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
139
|
+
},
|
140
|
+
"value": {
|
141
|
+
"type": "string",
|
142
|
+
"minLength": 1,
|
143
|
+
"maxLength": 255
|
144
|
+
}
|
145
|
+
},
|
146
|
+
"additionalProperties": false
|
147
|
+
}
|
148
|
+
}
|
149
|
+
},
|
150
|
+
"additionalProperties": false
|
151
|
+
}
|
152
|
+
},
|
153
|
+
"required": [
|
154
|
+
"name",
|
155
|
+
"type",
|
156
|
+
"defaultValue"
|
157
|
+
],
|
158
|
+
"additionalProperties": false
|
159
|
+
}
|
72
160
|
}
|
73
161
|
},
|
74
162
|
"additionalProperties": false
|
data/schemas/dashboardPost.json
CHANGED
@@ -73,6 +73,94 @@
|
|
73
73
|
"string",
|
74
74
|
"null"
|
75
75
|
]
|
76
|
+
},
|
77
|
+
"contextConfiguration": {
|
78
|
+
"type": "array",
|
79
|
+
"items": {
|
80
|
+
"type": "object",
|
81
|
+
"properties": {
|
82
|
+
"name": {
|
83
|
+
"type": "string",
|
84
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
85
|
+
},
|
86
|
+
"type": {
|
87
|
+
"type": "string",
|
88
|
+
"enum": [
|
89
|
+
"deviceId",
|
90
|
+
"deviceAttribute",
|
91
|
+
"string",
|
92
|
+
"number"
|
93
|
+
]
|
94
|
+
},
|
95
|
+
"applicationId": {
|
96
|
+
"type": "string",
|
97
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
98
|
+
},
|
99
|
+
"defaultValue": {
|
100
|
+
"type": [
|
101
|
+
"string",
|
102
|
+
"number"
|
103
|
+
]
|
104
|
+
},
|
105
|
+
"validationEnabled": {
|
106
|
+
"type": "boolean"
|
107
|
+
},
|
108
|
+
"validationConfig": {
|
109
|
+
"type": "object",
|
110
|
+
"properties": {
|
111
|
+
"min": {
|
112
|
+
"type": "number"
|
113
|
+
},
|
114
|
+
"max": {
|
115
|
+
"type": "number"
|
116
|
+
},
|
117
|
+
"regExp": {
|
118
|
+
"type": "string",
|
119
|
+
"maxLength": 1024
|
120
|
+
},
|
121
|
+
"attributes": {
|
122
|
+
"type": "array",
|
123
|
+
"items": {
|
124
|
+
"type": "string",
|
125
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
126
|
+
}
|
127
|
+
},
|
128
|
+
"deviceIds": {
|
129
|
+
"type": "array",
|
130
|
+
"items": {
|
131
|
+
"type": "string",
|
132
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
133
|
+
}
|
134
|
+
},
|
135
|
+
"deviceTags": {
|
136
|
+
"type": "array",
|
137
|
+
"items": {
|
138
|
+
"type": "object",
|
139
|
+
"properties": {
|
140
|
+
"key": {
|
141
|
+
"type": "string",
|
142
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
143
|
+
},
|
144
|
+
"value": {
|
145
|
+
"type": "string",
|
146
|
+
"minLength": 1,
|
147
|
+
"maxLength": 255
|
148
|
+
}
|
149
|
+
},
|
150
|
+
"additionalProperties": false
|
151
|
+
}
|
152
|
+
}
|
153
|
+
},
|
154
|
+
"additionalProperties": false
|
155
|
+
}
|
156
|
+
},
|
157
|
+
"required": [
|
158
|
+
"name",
|
159
|
+
"type",
|
160
|
+
"defaultValue"
|
161
|
+
],
|
162
|
+
"additionalProperties": false
|
163
|
+
}
|
76
164
|
}
|
77
165
|
},
|
78
166
|
"additionalProperties": false,
|
data/schemas/dashboards.json
CHANGED
@@ -100,6 +100,94 @@
|
|
100
100
|
],
|
101
101
|
"additionalProperties": false
|
102
102
|
}
|
103
|
+
},
|
104
|
+
"contextConfiguration": {
|
105
|
+
"type": "array",
|
106
|
+
"items": {
|
107
|
+
"type": "object",
|
108
|
+
"properties": {
|
109
|
+
"name": {
|
110
|
+
"type": "string",
|
111
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
112
|
+
},
|
113
|
+
"type": {
|
114
|
+
"type": "string",
|
115
|
+
"enum": [
|
116
|
+
"deviceId",
|
117
|
+
"deviceAttribute",
|
118
|
+
"string",
|
119
|
+
"number"
|
120
|
+
]
|
121
|
+
},
|
122
|
+
"applicationId": {
|
123
|
+
"type": "string",
|
124
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
125
|
+
},
|
126
|
+
"defaultValue": {
|
127
|
+
"type": [
|
128
|
+
"string",
|
129
|
+
"number"
|
130
|
+
]
|
131
|
+
},
|
132
|
+
"validationEnabled": {
|
133
|
+
"type": "boolean"
|
134
|
+
},
|
135
|
+
"validationConfig": {
|
136
|
+
"type": "object",
|
137
|
+
"properties": {
|
138
|
+
"min": {
|
139
|
+
"type": "number"
|
140
|
+
},
|
141
|
+
"max": {
|
142
|
+
"type": "number"
|
143
|
+
},
|
144
|
+
"regExp": {
|
145
|
+
"type": "string",
|
146
|
+
"maxLength": 1024
|
147
|
+
},
|
148
|
+
"attributes": {
|
149
|
+
"type": "array",
|
150
|
+
"items": {
|
151
|
+
"type": "string",
|
152
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
153
|
+
}
|
154
|
+
},
|
155
|
+
"deviceIds": {
|
156
|
+
"type": "array",
|
157
|
+
"items": {
|
158
|
+
"type": "string",
|
159
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
160
|
+
}
|
161
|
+
},
|
162
|
+
"deviceTags": {
|
163
|
+
"type": "array",
|
164
|
+
"items": {
|
165
|
+
"type": "object",
|
166
|
+
"properties": {
|
167
|
+
"key": {
|
168
|
+
"type": "string",
|
169
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
170
|
+
},
|
171
|
+
"value": {
|
172
|
+
"type": "string",
|
173
|
+
"minLength": 1,
|
174
|
+
"maxLength": 255
|
175
|
+
}
|
176
|
+
},
|
177
|
+
"additionalProperties": false
|
178
|
+
}
|
179
|
+
}
|
180
|
+
},
|
181
|
+
"additionalProperties": false
|
182
|
+
}
|
183
|
+
},
|
184
|
+
"required": [
|
185
|
+
"name",
|
186
|
+
"type",
|
187
|
+
"defaultValue"
|
188
|
+
],
|
189
|
+
"additionalProperties": false
|
190
|
+
}
|
103
191
|
}
|
104
192
|
}
|
105
193
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: losant_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Kuehl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- schemas/authedUser.json
|
169
169
|
- schemas/compositeDeviceState.json
|
170
170
|
- schemas/dashboard.json
|
171
|
+
- schemas/dashboardContextInstance.json
|
171
172
|
- schemas/dashboardPatch.json
|
172
173
|
- schemas/dashboardPost.json
|
173
174
|
- schemas/dashboards.json
|