losant_rest 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/docs/_schemas.md +560 -25
  4. data/docs/application.md +77 -0
  5. data/docs/dashboard.md +1 -0
  6. data/docs/devices.md +1 -0
  7. data/docs/edgeDeployments.md +173 -0
  8. data/docs/flows.md +1 -0
  9. data/lib/losant_rest.rb +1 -0
  10. data/lib/losant_rest/application.rb +91 -0
  11. data/lib/losant_rest/client.rb +6 -2
  12. data/lib/losant_rest/dashboard.rb +2 -0
  13. data/lib/losant_rest/devices.rb +2 -0
  14. data/lib/losant_rest/edge_deployments.rb +234 -0
  15. data/lib/losant_rest/flows.rb +2 -0
  16. data/lib/losant_rest/version.rb +1 -1
  17. data/schemas/application.json +2 -2
  18. data/schemas/applicationApiTokenPost.json +7 -0
  19. data/schemas/applicationPatch.json +2 -2
  20. data/schemas/applicationPost.json +2 -2
  21. data/schemas/applications.json +2 -2
  22. data/schemas/authedDevice.json +2 -1
  23. data/schemas/dashboard.json +4 -0
  24. data/schemas/dashboardPatch.json +4 -0
  25. data/schemas/dashboardPost.json +4 -0
  26. data/schemas/dashboards.json +4 -0
  27. data/schemas/device.json +6 -1
  28. data/schemas/devicePatch.json +2 -1
  29. data/schemas/devicePost.json +2 -1
  30. data/schemas/deviceRecipe.json +2 -1
  31. data/schemas/deviceRecipePatch.json +2 -1
  32. data/schemas/deviceRecipePost.json +2 -1
  33. data/schemas/deviceRecipes.json +2 -1
  34. data/schemas/devices.json +37 -1
  35. data/schemas/edgeDeploymentRelease.json +50 -0
  36. data/schemas/edgeDeploymentRemove.json +25 -0
  37. data/schemas/edgeDeploymentReplace.json +29 -0
  38. data/schemas/edgeDeployments.json +152 -0
  39. data/schemas/flow.json +13 -0
  40. data/schemas/flowPatch.json +6 -0
  41. data/schemas/flowPost.json +13 -0
  42. data/schemas/flowVersion.json +6 -0
  43. data/schemas/flowVersionPost.json +6 -0
  44. data/schemas/flowVersions.json +6 -0
  45. data/schemas/flows.json +20 -0
  46. data/schemas/me.json +4 -0
  47. data/schemas/mePatch.json +4 -0
  48. data/schemas/solution.json +2 -2
  49. data/schemas/solutionUser.json +4 -0
  50. data/schemas/solutionUserPatch.json +4 -0
  51. data/schemas/solutionUserPost.json +4 -0
  52. data/schemas/solutionUsers.json +4 -0
  53. data/schemas/solutions.json +2 -2
  54. metadata +8 -2
