losant_rest 1.19.4 → 1.19.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +9 -9
- data/docs/_schemas.md +7090 -2334
- data/docs/experienceUsers.md +1 -0
- data/docs/instanceAuditLog.md +49 -0
- data/docs/instanceAuditLogs.md +53 -0
- data/examples/auth.rb +1 -1
- data/examples/list_devices.rb +1 -1
- data/lib/platform_rest/application.rb +1 -1
- data/lib/platform_rest/application_api_token.rb +1 -1
- data/lib/platform_rest/application_api_tokens.rb +1 -1
- data/lib/platform_rest/application_certificate.rb +1 -1
- data/lib/platform_rest/application_certificate_authorities.rb +1 -1
- data/lib/platform_rest/application_certificate_authority.rb +1 -1
- data/lib/platform_rest/application_certificates.rb +1 -1
- data/lib/platform_rest/application_dashboard.rb +1 -1
- data/lib/platform_rest/application_dashboards.rb +1 -1
- data/lib/platform_rest/application_key.rb +1 -1
- data/lib/platform_rest/application_keys.rb +1 -1
- data/lib/platform_rest/application_template.rb +1 -1
- data/lib/platform_rest/application_templates.rb +1 -1
- data/lib/platform_rest/applications.rb +1 -1
- data/lib/platform_rest/audit_log.rb +1 -1
- data/lib/platform_rest/audit_logs.rb +1 -1
- data/lib/platform_rest/auth.rb +1 -1
- data/lib/platform_rest/client.rb +11 -3
- data/lib/platform_rest/credential.rb +1 -1
- data/lib/platform_rest/credentials.rb +1 -1
- data/lib/platform_rest/dashboard.rb +1 -1
- data/lib/platform_rest/dashboards.rb +1 -1
- data/lib/platform_rest/data.rb +1 -1
- data/lib/platform_rest/data_table.rb +1 -1
- data/lib/platform_rest/data_table_row.rb +1 -1
- data/lib/platform_rest/data_table_rows.rb +1 -1
- data/lib/platform_rest/data_tables.rb +1 -1
- data/lib/platform_rest/device.rb +1 -1
- data/lib/platform_rest/device_recipe.rb +1 -1
- data/lib/platform_rest/device_recipes.rb +1 -1
- data/lib/platform_rest/devices.rb +1 -1
- data/lib/platform_rest/edge_deployment.rb +1 -1
- data/lib/platform_rest/edge_deployments.rb +1 -1
- data/lib/platform_rest/embedded_deployment.rb +1 -1
- data/lib/platform_rest/embedded_deployments.rb +1 -1
- data/lib/platform_rest/error.rb +1 -1
- data/lib/platform_rest/event.rb +1 -1
- data/lib/platform_rest/events.rb +1 -1
- data/lib/platform_rest/experience.rb +1 -1
- data/lib/platform_rest/experience_domain.rb +1 -1
- data/lib/platform_rest/experience_domains.rb +1 -1
- data/lib/platform_rest/experience_endpoint.rb +1 -1
- data/lib/platform_rest/experience_endpoints.rb +1 -1
- data/lib/platform_rest/experience_group.rb +1 -1
- data/lib/platform_rest/experience_groups.rb +1 -1
- data/lib/platform_rest/experience_slug.rb +1 -1
- data/lib/platform_rest/experience_slugs.rb +1 -1
- data/lib/platform_rest/experience_user.rb +1 -1
- data/lib/platform_rest/experience_users.rb +4 -1
- data/lib/platform_rest/experience_version.rb +1 -1
- data/lib/platform_rest/experience_versions.rb +1 -1
- data/lib/platform_rest/experience_view.rb +1 -1
- data/lib/platform_rest/experience_views.rb +1 -1
- data/lib/platform_rest/file.rb +1 -1
- data/lib/platform_rest/files.rb +1 -1
- data/lib/platform_rest/flow.rb +1 -1
- data/lib/platform_rest/flow_version.rb +1 -1
- data/lib/platform_rest/flow_versions.rb +1 -1
- data/lib/platform_rest/flows.rb +1 -1
- data/lib/platform_rest/instance.rb +1 -1
- data/lib/platform_rest/instance_api_token.rb +1 -1
- data/lib/platform_rest/instance_api_tokens.rb +1 -1
- data/lib/{losant_rest/application_template.rb → platform_rest/instance_audit_log.rb} +13 -11
- data/lib/{losant_rest/audit_logs.rb → platform_rest/instance_audit_logs.rb} +12 -12
- data/lib/platform_rest/instance_custom_node.rb +1 -1
- data/lib/platform_rest/instance_custom_nodes.rb +1 -1
- data/lib/platform_rest/instance_member.rb +1 -1
- data/lib/platform_rest/instance_members.rb +1 -1
- data/lib/platform_rest/instance_org.rb +1 -1
- data/lib/platform_rest/instance_org_invite.rb +1 -1
- data/lib/platform_rest/instance_org_invites.rb +1 -1
- data/lib/platform_rest/instance_org_member.rb +1 -1
- data/lib/platform_rest/instance_org_members.rb +1 -1
- data/lib/platform_rest/instance_orgs.rb +1 -1
- data/lib/platform_rest/instance_sandbox.rb +1 -1
- data/lib/platform_rest/instance_sandboxes.rb +1 -1
- data/lib/platform_rest/instances.rb +1 -1
- data/lib/platform_rest/integration.rb +1 -1
- data/lib/platform_rest/integrations.rb +1 -1
- data/lib/platform_rest/me.rb +1 -1
- data/lib/platform_rest/notebook.rb +1 -1
- data/lib/platform_rest/notebooks.rb +1 -1
- data/lib/platform_rest/org.rb +1 -1
- data/lib/platform_rest/org_invites.rb +1 -1
- data/lib/platform_rest/orgs.rb +1 -1
- data/lib/platform_rest/resource_job.rb +1 -1
- data/lib/platform_rest/resource_jobs.rb +1 -1
- data/lib/platform_rest/user_api_token.rb +1 -1
- data/lib/platform_rest/user_api_tokens.rb +1 -1
- data/lib/platform_rest/utils.rb +1 -1
- data/lib/{losant_rest → platform_rest}/version.rb +3 -3
- data/lib/platform_rest/webhook.rb +1 -1
- data/lib/platform_rest/webhooks.rb +1 -1
- data/lib/platform_rest.rb +3 -1
- data/losant_rest.gemspec +2 -2
- data/schemas/advancedExperienceUserQuery.json +1068 -0
- data/schemas/apiTokenPost.json +9 -1
- data/schemas/auditLog.json +3 -2
- data/schemas/auditLogFilter.json +3 -2
- data/schemas/auditLogs.json +3 -2
- data/schemas/credential.json +95 -1
- data/schemas/credentialLinkedResources.json +417 -19
- data/schemas/credentialPatch.json +107 -0
- data/schemas/credentialPost.json +129 -1
- data/schemas/credentials.json +95 -1
- data/schemas/deviceConnectionStatus.json +6 -2
- data/schemas/devicesHistoricalImportPost.json +25 -0
- data/schemas/experienceLinkedResources.json +343 -20
- data/schemas/experienceVersion.json +64 -0
- data/schemas/experienceVersionPatch.json +64 -0
- data/schemas/experienceVersionPost.json +64 -0
- data/schemas/experienceVersions.json +64 -0
- data/schemas/experienceView.json +1 -2
- data/schemas/experienceViewPatch.json +1 -2
- data/schemas/experienceViewPost.json +2 -4
- data/schemas/experienceViews.json +1 -2
- data/schemas/flow.json +114 -6
- data/schemas/flowPatch.json +114 -6
- data/schemas/flowPost.json +114 -6
- data/schemas/flowVersion.json +228 -12
- data/schemas/flowVersionPost.json +114 -6
- data/schemas/flowVersions.json +228 -12
- data/schemas/flows.json +114 -6
- data/schemas/flowsImportPost.json +228 -12
- data/schemas/flowsImportResult.json +342 -18
- data/schemas/githubLogin.json +9 -1
- data/schemas/instance.json +1 -4
- data/schemas/instanceAuditLog.json +94 -0
- data/schemas/instanceAuditLogFilter.json +106 -0
- data/schemas/instanceAuditLogs.json +41 -0
- data/schemas/instanceCustomNode.json +2 -1
- data/schemas/instanceCustomNodePatch.json +2 -7
- data/schemas/instanceCustomNodePost.json +2 -7
- data/schemas/instanceCustomNodes.json +2 -1
- data/schemas/instanceOrgMember.json +4 -1
- data/schemas/instances.json +1 -4
- data/schemas/integration.json +75 -1
- data/schemas/integrationPatch.json +73 -0
- data/schemas/integrationPost.json +75 -1
- data/schemas/integrations.json +75 -1
- data/schemas/mePatch.json +18 -0
- data/schemas/resourceJob.json +2 -1
- data/schemas/resourceJobExecutionLogs.json +2 -1
- data/schemas/resourceJobPost.json +2 -1
- data/schemas/resourceJobs.json +2 -1
- data/schemas/samlResponse.json +9 -1
- data/schemas/userCredentials.json +9 -1
- data/schemas/userPost.json +9 -1
- data/test/basic_test.rb +6 -6
- data/test/test_helper.rb +1 -1
- metadata +12 -94
- data/lib/losant_rest/application.rb +0 -932
- data/lib/losant_rest/application_api_token.rb +0 -176
- data/lib/losant_rest/application_api_tokens.rb +0 -136
- data/lib/losant_rest/application_certificate.rb +0 -176
- data/lib/losant_rest/application_certificate_authorities.rb +0 -138
- data/lib/losant_rest/application_certificate_authority.rb +0 -176
- data/lib/losant_rest/application_certificates.rb +0 -138
- data/lib/losant_rest/application_dashboard.rb +0 -225
- data/lib/losant_rest/application_dashboards.rb +0 -138
- data/lib/losant_rest/application_key.rb +0 -176
- data/lib/losant_rest/application_keys.rb +0 -141
- data/lib/losant_rest/application_templates.rb +0 -176
- data/lib/losant_rest/applications.rb +0 -142
- data/lib/losant_rest/audit_log.rb +0 -81
- data/lib/losant_rest/auth.rb +0 -245
- data/lib/losant_rest/client.rb +0 -410
- data/lib/losant_rest/credential.rb +0 -224
- data/lib/losant_rest/credentials.rb +0 -138
- data/lib/losant_rest/dashboard.rb +0 -268
- data/lib/losant_rest/dashboards.rb +0 -136
- data/lib/losant_rest/data.rb +0 -176
- data/lib/losant_rest/data_table.rb +0 -274
- data/lib/losant_rest/data_table_row.rb +0 -182
- data/lib/losant_rest/data_table_rows.rb +0 -343
- data/lib/losant_rest/data_tables.rb +0 -138
- data/lib/losant_rest/device.rb +0 -749
- data/lib/losant_rest/device_recipe.rb +0 -234
- data/lib/losant_rest/device_recipes.rb +0 -146
- data/lib/losant_rest/devices.rb +0 -707
- data/lib/losant_rest/edge_deployment.rb +0 -81
- data/lib/losant_rest/edge_deployments.rb +0 -236
- data/lib/losant_rest/embedded_deployment.rb +0 -81
- data/lib/losant_rest/embedded_deployments.rb +0 -280
- data/lib/losant_rest/error.rb +0 -34
- data/lib/losant_rest/event.rb +0 -176
- data/lib/losant_rest/events.rb +0 -341
- data/lib/losant_rest/experience.rb +0 -142
- data/lib/losant_rest/experience_domain.rb +0 -176
- data/lib/losant_rest/experience_domains.rb +0 -126
- data/lib/losant_rest/experience_endpoint.rb +0 -230
- data/lib/losant_rest/experience_endpoints.rb +0 -200
- data/lib/losant_rest/experience_group.rb +0 -180
- data/lib/losant_rest/experience_groups.rb +0 -141
- data/lib/losant_rest/experience_slug.rb +0 -176
- data/lib/losant_rest/experience_slugs.rb +0 -126
- data/lib/losant_rest/experience_user.rb +0 -176
- data/lib/losant_rest/experience_users.rb +0 -142
- data/lib/losant_rest/experience_version.rb +0 -176
- data/lib/losant_rest/experience_versions.rb +0 -138
- data/lib/losant_rest/experience_view.rb +0 -228
- data/lib/losant_rest/experience_views.rb +0 -142
- data/lib/losant_rest/file.rb +0 -226
- data/lib/losant_rest/files.rb +0 -144
- data/lib/losant_rest/flow.rb +0 -580
- data/lib/losant_rest/flow_version.rb +0 -352
- data/lib/losant_rest/flow_versions.rb +0 -201
- data/lib/losant_rest/flows.rb +0 -310
- data/lib/losant_rest/instance.rb +0 -377
- data/lib/losant_rest/instance_api_token.rb +0 -176
- data/lib/losant_rest/instance_api_tokens.rb +0 -136
- data/lib/losant_rest/instance_custom_node.rb +0 -282
- data/lib/losant_rest/instance_custom_nodes.rb +0 -136
- data/lib/losant_rest/instance_member.rb +0 -176
- data/lib/losant_rest/instance_members.rb +0 -134
- data/lib/losant_rest/instance_org.rb +0 -336
- data/lib/losant_rest/instance_org_invite.rb +0 -182
- data/lib/losant_rest/instance_org_invites.rb +0 -138
- data/lib/losant_rest/instance_org_member.rb +0 -182
- data/lib/losant_rest/instance_org_members.rb +0 -138
- data/lib/losant_rest/instance_orgs.rb +0 -139
- data/lib/losant_rest/instance_sandbox.rb +0 -181
- data/lib/losant_rest/instance_sandboxes.rb +0 -98
- data/lib/losant_rest/instances.rb +0 -88
- data/lib/losant_rest/integration.rb +0 -178
- data/lib/losant_rest/integrations.rb +0 -138
- data/lib/losant_rest/me.rb +0 -790
- data/lib/losant_rest/notebook.rb +0 -423
- data/lib/losant_rest/notebooks.rb +0 -138
- data/lib/losant_rest/org.rb +0 -663
- data/lib/losant_rest/org_invites.rb +0 -124
- data/lib/losant_rest/orgs.rb +0 -140
- data/lib/losant_rest/resource_job.rb +0 -326
- data/lib/losant_rest/resource_jobs.rb +0 -138
- data/lib/losant_rest/user_api_token.rb +0 -170
- data/lib/losant_rest/user_api_tokens.rb +0 -132
- data/lib/losant_rest/utils.rb +0 -44
- data/lib/losant_rest/webhook.rb +0 -178
- data/lib/losant_rest/webhooks.rb +0 -138
- data/lib/losant_rest.rb +0 -129
data/lib/losant_rest/device.rb
DELETED
@@ -1,749 +0,0 @@
|
|
1
|
-
# The MIT License (MIT)
|
2
|
-
#
|
3
|
-
# Copyright (c) 2023 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
|
-
require "json"
|
24
|
-
|
25
|
-
module LosantRest
|
26
|
-
|
27
|
-
# Class containing all the actions for the Device Resource
|
28
|
-
class Device
|
29
|
-
|
30
|
-
def initialize(client)
|
31
|
-
@client = client
|
32
|
-
end
|
33
|
-
|
34
|
-
# Deletes a device
|
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, device.*, or device.delete.
|
41
|
-
#
|
42
|
-
# Parameters:
|
43
|
-
# * {string} applicationId - ID associated with the application
|
44
|
-
# * {string} deviceId - ID associated with the device
|
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 - If device was successfully deleted (https://api.losant.com/#/definitions/success)
|
52
|
-
#
|
53
|
-
# Errors:
|
54
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
55
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
56
|
-
def delete(params = {})
|
57
|
-
params = Utils.symbolize_hash_keys(params)
|
58
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
59
|
-
headers = {}
|
60
|
-
body = nil
|
61
|
-
|
62
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
63
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
64
|
-
|
65
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
66
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
67
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
68
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
69
|
-
|
70
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}"
|
71
|
-
|
72
|
-
@client.request(
|
73
|
-
method: :delete,
|
74
|
-
path: path,
|
75
|
-
query: query_params,
|
76
|
-
headers: headers,
|
77
|
-
body: body)
|
78
|
-
end
|
79
|
-
|
80
|
-
# Creates a device data export. Defaults to all data.
|
81
|
-
#
|
82
|
-
# Authentication:
|
83
|
-
# The client must be configured with a valid api
|
84
|
-
# access token to call this action. The token
|
85
|
-
# must include at least one of the following scopes:
|
86
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.export.
|
87
|
-
#
|
88
|
-
# Parameters:
|
89
|
-
# * {string} applicationId - ID associated with the application
|
90
|
-
# * {string} deviceId - ID associated with the device
|
91
|
-
# * {string} start - Start time of export (ms since epoch - 0 means now, negative is relative to now)
|
92
|
-
# * {string} end - End time of export (ms since epoch - 0 means now, negative is relative to now)
|
93
|
-
# * {string} email - Email address to send export to. Defaults to current user's email.
|
94
|
-
# * {string} callbackUrl - Callback URL to call with export result
|
95
|
-
# * {string} includeBlobData - If set will export any blob attributes in base64 form, otherwise they will be downloadable links which will expire.
|
96
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
97
|
-
# * {boolean} _actions - Return resource actions in response
|
98
|
-
# * {boolean} _links - Return resource link in response
|
99
|
-
# * {boolean} _embedded - Return embedded resources in response
|
100
|
-
#
|
101
|
-
# Responses:
|
102
|
-
# * 202 - If generation of export was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
103
|
-
#
|
104
|
-
# Errors:
|
105
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
106
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
107
|
-
def export(params = {})
|
108
|
-
params = Utils.symbolize_hash_keys(params)
|
109
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
110
|
-
headers = {}
|
111
|
-
body = nil
|
112
|
-
|
113
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
114
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
115
|
-
|
116
|
-
query_params[:start] = params[:start] if params.has_key?(:start)
|
117
|
-
query_params[:end] = params[:end] if params.has_key?(:end)
|
118
|
-
query_params[:email] = params[:email] if params.has_key?(:email)
|
119
|
-
query_params[:callbackUrl] = params[:callbackUrl] if params.has_key?(:callbackUrl)
|
120
|
-
query_params[:includeBlobData] = params[:includeBlobData] if params.has_key?(:includeBlobData)
|
121
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
122
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
123
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
124
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
125
|
-
|
126
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/export"
|
127
|
-
|
128
|
-
@client.request(
|
129
|
-
method: :post,
|
130
|
-
path: path,
|
131
|
-
query: query_params,
|
132
|
-
headers: headers,
|
133
|
-
body: body)
|
134
|
-
end
|
135
|
-
|
136
|
-
# Retrieves information on a device
|
137
|
-
#
|
138
|
-
# Authentication:
|
139
|
-
# The client must be configured with a valid api
|
140
|
-
# access token to call this action. The token
|
141
|
-
# must include at least one of the following scopes:
|
142
|
-
# all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.get.
|
143
|
-
#
|
144
|
-
# Parameters:
|
145
|
-
# * {string} applicationId - ID associated with the application
|
146
|
-
# * {string} deviceId - ID associated with the device
|
147
|
-
# * {string} excludeConnectionInfo - If set, do not return connection info
|
148
|
-
# * {string} tagsAsObject - Return tags as an object map instead of an array
|
149
|
-
# * {string} attributesAsObject - Return attributes as an object map instead of an array
|
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
|
-
# * 200 - Device information (https://api.losant.com/#/definitions/device)
|
157
|
-
#
|
158
|
-
# Errors:
|
159
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
160
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
161
|
-
def get(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("deviceId is required") unless params.has_key?(:deviceId)
|
169
|
-
|
170
|
-
query_params[:excludeConnectionInfo] = params[:excludeConnectionInfo] if params.has_key?(:excludeConnectionInfo)
|
171
|
-
query_params[:tagsAsObject] = params[:tagsAsObject] if params.has_key?(:tagsAsObject)
|
172
|
-
query_params[:attributesAsObject] = params[:attributesAsObject] if params.has_key?(:attributesAsObject)
|
173
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
174
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
175
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
176
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
177
|
-
|
178
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}"
|
179
|
-
|
180
|
-
@client.request(
|
181
|
-
method: :get,
|
182
|
-
path: path,
|
183
|
-
query: query_params,
|
184
|
-
headers: headers,
|
185
|
-
body: body)
|
186
|
-
end
|
187
|
-
|
188
|
-
# Retrieve the last known commands(s) sent to the device
|
189
|
-
#
|
190
|
-
# Authentication:
|
191
|
-
# The client must be configured with a valid api
|
192
|
-
# access token to call this action. The token
|
193
|
-
# must include at least one of the following scopes:
|
194
|
-
# all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.getCommand.
|
195
|
-
#
|
196
|
-
# Parameters:
|
197
|
-
# * {string} applicationId - ID associated with the application
|
198
|
-
# * {string} deviceId - ID associated with the device
|
199
|
-
# * {string} limit - Maximum number of command entries to return
|
200
|
-
# * {string} since - Look for command entries since this time (ms since epoch)
|
201
|
-
# * {string} sortDirection - Direction to sort the command entries (by time). Accepted values are: asc, desc
|
202
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
203
|
-
# * {boolean} _actions - Return resource actions in response
|
204
|
-
# * {boolean} _links - Return resource link in response
|
205
|
-
# * {boolean} _embedded - Return embedded resources in response
|
206
|
-
#
|
207
|
-
# Responses:
|
208
|
-
# * 200 - Recent device commands (https://api.losant.com/#/definitions/deviceCommands)
|
209
|
-
#
|
210
|
-
# Errors:
|
211
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
212
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
213
|
-
def get_command(params = {})
|
214
|
-
params = Utils.symbolize_hash_keys(params)
|
215
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
216
|
-
headers = {}
|
217
|
-
body = nil
|
218
|
-
|
219
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
220
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
221
|
-
|
222
|
-
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
223
|
-
query_params[:since] = params[:since] if params.has_key?(:since)
|
224
|
-
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
225
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
226
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
227
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
228
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
229
|
-
|
230
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/command"
|
231
|
-
|
232
|
-
@client.request(
|
233
|
-
method: :get,
|
234
|
-
path: path,
|
235
|
-
query: query_params,
|
236
|
-
headers: headers,
|
237
|
-
body: body)
|
238
|
-
end
|
239
|
-
|
240
|
-
# Retrieve the composite last complete state of the device
|
241
|
-
#
|
242
|
-
# Authentication:
|
243
|
-
# The client must be configured with a valid api
|
244
|
-
# access token to call this action. The token
|
245
|
-
# must include at least one of the following scopes:
|
246
|
-
# all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.getCompositeState.
|
247
|
-
#
|
248
|
-
# Parameters:
|
249
|
-
# * {string} applicationId - ID associated with the application
|
250
|
-
# * {string} deviceId - ID associated with the device
|
251
|
-
# * {string} start - Start of time range to look at to build composite state
|
252
|
-
# * {string} end - End of time range to look at to build composite state
|
253
|
-
# * {string} attributes - Comma-separated list of attributes to include. When not provided, returns all attributes.
|
254
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
255
|
-
# * {boolean} _actions - Return resource actions in response
|
256
|
-
# * {boolean} _links - Return resource link in response
|
257
|
-
# * {boolean} _embedded - Return embedded resources in response
|
258
|
-
#
|
259
|
-
# Responses:
|
260
|
-
# * 200 - Composite last state of the device (https://api.losant.com/#/definitions/compositeDeviceState)
|
261
|
-
#
|
262
|
-
# Errors:
|
263
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
264
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
265
|
-
def get_composite_state(params = {})
|
266
|
-
params = Utils.symbolize_hash_keys(params)
|
267
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
268
|
-
headers = {}
|
269
|
-
body = nil
|
270
|
-
|
271
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
272
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
273
|
-
|
274
|
-
query_params[:start] = params[:start] if params.has_key?(:start)
|
275
|
-
query_params[:end] = params[:end] if params.has_key?(:end)
|
276
|
-
query_params[:attributes] = params[:attributes] if params.has_key?(:attributes)
|
277
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
278
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
279
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
280
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
281
|
-
|
282
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/compositeState"
|
283
|
-
|
284
|
-
@client.request(
|
285
|
-
method: :get,
|
286
|
-
path: path,
|
287
|
-
query: query_params,
|
288
|
-
headers: headers,
|
289
|
-
body: body)
|
290
|
-
end
|
291
|
-
|
292
|
-
# Retrieve the recent log entries about the device
|
293
|
-
#
|
294
|
-
# Authentication:
|
295
|
-
# The client must be configured with a valid api
|
296
|
-
# access token to call this action. The token
|
297
|
-
# must include at least one of the following scopes:
|
298
|
-
# all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.getLogEntries.
|
299
|
-
#
|
300
|
-
# Parameters:
|
301
|
-
# * {string} applicationId - ID associated with the application
|
302
|
-
# * {string} deviceId - ID associated with the device
|
303
|
-
# * {string} limit - Maximum number of log entries to return
|
304
|
-
# * {string} since - Look for log entries since this time (ms since epoch)
|
305
|
-
# * {string} sortDirection - Direction to sort the log entries (by time). Accepted values are: asc, desc
|
306
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
307
|
-
# * {boolean} _actions - Return resource actions in response
|
308
|
-
# * {boolean} _links - Return resource link in response
|
309
|
-
# * {boolean} _embedded - Return embedded resources in response
|
310
|
-
#
|
311
|
-
# Responses:
|
312
|
-
# * 200 - Recent log entries (https://api.losant.com/#/definitions/deviceLog)
|
313
|
-
#
|
314
|
-
# Errors:
|
315
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
316
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
317
|
-
def get_log_entries(params = {})
|
318
|
-
params = Utils.symbolize_hash_keys(params)
|
319
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
320
|
-
headers = {}
|
321
|
-
body = nil
|
322
|
-
|
323
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
324
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
325
|
-
|
326
|
-
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
327
|
-
query_params[:since] = params[:since] if params.has_key?(:since)
|
328
|
-
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
329
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
330
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
331
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
332
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
333
|
-
|
334
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/logs"
|
335
|
-
|
336
|
-
@client.request(
|
337
|
-
method: :get,
|
338
|
-
path: path,
|
339
|
-
query: query_params,
|
340
|
-
headers: headers,
|
341
|
-
body: body)
|
342
|
-
end
|
343
|
-
|
344
|
-
# Retrieve the last known state(s) of the device
|
345
|
-
#
|
346
|
-
# Authentication:
|
347
|
-
# The client must be configured with a valid api
|
348
|
-
# access token to call this action. The token
|
349
|
-
# must include at least one of the following scopes:
|
350
|
-
# all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.getState.
|
351
|
-
#
|
352
|
-
# Parameters:
|
353
|
-
# * {string} applicationId - ID associated with the application
|
354
|
-
# * {string} deviceId - ID associated with the device
|
355
|
-
# * {string} limit - Maximum number of state entries to return
|
356
|
-
# * {string} since - Look for state entries since this time (ms since epoch)
|
357
|
-
# * {string} sortDirection - Direction to sort the state entries (by time). Accepted values are: asc, desc
|
358
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
359
|
-
# * {boolean} _actions - Return resource actions in response
|
360
|
-
# * {boolean} _links - Return resource link in response
|
361
|
-
# * {boolean} _embedded - Return embedded resources in response
|
362
|
-
#
|
363
|
-
# Responses:
|
364
|
-
# * 200 - Recent device states (https://api.losant.com/#/definitions/deviceStates)
|
365
|
-
#
|
366
|
-
# Errors:
|
367
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
368
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
369
|
-
def get_state(params = {})
|
370
|
-
params = Utils.symbolize_hash_keys(params)
|
371
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
372
|
-
headers = {}
|
373
|
-
body = nil
|
374
|
-
|
375
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
376
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
377
|
-
|
378
|
-
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
379
|
-
query_params[:since] = params[:since] if params.has_key?(:since)
|
380
|
-
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
381
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
382
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
383
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
384
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
385
|
-
|
386
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/state"
|
387
|
-
|
388
|
-
@client.request(
|
389
|
-
method: :get,
|
390
|
-
path: path,
|
391
|
-
query: query_params,
|
392
|
-
headers: headers,
|
393
|
-
body: body)
|
394
|
-
end
|
395
|
-
|
396
|
-
# Updates information about a device
|
397
|
-
#
|
398
|
-
# Authentication:
|
399
|
-
# The client must be configured with a valid api
|
400
|
-
# access token to call this action. The token
|
401
|
-
# must include at least one of the following scopes:
|
402
|
-
# all.Application, all.Organization, all.User, device.*, or device.patch.
|
403
|
-
#
|
404
|
-
# Parameters:
|
405
|
-
# * {string} applicationId - ID associated with the application
|
406
|
-
# * {string} deviceId - ID associated with the device
|
407
|
-
# * {hash} device - Object containing new properties of the device (https://api.losant.com/#/definitions/devicePatch)
|
408
|
-
# * {string} tagsAsObject - Return tags as an object map instead of an array
|
409
|
-
# * {string} attributesAsObject - Return attributes as an object map instead of an array
|
410
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
411
|
-
# * {boolean} _actions - Return resource actions in response
|
412
|
-
# * {boolean} _links - Return resource link in response
|
413
|
-
# * {boolean} _embedded - Return embedded resources in response
|
414
|
-
#
|
415
|
-
# Responses:
|
416
|
-
# * 200 - Updated device information (https://api.losant.com/#/definitions/device)
|
417
|
-
#
|
418
|
-
# Errors:
|
419
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
420
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
421
|
-
def patch(params = {})
|
422
|
-
params = Utils.symbolize_hash_keys(params)
|
423
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
424
|
-
headers = {}
|
425
|
-
body = nil
|
426
|
-
|
427
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
428
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
429
|
-
raise ArgumentError.new("device is required") unless params.has_key?(:device)
|
430
|
-
|
431
|
-
body = params[:device] if params.has_key?(:device)
|
432
|
-
query_params[:tagsAsObject] = params[:tagsAsObject] if params.has_key?(:tagsAsObject)
|
433
|
-
query_params[:attributesAsObject] = params[:attributesAsObject] if params.has_key?(:attributesAsObject)
|
434
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
435
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
436
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
437
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
438
|
-
|
439
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}"
|
440
|
-
|
441
|
-
@client.request(
|
442
|
-
method: :patch,
|
443
|
-
path: path,
|
444
|
-
query: query_params,
|
445
|
-
headers: headers,
|
446
|
-
body: body)
|
447
|
-
end
|
448
|
-
|
449
|
-
# Returns payload counts for the time range specified for this device
|
450
|
-
#
|
451
|
-
# Authentication:
|
452
|
-
# The client must be configured with a valid api
|
453
|
-
# access token to call this action. The token
|
454
|
-
# must include at least one of the following scopes:
|
455
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.payloadCounts.
|
456
|
-
#
|
457
|
-
# Parameters:
|
458
|
-
# * {string} applicationId - ID associated with the application
|
459
|
-
# * {string} deviceId - ID associated with the device
|
460
|
-
# * {string} start - Start of range for payload count query (ms since epoch)
|
461
|
-
# * {string} end - End of range for payload count query (ms since epoch)
|
462
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
463
|
-
# * {boolean} _actions - Return resource actions in response
|
464
|
-
# * {boolean} _links - Return resource link in response
|
465
|
-
# * {boolean} _embedded - Return embedded resources in response
|
466
|
-
#
|
467
|
-
# Responses:
|
468
|
-
# * 200 - Payload counts, by type (https://api.losant.com/#/definitions/devicePayloadCounts)
|
469
|
-
#
|
470
|
-
# Errors:
|
471
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
472
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
473
|
-
def payload_counts(params = {})
|
474
|
-
params = Utils.symbolize_hash_keys(params)
|
475
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
476
|
-
headers = {}
|
477
|
-
body = nil
|
478
|
-
|
479
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
480
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
481
|
-
|
482
|
-
query_params[:start] = params[:start] if params.has_key?(:start)
|
483
|
-
query_params[:end] = params[:end] if params.has_key?(:end)
|
484
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
485
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
486
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
487
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
488
|
-
|
489
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/payloadCounts"
|
490
|
-
|
491
|
-
@client.request(
|
492
|
-
method: :get,
|
493
|
-
path: path,
|
494
|
-
query: query_params,
|
495
|
-
headers: headers,
|
496
|
-
body: body)
|
497
|
-
end
|
498
|
-
|
499
|
-
# Returns payload counts per resolution in the time range specified for this device
|
500
|
-
#
|
501
|
-
# Authentication:
|
502
|
-
# The client must be configured with a valid api
|
503
|
-
# access token to call this action. The token
|
504
|
-
# must include at least one of the following scopes:
|
505
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.payloadCountsBreakdown.
|
506
|
-
#
|
507
|
-
# Parameters:
|
508
|
-
# * {string} applicationId - ID associated with the application
|
509
|
-
# * {string} deviceId - ID associated with the device
|
510
|
-
# * {string} start - Start of range for payload count query (ms since epoch)
|
511
|
-
# * {string} end - End of range for payload count query (ms since epoch)
|
512
|
-
# * {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
|
513
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
514
|
-
# * {boolean} _actions - Return resource actions in response
|
515
|
-
# * {boolean} _links - Return resource link in response
|
516
|
-
# * {boolean} _embedded - Return embedded resources in response
|
517
|
-
#
|
518
|
-
# Responses:
|
519
|
-
# * 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
|
520
|
-
#
|
521
|
-
# Errors:
|
522
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
523
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
524
|
-
def payload_counts_breakdown(params = {})
|
525
|
-
params = Utils.symbolize_hash_keys(params)
|
526
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
527
|
-
headers = {}
|
528
|
-
body = nil
|
529
|
-
|
530
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
531
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
532
|
-
|
533
|
-
query_params[:start] = params[:start] if params.has_key?(:start)
|
534
|
-
query_params[:end] = params[:end] if params.has_key?(:end)
|
535
|
-
query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
|
536
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
537
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
538
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
539
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
540
|
-
|
541
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/payloadCountsBreakdown"
|
542
|
-
|
543
|
-
@client.request(
|
544
|
-
method: :get,
|
545
|
-
path: path,
|
546
|
-
query: query_params,
|
547
|
-
headers: headers,
|
548
|
-
body: body)
|
549
|
-
end
|
550
|
-
|
551
|
-
# Removes all device data for the specified time range. Defaults to all data.
|
552
|
-
#
|
553
|
-
# Authentication:
|
554
|
-
# The client must be configured with a valid api
|
555
|
-
# access token to call this action. The token
|
556
|
-
# must include at least one of the following scopes:
|
557
|
-
# all.Application, all.Organization, all.User, device.*, or device.removeData.
|
558
|
-
#
|
559
|
-
# Parameters:
|
560
|
-
# * {string} applicationId - ID associated with the application
|
561
|
-
# * {string} deviceId - ID associated with the device
|
562
|
-
# * {string} start - Start time of export (ms since epoch - 0 means now, negative is relative to now)
|
563
|
-
# * {string} end - End time of export (ms since epoch - 0 means now, negative is relative to now)
|
564
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
565
|
-
# * {boolean} _actions - Return resource actions in response
|
566
|
-
# * {boolean} _links - Return resource link in response
|
567
|
-
# * {boolean} _embedded - Return embedded resources in response
|
568
|
-
#
|
569
|
-
# Responses:
|
570
|
-
# * 202 - If data removal was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
571
|
-
#
|
572
|
-
# Errors:
|
573
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
574
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
575
|
-
def remove_data(params = {})
|
576
|
-
params = Utils.symbolize_hash_keys(params)
|
577
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
578
|
-
headers = {}
|
579
|
-
body = nil
|
580
|
-
|
581
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
582
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
583
|
-
|
584
|
-
query_params[:start] = params[:start] if params.has_key?(:start)
|
585
|
-
query_params[:end] = params[:end] if params.has_key?(:end)
|
586
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
587
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
588
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
589
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
590
|
-
|
591
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/data"
|
592
|
-
|
593
|
-
@client.request(
|
594
|
-
method: :delete,
|
595
|
-
path: path,
|
596
|
-
query: query_params,
|
597
|
-
headers: headers,
|
598
|
-
body: body)
|
599
|
-
end
|
600
|
-
|
601
|
-
# Send a command to a device
|
602
|
-
#
|
603
|
-
# Authentication:
|
604
|
-
# The client must be configured with a valid api
|
605
|
-
# access token to call this action. The token
|
606
|
-
# must include at least one of the following scopes:
|
607
|
-
# all.Application, all.Device, all.Organization, all.User, device.*, or device.sendCommand.
|
608
|
-
#
|
609
|
-
# Parameters:
|
610
|
-
# * {string} applicationId - ID associated with the application
|
611
|
-
# * {string} deviceId - ID associated with the device
|
612
|
-
# * {hash} deviceCommand - Command to send to the device (https://api.losant.com/#/definitions/deviceCommand)
|
613
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
614
|
-
# * {boolean} _actions - Return resource actions in response
|
615
|
-
# * {boolean} _links - Return resource link in response
|
616
|
-
# * {boolean} _embedded - Return embedded resources in response
|
617
|
-
#
|
618
|
-
# Responses:
|
619
|
-
# * 200 - If command was successfully sent (https://api.losant.com/#/definitions/success)
|
620
|
-
#
|
621
|
-
# Errors:
|
622
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
623
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
624
|
-
def send_command(params = {})
|
625
|
-
params = Utils.symbolize_hash_keys(params)
|
626
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
627
|
-
headers = {}
|
628
|
-
body = nil
|
629
|
-
|
630
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
631
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
632
|
-
raise ArgumentError.new("deviceCommand is required") unless params.has_key?(:deviceCommand)
|
633
|
-
|
634
|
-
body = params[:deviceCommand] if params.has_key?(:deviceCommand)
|
635
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
636
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
637
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
638
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
639
|
-
|
640
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/command"
|
641
|
-
|
642
|
-
@client.request(
|
643
|
-
method: :post,
|
644
|
-
path: path,
|
645
|
-
query: query_params,
|
646
|
-
headers: headers,
|
647
|
-
body: body)
|
648
|
-
end
|
649
|
-
|
650
|
-
# Send the current state of the device
|
651
|
-
#
|
652
|
-
# Authentication:
|
653
|
-
# The client must be configured with a valid api
|
654
|
-
# access token to call this action. The token
|
655
|
-
# must include at least one of the following scopes:
|
656
|
-
# all.Application, all.Device, all.Organization, all.User, device.*, or device.sendState.
|
657
|
-
#
|
658
|
-
# Parameters:
|
659
|
-
# * {string} applicationId - ID associated with the application
|
660
|
-
# * {string} deviceId - ID associated with the device
|
661
|
-
# * {hash} deviceState - A single device state object, or an array of device state objects (https://api.losant.com/#/definitions/deviceStateOrStates)
|
662
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
663
|
-
# * {boolean} _actions - Return resource actions in response
|
664
|
-
# * {boolean} _links - Return resource link in response
|
665
|
-
# * {boolean} _embedded - Return embedded resources in response
|
666
|
-
#
|
667
|
-
# Responses:
|
668
|
-
# * 200 - If state was successfully received (https://api.losant.com/#/definitions/success)
|
669
|
-
#
|
670
|
-
# Errors:
|
671
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
672
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
673
|
-
def send_state(params = {})
|
674
|
-
params = Utils.symbolize_hash_keys(params)
|
675
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
676
|
-
headers = {}
|
677
|
-
body = nil
|
678
|
-
|
679
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
680
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
681
|
-
raise ArgumentError.new("deviceState is required") unless params.has_key?(:deviceState)
|
682
|
-
|
683
|
-
body = params[:deviceState] if params.has_key?(:deviceState)
|
684
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
685
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
686
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
687
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
688
|
-
|
689
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/state"
|
690
|
-
|
691
|
-
@client.request(
|
692
|
-
method: :post,
|
693
|
-
path: path,
|
694
|
-
query: query_params,
|
695
|
-
headers: headers,
|
696
|
-
body: body)
|
697
|
-
end
|
698
|
-
|
699
|
-
# Set the current connection status of the device
|
700
|
-
#
|
701
|
-
# Authentication:
|
702
|
-
# The client must be configured with a valid api
|
703
|
-
# access token to call this action. The token
|
704
|
-
# must include at least one of the following scopes:
|
705
|
-
# all.Application, all.Device, all.Organization, all.User, device.*, or device.setConnectionStatus.
|
706
|
-
#
|
707
|
-
# Parameters:
|
708
|
-
# * {string} applicationId - ID associated with the application
|
709
|
-
# * {string} deviceId - ID associated with the device
|
710
|
-
# * {hash} connectionStatus - The current connection status of the device (https://api.losant.com/#/definitions/deviceConnectionStatus)
|
711
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
712
|
-
# * {boolean} _actions - Return resource actions in response
|
713
|
-
# * {boolean} _links - Return resource link in response
|
714
|
-
# * {boolean} _embedded - Return embedded resources in response
|
715
|
-
#
|
716
|
-
# Responses:
|
717
|
-
# * 200 - If connection status was successfully applied (https://api.losant.com/#/definitions/success)
|
718
|
-
#
|
719
|
-
# Errors:
|
720
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
721
|
-
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
722
|
-
def set_connection_status(params = {})
|
723
|
-
params = Utils.symbolize_hash_keys(params)
|
724
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
725
|
-
headers = {}
|
726
|
-
body = nil
|
727
|
-
|
728
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
729
|
-
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
730
|
-
raise ArgumentError.new("connectionStatus is required") unless params.has_key?(:connectionStatus)
|
731
|
-
|
732
|
-
body = params[:connectionStatus] if params.has_key?(:connectionStatus)
|
733
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
734
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
735
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
736
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
737
|
-
|
738
|
-
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/setConnectionStatus"
|
739
|
-
|
740
|
-
@client.request(
|
741
|
-
method: :post,
|
742
|
-
path: path,
|
743
|
-
query: query_params,
|
744
|
-
headers: headers,
|
745
|
-
body: body)
|
746
|
-
end
|
747
|
-
|
748
|
-
end
|
749
|
-
end
|