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.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/docs/_schemas.md +560 -25
- data/docs/application.md +77 -0
- data/docs/dashboard.md +1 -0
- data/docs/devices.md +1 -0
- data/docs/edgeDeployments.md +173 -0
- data/docs/flows.md +1 -0
- data/lib/losant_rest.rb +1 -0
- data/lib/losant_rest/application.rb +91 -0
- data/lib/losant_rest/client.rb +6 -2
- data/lib/losant_rest/dashboard.rb +2 -0
- data/lib/losant_rest/devices.rb +2 -0
- data/lib/losant_rest/edge_deployments.rb +234 -0
- data/lib/losant_rest/flows.rb +2 -0
- data/lib/losant_rest/version.rb +1 -1
- data/schemas/application.json +2 -2
- data/schemas/applicationApiTokenPost.json +7 -0
- data/schemas/applicationPatch.json +2 -2
- data/schemas/applicationPost.json +2 -2
- data/schemas/applications.json +2 -2
- data/schemas/authedDevice.json +2 -1
- data/schemas/dashboard.json +4 -0
- data/schemas/dashboardPatch.json +4 -0
- data/schemas/dashboardPost.json +4 -0
- data/schemas/dashboards.json +4 -0
- data/schemas/device.json +6 -1
- data/schemas/devicePatch.json +2 -1
- data/schemas/devicePost.json +2 -1
- data/schemas/deviceRecipe.json +2 -1
- data/schemas/deviceRecipePatch.json +2 -1
- data/schemas/deviceRecipePost.json +2 -1
- data/schemas/deviceRecipes.json +2 -1
- data/schemas/devices.json +37 -1
- data/schemas/edgeDeploymentRelease.json +50 -0
- data/schemas/edgeDeploymentRemove.json +25 -0
- data/schemas/edgeDeploymentReplace.json +29 -0
- data/schemas/edgeDeployments.json +152 -0
- data/schemas/flow.json +13 -0
- data/schemas/flowPatch.json +6 -0
- data/schemas/flowPost.json +13 -0
- data/schemas/flowVersion.json +6 -0
- data/schemas/flowVersionPost.json +6 -0
- data/schemas/flowVersions.json +6 -0
- data/schemas/flows.json +20 -0
- data/schemas/me.json +4 -0
- data/schemas/mePatch.json +4 -0
- data/schemas/solution.json +2 -2
- data/schemas/solutionUser.json +4 -0
- data/schemas/solutionUserPatch.json +4 -0
- data/schemas/solutionUserPost.json +4 -0
- data/schemas/solutionUsers.json +4 -0
- data/schemas/solutions.json +2 -2
- 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
|
data/lib/losant_rest/flows.rb
CHANGED
@@ -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)
|
data/lib/losant_rest/version.rb
CHANGED
data/schemas/application.json
CHANGED
@@ -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",
|
data/schemas/applications.json
CHANGED
data/schemas/authedDevice.json
CHANGED
data/schemas/dashboard.json
CHANGED
data/schemas/dashboardPatch.json
CHANGED
data/schemas/dashboardPost.json
CHANGED
data/schemas/dashboards.json
CHANGED
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": {
|
data/schemas/devicePatch.json
CHANGED
data/schemas/devicePost.json
CHANGED