losant_rest 1.9.1 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/docs/_schemas.md +41608 -19945
- data/docs/application.md +168 -4
- data/docs/applicationTemplates.md +50 -0
- data/docs/applications.md +46 -0
- data/docs/auth.md +72 -0
- data/docs/device.md +1 -0
- data/docs/devices.md +89 -2
- data/docs/experienceEndpoint.md +43 -0
- data/docs/experienceEndpoints.md +1 -1
- data/docs/experienceView.md +43 -0
- data/lib/losant_rest.rb +2 -1
- data/lib/losant_rest/application.rb +144 -5
- data/lib/losant_rest/application_api_token.rb +1 -1
- data/lib/losant_rest/application_api_tokens.rb +1 -1
- data/lib/losant_rest/application_certificate.rb +1 -1
- data/lib/losant_rest/application_certificate_authorities.rb +1 -1
- data/lib/losant_rest/application_certificate_authority.rb +1 -1
- data/lib/losant_rest/application_certificates.rb +1 -1
- data/lib/losant_rest/application_key.rb +1 -1
- data/lib/losant_rest/application_keys.rb +1 -1
- data/lib/losant_rest/application_templates.rb +88 -0
- data/lib/losant_rest/applications.rb +1 -1
- data/lib/losant_rest/audit_log.rb +1 -1
- data/lib/losant_rest/audit_logs.rb +1 -1
- data/lib/losant_rest/auth.rb +85 -1
- data/lib/losant_rest/client.rb +7 -3
- data/lib/losant_rest/dashboard.rb +1 -1
- data/lib/losant_rest/dashboards.rb +1 -1
- data/lib/losant_rest/data.rb +1 -1
- data/lib/losant_rest/data_table.rb +1 -1
- data/lib/losant_rest/data_table_row.rb +1 -1
- data/lib/losant_rest/data_table_rows.rb +1 -1
- data/lib/losant_rest/data_tables.rb +1 -1
- data/lib/losant_rest/device.rb +3 -1
- data/lib/losant_rest/device_recipe.rb +1 -1
- data/lib/losant_rest/device_recipes.rb +1 -1
- data/lib/losant_rest/devices.rb +105 -3
- data/lib/losant_rest/edge_deployments.rb +1 -1
- data/lib/losant_rest/error.rb +1 -1
- data/lib/losant_rest/event.rb +1 -1
- data/lib/losant_rest/events.rb +1 -1
- data/lib/losant_rest/experience.rb +1 -1
- data/lib/losant_rest/experience_domain.rb +1 -1
- data/lib/losant_rest/experience_domains.rb +1 -1
- data/lib/losant_rest/experience_endpoint.rb +51 -1
- data/lib/losant_rest/experience_endpoints.rb +1 -1
- data/lib/losant_rest/experience_group.rb +1 -1
- data/lib/losant_rest/experience_groups.rb +1 -1
- data/lib/losant_rest/experience_slug.rb +1 -1
- data/lib/losant_rest/experience_slugs.rb +1 -1
- data/lib/losant_rest/experience_user.rb +1 -1
- data/lib/losant_rest/experience_users.rb +1 -1
- data/lib/losant_rest/experience_version.rb +1 -1
- data/lib/losant_rest/experience_versions.rb +1 -1
- data/lib/losant_rest/experience_view.rb +51 -1
- data/lib/losant_rest/experience_views.rb +1 -1
- data/lib/losant_rest/file.rb +1 -1
- data/lib/losant_rest/files.rb +1 -1
- data/lib/losant_rest/flow.rb +1 -1
- data/lib/losant_rest/flow_version.rb +1 -1
- data/lib/losant_rest/flow_versions.rb +1 -1
- data/lib/losant_rest/flows.rb +1 -1
- data/lib/losant_rest/integration.rb +1 -1
- data/lib/losant_rest/integrations.rb +1 -1
- data/lib/losant_rest/me.rb +1 -1
- data/lib/losant_rest/notebook.rb +1 -1
- data/lib/losant_rest/notebooks.rb +1 -1
- data/lib/losant_rest/org.rb +1 -1
- data/lib/losant_rest/org_invites.rb +1 -1
- data/lib/losant_rest/orgs.rb +1 -1
- data/lib/losant_rest/utils.rb +1 -1
- data/lib/losant_rest/version.rb +2 -2
- data/lib/losant_rest/webhook.rb +1 -1
- data/lib/losant_rest/webhooks.rb +1 -1
- data/schemas/advancedDeviceQuery.json +1018 -0
- data/schemas/advancedEventQuery.json +382 -13
- data/schemas/advancedQuery.json +37 -3
- data/schemas/application.json +10 -5
- data/schemas/applicationApiTokenPost.json +6 -0
- data/schemas/applicationCertificate.json +34 -0
- data/schemas/applicationCertificatePatch.json +34 -0
- data/schemas/applicationCertificatePost.json +34 -0
- data/schemas/applicationCertificates.json +34 -0
- data/schemas/{applicationCloneResult.json → applicationCreationByTemplateResult.json} +21 -8
- data/schemas/applicationExportPost.json +24 -0
- data/schemas/applicationExportResult.json +10 -0
- data/schemas/applicationKey.json +34 -0
- data/schemas/applicationKeyPatch.json +34 -0
- data/schemas/applicationKeyPost.json +34 -0
- data/schemas/applicationKeyPostResponse.json +34 -0
- data/schemas/applicationKeys.json +34 -0
- data/schemas/applicationPatch.json +10 -5
- data/schemas/applicationPost.json +14 -5
- data/schemas/applicationReadme.json +29 -0
- data/schemas/applicationReadmePatch.json +11 -0
- data/schemas/applicationTemplate.json +99 -0
- data/schemas/applicationTemplates.json +140 -0
- data/schemas/applications.json +10 -5
- data/schemas/authedDevice.json +34 -0
- data/schemas/dashboard.json +1228 -144
- data/schemas/dashboardPatch.json +1228 -144
- data/schemas/dashboardPost.json +1228 -144
- data/schemas/dashboards.json +1228 -144
- data/schemas/dataExport.json +11 -0
- data/schemas/dataTableRows.json +3 -0
- data/schemas/dataTableRowsExport.json +37 -3
- data/schemas/device.json +16 -3
- data/schemas/devicePatch.json +16 -3
- data/schemas/devicePost.json +16 -3
- data/schemas/deviceRecipe.json +16 -3
- data/schemas/deviceRecipePatch.json +16 -3
- data/schemas/deviceRecipePost.json +16 -3
- data/schemas/deviceRecipes.json +16 -3
- data/schemas/devices.json +19 -3
- data/schemas/devicesDataRemoved.json +12 -0
- data/schemas/devicesDeletePost.json +1034 -0
- data/schemas/devicesDeleted.json +12 -0
- data/schemas/devicesExportPost.json +1035 -0
- data/schemas/devicesPatch.json +1773 -7
- data/schemas/devicesRemoveDataPost.json +1056 -0
- data/schemas/devicesUpdated.json +18 -0
- data/schemas/events.json +1 -816
- data/schemas/eventsExport.json +382 -13
- data/schemas/experienceGroup.json +7 -0
- data/schemas/experienceGroupPatch.json +7 -0
- data/schemas/experienceGroupPost.json +7 -0
- data/schemas/experienceGroups.json +7 -0
- data/schemas/experienceLinkedResources.json +6659 -0
- data/schemas/flow.json +103 -1
- data/schemas/flowPatch.json +103 -1
- data/schemas/flowPost.json +103 -1
- data/schemas/flowVersion.json +206 -2
- data/schemas/flowVersionPost.json +103 -1
- data/schemas/flowVersions.json +206 -2
- data/schemas/flows.json +103 -1
- data/schemas/flowsImportPost.json +206 -2
- data/schemas/flowsImportResult.json +309 -3
- data/schemas/githubLogin.json +9 -0
- data/schemas/integration.json +4 -4
- data/schemas/integrationPatch.json +4 -4
- data/schemas/integrationPost.json +4 -4
- data/schemas/integrations.json +4 -4
- data/schemas/{applicationCloneEnqueued.json → jobEnqueuedResult.json} +0 -0
- data/schemas/me.json +3 -0
- data/schemas/multiDeviceCommand.json +1019 -0
- data/schemas/notebook.json +207 -35
- data/schemas/notebookDataExportOptions.json +4 -0
- data/schemas/notebookExecutionLogs.json +4 -0
- data/schemas/notebookExecutionOptions.json +4 -0
- data/schemas/notebookPatch.json +207 -35
- data/schemas/notebookPost.json +207 -35
- data/schemas/notebooks.json +207 -35
- data/schemas/org.json +8 -0
- data/schemas/orgPatch.json +9 -0
- data/schemas/orgs.json +8 -0
- data/schemas/samlResponse.json +21 -0
- data/schemas/ssoRequest.json +20 -0
- data/schemas/timeSeriesData.json +91 -12
- data/schemas/timeSeriesQuery.json +21 -12
- data/schemas/userCredentials.json +9 -0
- data/schemas/userPost.json +9 -0
- data/schemas/{validationCloneErrors.json → validationErrors.json} +9 -2
- metadata +24 -7
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/losant_rest/auth.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -157,5 +157,89 @@ module LosantRest
|
|
157
157
|
body: body)
|
158
158
|
end
|
159
159
|
|
160
|
+
# Authenticates a user via a SAML response.
|
161
|
+
#
|
162
|
+
# Authentication:
|
163
|
+
# No api access token is required to call this action.
|
164
|
+
#
|
165
|
+
# Parameters:
|
166
|
+
# * {hash} saml - Encoded SAML response from an IDP for a user. (https://api.losant.com/#/definitions/samlResponse)
|
167
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
168
|
+
# * {boolean} _actions - Return resource actions in response
|
169
|
+
# * {boolean} _links - Return resource link in response
|
170
|
+
# * {boolean} _embedded - Return embedded resources in response
|
171
|
+
#
|
172
|
+
# Responses:
|
173
|
+
# * 200 - Successful authentication. The included api access token has the scope 'all.User'. (https://api.losant.com/#/definitions/authedUser)
|
174
|
+
#
|
175
|
+
# Errors:
|
176
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
177
|
+
# * 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
|
178
|
+
def authenticate_user_saml(params = {})
|
179
|
+
params = Utils.symbolize_hash_keys(params)
|
180
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
181
|
+
headers = {}
|
182
|
+
body = nil
|
183
|
+
|
184
|
+
raise ArgumentError.new("saml is required") unless params.has_key?(:saml)
|
185
|
+
|
186
|
+
body = params[:saml] if params.has_key?(:saml)
|
187
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
188
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
189
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
190
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
191
|
+
|
192
|
+
path = "/auth/user/saml"
|
193
|
+
|
194
|
+
@client.request(
|
195
|
+
method: :post,
|
196
|
+
path: path,
|
197
|
+
query: query_params,
|
198
|
+
headers: headers,
|
199
|
+
body: body)
|
200
|
+
end
|
201
|
+
|
202
|
+
# Checks email domain for SSO configuration.
|
203
|
+
#
|
204
|
+
# Authentication:
|
205
|
+
# No api access token is required to call this action.
|
206
|
+
#
|
207
|
+
# Parameters:
|
208
|
+
# * {string} email - The email address associated with the user login
|
209
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
210
|
+
# * {boolean} _actions - Return resource actions in response
|
211
|
+
# * {boolean} _links - Return resource link in response
|
212
|
+
# * {boolean} _embedded - Return embedded resources in response
|
213
|
+
#
|
214
|
+
# Responses:
|
215
|
+
# * 200 - Successful finding SSO for domain. Returns SSO request URL and type. (https://api.losant.com/#/definitions/ssoRequest)
|
216
|
+
# * 204 - No domain associated with an SSO configuration
|
217
|
+
#
|
218
|
+
# Errors:
|
219
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
220
|
+
def sso_domain(params = {})
|
221
|
+
params = Utils.symbolize_hash_keys(params)
|
222
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
223
|
+
headers = {}
|
224
|
+
body = nil
|
225
|
+
|
226
|
+
raise ArgumentError.new("email is required") unless params.has_key?(:email)
|
227
|
+
|
228
|
+
query_params[:email] = params[:email] if params.has_key?(:email)
|
229
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
230
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
231
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
232
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
233
|
+
|
234
|
+
path = "/auth/ssoDomain"
|
235
|
+
|
236
|
+
@client.request(
|
237
|
+
method: :get,
|
238
|
+
path: path,
|
239
|
+
query: query_params,
|
240
|
+
headers: headers,
|
241
|
+
body: body)
|
242
|
+
end
|
243
|
+
|
160
244
|
end
|
161
245
|
end
|
data/lib/losant_rest/client.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -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.17.2
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -72,6 +72,10 @@ module LosantRest
|
|
72
72
|
@application_keys ||= ApplicationKeys.new(self)
|
73
73
|
end
|
74
74
|
|
75
|
+
def application_templates
|
76
|
+
@application_templates ||= ApplicationTemplates.new(self)
|
77
|
+
end
|
78
|
+
|
75
79
|
def applications
|
76
80
|
@applications ||= Applications.new(self)
|
77
81
|
end
|
@@ -274,7 +278,7 @@ module LosantRest
|
|
274
278
|
|
275
279
|
headers["Accept"] = "application/json"
|
276
280
|
headers["Content-Type"] = "application/json"
|
277
|
-
headers["Accept-Version"] = "^1.
|
281
|
+
headers["Accept-Version"] = "^1.17.2"
|
278
282
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
279
283
|
path = self.url + options.fetch(:path, "")
|
280
284
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/losant_rest/data.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/losant_rest/device.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -92,6 +92,7 @@ module LosantRest
|
|
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
94
|
# * {string} callbackUrl - Callback URL to call with export result
|
95
|
+
# * {string} includeBlobData - If set will export any blob attributes in base64 form, otherwise they will be downloadable links which will expire.
|
95
96
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
96
97
|
# * {boolean} _actions - Return resource actions in response
|
97
98
|
# * {boolean} _links - Return resource link in response
|
@@ -116,6 +117,7 @@ module LosantRest
|
|
116
117
|
query_params[:end] = params[:end] if params.has_key?(:end)
|
117
118
|
query_params[:email] = params[:email] if params.has_key?(:email)
|
118
119
|
query_params[:callbackUrl] = params[:callbackUrl] if params.has_key?(:callbackUrl)
|
120
|
+
query_params[:includeBlobData] = params[:includeBlobData] if params.has_key?(:includeBlobData)
|
119
121
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
120
122
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
121
123
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/losant_rest/devices.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -31,6 +31,54 @@ module LosantRest
|
|
31
31
|
@client = client
|
32
32
|
end
|
33
33
|
|
34
|
+
# Delete devices
|
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.Application, all.Organization, all.User, devices.*, or devices.delete.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} applicationId - ID associated with the application
|
44
|
+
# * {hash} options - Object containing device query and email (https://api.losant.com/#/definitions/devicesDeletePost)
|
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 - Object indicating number of devices deleted or failed (https://api.losant.com/#/definitions/devicesDeleted)
|
52
|
+
# * 202 - If a job was enqueued for the devices to be deleted (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
53
|
+
#
|
54
|
+
# Errors:
|
55
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
56
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
57
|
+
def delete(params = {})
|
58
|
+
params = Utils.symbolize_hash_keys(params)
|
59
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
60
|
+
headers = {}
|
61
|
+
body = nil
|
62
|
+
|
63
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
64
|
+
raise ArgumentError.new("options is required") unless params.has_key?(:options)
|
65
|
+
|
66
|
+
body = params[:options] if params.has_key?(:options)
|
67
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
68
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
69
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
70
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
71
|
+
|
72
|
+
path = "/applications/#{params[:applicationId]}/devices/delete"
|
73
|
+
|
74
|
+
@client.request(
|
75
|
+
method: :post,
|
76
|
+
path: path,
|
77
|
+
query: query_params,
|
78
|
+
headers: headers,
|
79
|
+
body: body)
|
80
|
+
end
|
81
|
+
|
34
82
|
# Creates an export of all device metadata
|
35
83
|
#
|
36
84
|
# Authentication:
|
@@ -43,6 +91,7 @@ module LosantRest
|
|
43
91
|
# * {string} applicationId - ID associated with the application
|
44
92
|
# * {string} email - Email address to send export to. Defaults to current user's email.
|
45
93
|
# * {string} callbackUrl - Callback URL to call with export result
|
94
|
+
# * {hash} options - Object containing device query and optionally email or callback (https://api.losant.com/#/definitions/devicesExportPost)
|
46
95
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
47
96
|
# * {boolean} _actions - Return resource actions in response
|
48
97
|
# * {boolean} _links - Return resource link in response
|
@@ -64,6 +113,7 @@ module LosantRest
|
|
64
113
|
|
65
114
|
query_params[:email] = params[:email] if params.has_key?(:email)
|
66
115
|
query_params[:callbackUrl] = params[:callbackUrl] if params.has_key?(:callbackUrl)
|
116
|
+
body = params[:options] if params.has_key?(:options)
|
67
117
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
68
118
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
69
119
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
@@ -99,6 +149,7 @@ module LosantRest
|
|
99
149
|
# * {hash} tagFilter - Array of tag pairs to filter by (https://api.losant.com/#/definitions/deviceTagFilter)
|
100
150
|
# * {string} excludeConnectionInfo - If set, do not return connection info
|
101
151
|
# * {string} parentId - Filter devices as children of a given system id
|
152
|
+
# * {hash} query - Device filter JSON object which overrides the filterField, filter, deviceClass, tagFilter, and parentId parameters. (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
102
153
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
103
154
|
# * {boolean} _actions - Return resource actions in response
|
104
155
|
# * {boolean} _links - Return resource link in response
|
@@ -128,6 +179,8 @@ module LosantRest
|
|
128
179
|
query_params[:tagFilter] = params[:tagFilter] if params.has_key?(:tagFilter)
|
129
180
|
query_params[:excludeConnectionInfo] = params[:excludeConnectionInfo] if params.has_key?(:excludeConnectionInfo)
|
130
181
|
query_params[:parentId] = params[:parentId] if params.has_key?(:parentId)
|
182
|
+
query_params[:query] = params[:query] if params.has_key?(:query)
|
183
|
+
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
131
184
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
132
185
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
133
186
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
@@ -153,14 +206,15 @@ module LosantRest
|
|
153
206
|
#
|
154
207
|
# Parameters:
|
155
208
|
# * {string} applicationId - ID associated with the application
|
156
|
-
# * {hash} patchInfo - Object containing device
|
209
|
+
# * {hash} patchInfo - Object containing device query or IDs and update operations (https://api.losant.com/#/definitions/devicesPatch)
|
157
210
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
158
211
|
# * {boolean} _actions - Return resource actions in response
|
159
212
|
# * {boolean} _links - Return resource link in response
|
160
213
|
# * {boolean} _embedded - Return embedded resources in response
|
161
214
|
#
|
162
215
|
# Responses:
|
163
|
-
# *
|
216
|
+
# * 200 - Object including an update log link and the number of devices updated, failed, and skipped (https://api.losant.com/#/definitions/devicesUpdated)
|
217
|
+
# * 202 - Successfully queued bulk update job (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
164
218
|
#
|
165
219
|
# Errors:
|
166
220
|
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
@@ -236,6 +290,54 @@ module LosantRest
|
|
236
290
|
body: body)
|
237
291
|
end
|
238
292
|
|
293
|
+
# Removes all device data for the specified time range. Defaults to all data.
|
294
|
+
#
|
295
|
+
# Authentication:
|
296
|
+
# The client must be configured with a valid api
|
297
|
+
# access token to call this action. The token
|
298
|
+
# must include at least one of the following scopes:
|
299
|
+
# all.Application, all.Organization, all.User, devices.*, or devices.removeData.
|
300
|
+
#
|
301
|
+
# Parameters:
|
302
|
+
# * {string} applicationId - ID associated with the application
|
303
|
+
# * {hash} options - Object defining the device data to delete and devices to delete from (https://api.losant.com/#/definitions/devicesRemoveDataPost)
|
304
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
305
|
+
# * {boolean} _actions - Return resource actions in response
|
306
|
+
# * {boolean} _links - Return resource link in response
|
307
|
+
# * {boolean} _embedded - Return embedded resources in response
|
308
|
+
#
|
309
|
+
# Responses:
|
310
|
+
# * 200 - Object indicating number of devices completed or skipped (https://api.losant.com/#/definitions/devicesDataRemoved)
|
311
|
+
# * 202 - If a job was enqueued for device data to be removed (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
312
|
+
#
|
313
|
+
# Errors:
|
314
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
315
|
+
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
316
|
+
def remove_data(params = {})
|
317
|
+
params = Utils.symbolize_hash_keys(params)
|
318
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
319
|
+
headers = {}
|
320
|
+
body = nil
|
321
|
+
|
322
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
323
|
+
raise ArgumentError.new("options is required") unless params.has_key?(:options)
|
324
|
+
|
325
|
+
body = params[:options] if params.has_key?(:options)
|
326
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
327
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
328
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
329
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
330
|
+
|
331
|
+
path = "/applications/#{params[:applicationId]}/devices/removeData"
|
332
|
+
|
333
|
+
@client.request(
|
334
|
+
method: :post,
|
335
|
+
path: path,
|
336
|
+
query: query_params,
|
337
|
+
headers: headers,
|
338
|
+
body: body)
|
339
|
+
end
|
340
|
+
|
239
341
|
# Send a command to multiple devices
|
240
342
|
#
|
241
343
|
# Authentication:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/losant_rest/error.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/losant_rest/event.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|