@@ -0,0 +1,234 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2018 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
+ module LosantRest
24
+
25
+ # Class containing all the actions for the Edge Deployments Resource
26
+ class EdgeDeployments
27
+
28
+ def initialize(client)
29
+ @client = client
30
+ end
31
+
32
+ # Returns the edge deployments for an application
33
+ #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, edgeDeployments.*, or edgeDeployments.get.
39
+ #
40
+ # Parameters:
41
+ # * {string} applicationId - ID associated with the application
42
+ # * {string} sortField - Field to sort the results by. Accepted values are: id, deviceId, flowId, desiredVersion, currentVersion, creationDate, lastUpdated
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} deviceId - Filter deployments to the given Device ID
47
+ # * {string} version - Filter deployments to the given Workflow Version (matches against both current and desired)
48
+ # * {undefined} filterEmpty - Filter out deployments where both the current and desired version are null.
49
+ # * {string} flowId - Filter deployments to the given Workflow ID
50
+ # * {string} losantdomain - Domain scope of request (rarely needed)
51
+ # * {boolean} _actions - Return resource actions in response
52
+ # * {boolean} _links - Return resource link in response
53
+ # * {boolean} _embedded - Return embedded resources in response
54
+ #
55
+ # Responses:
56
+ # * 200 - Collection of edge deployments (https://api.losant.com/#/definitions/edgeDeployments)
57
+ #
58
+ # Errors:
59
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
60
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
61
+ def get(params = {})
62
+ params = Utils.symbolize_hash_keys(params)
63
+ query_params = { _actions: false, _links: true, _embedded: true }
64
+ headers = {}
65
+ body = nil
66
+
67
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
68
+
69
+ query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
70
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
71
+ query_params[:page] = params[:page] if params.has_key?(:page)
72
+ query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
73
+ query_params[:deviceId] = params[:deviceId] if params.has_key?(:deviceId)
74
+ query_params[:version] = params[:version] if params.has_key?(:version)
75
+ query_params[:filterEmpty] = params[:filterEmpty] if params.has_key?(:filterEmpty)
76
+ query_params[:flowId] = params[:flowId] if params.has_key?(:flowId)
77
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
78
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
79
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
80
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
81
+
82
+ path = "/applications/#{params[:applicationId]}/edge/deployments"
83
+
84
+ @client.request(
85
+ method: :get,
86
+ path: path,
87
+ query: query_params,
88
+ headers: headers,
89
+ body: body)
90
+ end
91
+
92
+ # Deploy an edge workflow version to one or more edge devices. Version can be blank, if removal is desired.
93
+ #
94
+ # Authentication:
95
+ # The client must be configured with a valid api
96
+ # access token to call this action. The token
97
+ # must include at least one of the following scopes:
98
+ # all.Application, all.Organization, all.User, edgeDeployments.*, or edgeDeployments.release.
99
+ #
100
+ # Parameters:
101
+ # * {string} applicationId - ID associated with the application
102
+ # * {hash} deployment - Deployment release information (https://api.losant.com/#/definitions/edgeDeploymentRelease)
103
+ # * {string} losantdomain - Domain scope of request (rarely needed)
104
+ # * {boolean} _actions - Return resource actions in response
105
+ # * {boolean} _links - Return resource link in response
106
+ # * {boolean} _embedded - Return embedded resources in response
107
+ #
108
+ # Responses:
109
+ # * 201 - If deployment release has been initiated successfully (https://api.losant.com/#/definitions/success)
110
+ #
111
+ # Errors:
112
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
113
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
114
+ def release(params = {})
115
+ params = Utils.symbolize_hash_keys(params)
116
+ query_params = { _actions: false, _links: true, _embedded: true }
117
+ headers = {}
118
+ body = nil
119
+
120
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
121
+ raise ArgumentError.new("deployment is required") unless params.has_key?(:deployment)
122
+
123
+ body = params[:deployment] if params.has_key?(:deployment)
124
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
125
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
126
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
127
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
128
+
129
+ path = "/applications/#{params[:applicationId]}/edge/deployments/release"
130
+
131
+ @client.request(
132
+ method: :post,
133
+ path: path,
134
+ query: query_params,
135
+ headers: headers,
136
+ body: body)
137
+ end
138
+
139
+ # Remove all edge deployments from a device, remove all edge deployments of a workflow, or remove a specific workflow from a specific device
140
+ #
141
+ # Authentication:
142
+ # The client must be configured with a valid api
143
+ # access token to call this action. The token
144
+ # must include at least one of the following scopes:
145
+ # all.Application, all.Organization, all.User, edgeDeployments.*, or edgeDeployments.remove.
146
+ #
147
+ # Parameters:
148
+ # * {string} applicationId - ID associated with the application
149
+ # * {hash} deployment - Deployment removal information (https://api.losant.com/#/definitions/edgeDeploymentRemove)
150
+ # * {string} losantdomain - Domain scope of request (rarely needed)
151
+ # * {boolean} _actions - Return resource actions in response
152
+ # * {boolean} _links - Return resource link in response
153
+ # * {boolean} _embedded - Return embedded resources in response
154
+ #
155
+ # Responses:
156
+ # * 201 - If deployment removal has been initiated successfully (https://api.losant.com/#/definitions/success)
157
+ #
158
+ # Errors:
159
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
160
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
161
+ def remove(params = {})
162
+ params = Utils.symbolize_hash_keys(params)
163
+ query_params = { _actions: false, _links: true, _embedded: true }
164
+ headers = {}
165
+ body = nil
166
+
167
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
168
+ raise ArgumentError.new("deployment is required") unless params.has_key?(:deployment)
169
+
170
+ body = params[:deployment] if params.has_key?(:deployment)
171
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
172
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
173
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
174
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
175
+
176
+ path = "/applications/#{params[:applicationId]}/edge/deployments/remove"
177
+
178
+ @client.request(
179
+ method: :post,
180
+ path: path,
181
+ query: query_params,
182
+ headers: headers,
183
+ body: body)
184
+ end
185
+
186
+ # Replace deployments of an edge workflow version with a new version. New version can be blank, if removal is desired.
187
+ #
188
+ # Authentication:
189
+ # The client must be configured with a valid api
190
+ # access token to call this action. The token
191
+ # must include at least one of the following scopes:
192
+ # all.Application, all.Organization, all.User, edgeDeployments.*, or edgeDeployments.replace.
193
+ #
194
+ # Parameters:
195
+ # * {string} applicationId - ID associated with the application
196
+ # * {hash} deployment - Deployment replacement information (https://api.losant.com/#/definitions/edgeDeploymentReplace)
197
+ # * {string} losantdomain - Domain scope of request (rarely needed)
198
+ # * {boolean} _actions - Return resource actions in response
199
+ # * {boolean} _links - Return resource link in response
200
+ # * {boolean} _embedded - Return embedded resources in response
201
+ #
202
+ # Responses:
203
+ # * 201 - If deployment replacement has been initiated successfully (https://api.losant.com/#/definitions/success)
204
+ #
205
+ # Errors:
206
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
207
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
208
+ def replace(params = {})
209
+ params = Utils.symbolize_hash_keys(params)
210
+ query_params = { _actions: false, _links: true, _embedded: true }
211
+ headers = {}
212
+ body = nil
213
+
214
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
215
+ raise ArgumentError.new("deployment is required") unless params.has_key?(:deployment)
216
+
217
+ body = params[:deployment] if params.has_key?(:deployment)
218
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
219
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
220
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
221
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
222
+
223
+ path = "/applications/#{params[:applicationId]}/edge/deployments/replace"
224
+
225
+ @client.request(
226
+ method: :post,
227
+ path: path,
228
+ query: query_params,
229
+ headers: headers,
230
+ body: body)
231
+ end
232
+
233
+ end
234
+ end
@@ -45,6 +45,7 @@ module LosantRest
45
45
  # * {string} perPage - How many items to return per page
46
46
  # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
47
47
  # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
48
+ # * {string} flowClass - Filter the workflows by the given flow class. Accepted values are: edge, cloud
48
49
  # * {hash} triggerFilter - Array of triggers to filter by - always filters against default flow version. (https://api.losant.com/#/definitions/flowTriggerFilter)
49
50
  # * {string} losantdomain - Domain scope of request (rarely needed)
50
51
  # * {boolean} _actions - Return resource actions in response
@@ -71,6 +72,7 @@ module LosantRest
71
72
  query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
72
73
  query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
73
74
  query_params[:filter] = params[:filter] if params.has_key?(:filter)
75
+ query_params[:flowClass] = params[:flowClass] if params.has_key?(:flowClass)
74
76
  query_params[:triggerFilter] = params[:triggerFilter] if params.has_key?(:triggerFilter)
75
77
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
76
78
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
@@ -21,5 +21,5 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  module LosantRest
24
- VERSION = "1.4.2"
24
+ VERSION = "1.5.0"
25
25
  end
@@ -41,8 +41,8 @@
41
41
  "endpointSlug": {
42
42
  "type": "string",
43
43
  "minLength": 4,
44
- "maxLength": 255,
45
- "pattern": "^[0-9a-z_-]*$"
44
+ "maxLength": 63,
45
+ "pattern": "^[0-9a-z-]*$"
46
46
  },
47
47
  "expUserTokenCutoff": {
48
48
  "type": "string",
@@ -36,6 +36,7 @@
36
36
  "deviceRecipe.*",
37
37
  "deviceRecipes.*",
38
38
  "devices.*",
39
+ "edgeDeployments.*",
39
40
  "event.*",
40
41
  "events.*",
41
42
  "experienceDomain.*",
@@ -56,6 +57,8 @@
56
57
  "flowVersions.*",
57
58
  "webhook.*",
58
59
  "webhooks.*",
60
+ "application.archiveData",
61
+ "application.backfillArchiveData",
59
62
  "application.delete",
60
63
  "application.get",
61
64
  "application.patch",
@@ -109,6 +112,10 @@
109
112
  "devices.get",
110
113
  "devices.post",
111
114
  "devices.sendCommand",
115
+ "edgeDeployments.get",
116
+ "edgeDeployments.release",
117
+ "edgeDeployments.remove",
118
+ "edgeDeployments.replace",
112
119
  "event.delete",
113
120
  "event.get",
114
121
  "event.patch",
@@ -14,8 +14,8 @@
14
14
  "endpointSlug": {
15
15
  "type": "string",
16
16
  "minLength": 4,
17
- "maxLength": 255,
18
- "pattern": "^[0-9a-z_-]*$"
17
+ "maxLength": 63,
18
+ "pattern": "^[0-9a-z-]*$"
19
19
  },
20
20
  "expUserTokenCutoff": {
21
21
  "type": "string",
@@ -18,8 +18,8 @@
18
18
  "endpointSlug": {
19
19
  "type": "string",
20
20
  "minLength": 4,
21
- "maxLength": 255,
22
- "pattern": "^[0-9a-z_-]*$"
21
+ "maxLength": 63,
22
+ "pattern": "^[0-9a-z-]*$"
23
23
  },
24
24
  "expUserTokenCutoff": {
25
25
  "type": "string",
@@ -48,8 +48,8 @@
48
48
  "endpointSlug": {
49
49
  "type": "string",
50
50
  "minLength": 4,
51
- "maxLength": 255,
52
- "pattern": "^[0-9a-z_-]*$"
51
+ "maxLength": 63,
52
+ "pattern": "^[0-9a-z-]*$"
53
53
  },
54
54
  "expUserTokenCutoff": {
55
55
  "type": "string",
@@ -16,7 +16,8 @@
16
16
  "standalone",
17
17
  "gateway",
18
18
  "peripheral",
19
- "floating"
19
+ "floating",
20
+ "edgeCompute"
20
21
  ]
21
22
  },
22
23
  "token": {
@@ -114,6 +114,10 @@
114
114
  "type": "string",
115
115
  "maxLength": 255
116
116
  },
117
+ "description": {
118
+ "type": "string",
119
+ "maxLength": 32767
120
+ },
117
121
  "applicationId": {
118
122
  "type": "string",
119
123
  "pattern": "^[A-Fa-f\\d]{24}$"
@@ -22,6 +22,10 @@
22
22
  "type": "string",
23
23
  "maxLength": 255
24
24
  },
25
+ "description": {
26
+ "type": "string",
27
+ "maxLength": 32767
28
+ },
25
29
  "applicationId": {
26
30
  "type": "string",
27
31
  "pattern": "^[A-Fa-f\\d]{24}$"
@@ -26,6 +26,10 @@
26
26
  "type": "string",
27
27
  "maxLength": 255
28
28
  },
29
+ "description": {
30
+ "type": "string",
31
+ "maxLength": 32767
32
+ },
29
33
  "applicationId": {
30
34
  "type": "string",
31
35
  "pattern": "^[A-Fa-f\\d]{24}$"
@@ -121,6 +121,10 @@
121
121
  "type": "string",
122
122
  "maxLength": 255
123
123
  },
124
+ "description": {
125
+ "type": "string",
126
+ "maxLength": 32767
127
+ },
124
128
  "applicationId": {
125
129
  "type": "string",
126
130
  "pattern": "^[A-Fa-f\\d]{24}$"
data/schemas/device.json CHANGED
@@ -87,13 +87,18 @@
87
87
  "standalone",
88
88
  "gateway",
89
89
  "peripheral",
90
- "floating"
90
+ "floating",
91
+ "edgeCompute"
91
92
  ]
92
93
  },
93
94
  "gatewayId": {
94
95
  "type": "string",
95
96
  "pattern": "^[A-Fa-f\\d]{24}$"
96
97
  },
98
+ "edgeAgentVersion": {
99
+ "type": "string",
100
+ "pattern": "^(0|([1-9]\\d*))\\.(0|([1-9]\\d*))\\.(0|([1-9]\\d*))$"
101
+ },
97
102
  "connectionInfo": {
98
103
  "type": "object",
99
104
  "properties": {
@@ -67,7 +67,8 @@
67
67
  "standalone",
68
68
  "gateway",
69
69
  "peripheral",
70
- "floating"
70
+ "floating",
71
+ "edgeCompute"
71
72
  ]
72
73
  },
73
74
  "gatewayId": {
@@ -67,7 +67,8 @@
67
67
  "standalone",
68
68
  "gateway",
69
69
  "peripheral",
70
- "floating"
70
+ "floating",
71
+ "edgeCompute"
71
72
  ]
72
73
  },
73
74
  "gatewayId": {
@@ -96,7 +96,8 @@
96
96
  "standalone",
97
97
  "gateway",
98
98
  "peripheral",
99
- "floating"
99
+ "floating",
100
+ "edgeCompute"
100
101
  ]
101
102
  },
102
103
  "gatewayId": {