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/devices.rb
DELETED
@@ -1,707 +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 Devices Resource
|
28
|
-
class Devices
|
29
|
-
|
30
|
-
def initialize(client)
|
31
|
-
@client = client
|
32
|
-
end
|
33
|
-
|
34
|
-
# Gets the attribute names that match the given query. Maximum 1K returned.
|
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.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, devices.*, or devices.attributeNames.
|
41
|
-
#
|
42
|
-
# Parameters:
|
43
|
-
# * {string} applicationId - ID associated with the application
|
44
|
-
# * {hash} query - Device filter JSON object (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
45
|
-
# * {hash} dataType - Filter the devices by the given attribute data type or types (https://api.losant.com/#/definitions/deviceAttributeDataTypeFilter)
|
46
|
-
# * {string} startsWith - Filter attributes down to those that have names starting with the given string. Case insensitive.
|
47
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
48
|
-
# * {boolean} _actions - Return resource actions in response
|
49
|
-
# * {boolean} _links - Return resource link in response
|
50
|
-
# * {boolean} _embedded - Return embedded resources in response
|
51
|
-
#
|
52
|
-
# Responses:
|
53
|
-
# * 200 - The matching attribute names (https://api.losant.com/#/definitions/attributeNamesResponse)
|
54
|
-
#
|
55
|
-
# Errors:
|
56
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
57
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
58
|
-
def attribute_names(params = {})
|
59
|
-
params = Utils.symbolize_hash_keys(params)
|
60
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
61
|
-
headers = {}
|
62
|
-
body = nil
|
63
|
-
|
64
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
65
|
-
|
66
|
-
query_params[:query] = params[:query] if params.has_key?(:query)
|
67
|
-
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
68
|
-
query_params[:dataType] = params[:dataType] if params.has_key?(:dataType)
|
69
|
-
query_params[:startsWith] = params[:startsWith] if params.has_key?(:startsWith)
|
70
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
71
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
72
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
73
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
74
|
-
|
75
|
-
path = "/applications/#{params[:applicationId]}/devices/attributeNames"
|
76
|
-
|
77
|
-
@client.request(
|
78
|
-
method: :get,
|
79
|
-
path: path,
|
80
|
-
query: query_params,
|
81
|
-
headers: headers,
|
82
|
-
body: body)
|
83
|
-
end
|
84
|
-
|
85
|
-
# Delete devices
|
86
|
-
#
|
87
|
-
# Authentication:
|
88
|
-
# The client must be configured with a valid api
|
89
|
-
# access token to call this action. The token
|
90
|
-
# must include at least one of the following scopes:
|
91
|
-
# all.Application, all.Organization, all.User, devices.*, or devices.delete.
|
92
|
-
#
|
93
|
-
# Parameters:
|
94
|
-
# * {string} applicationId - ID associated with the application
|
95
|
-
# * {hash} options - Object containing device query and email (https://api.losant.com/#/definitions/devicesDeletePost)
|
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
|
-
# * 200 - Object indicating number of devices deleted or failed (https://api.losant.com/#/definitions/bulkDeleteResponse)
|
103
|
-
# * 202 - If a job was enqueued for the devices to be deleted (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
104
|
-
#
|
105
|
-
# Errors:
|
106
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
107
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
108
|
-
def delete(params = {})
|
109
|
-
params = Utils.symbolize_hash_keys(params)
|
110
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
111
|
-
headers = {}
|
112
|
-
body = nil
|
113
|
-
|
114
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
115
|
-
raise ArgumentError.new("options is required") unless params.has_key?(:options)
|
116
|
-
|
117
|
-
body = params[:options] if params.has_key?(:options)
|
118
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
119
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
120
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
121
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
122
|
-
|
123
|
-
path = "/applications/#{params[:applicationId]}/devices/delete"
|
124
|
-
|
125
|
-
@client.request(
|
126
|
-
method: :post,
|
127
|
-
path: path,
|
128
|
-
query: query_params,
|
129
|
-
headers: headers,
|
130
|
-
body: body)
|
131
|
-
end
|
132
|
-
|
133
|
-
# Gets the device names that match the given query. Maximum 1K returned.
|
134
|
-
#
|
135
|
-
# Authentication:
|
136
|
-
# The client must be configured with a valid api
|
137
|
-
# access token to call this action. The token
|
138
|
-
# must include at least one of the following scopes:
|
139
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, devices.*, or devices.deviceNames.
|
140
|
-
#
|
141
|
-
# Parameters:
|
142
|
-
# * {string} applicationId - ID associated with the application
|
143
|
-
# * {hash} query - Device filter JSON object (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
144
|
-
# * {string} startsWith - Filter devices down to those that have names starting with the given string. Case insensitive.
|
145
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
146
|
-
# * {boolean} _actions - Return resource actions in response
|
147
|
-
# * {boolean} _links - Return resource link in response
|
148
|
-
# * {boolean} _embedded - Return embedded resources in response
|
149
|
-
#
|
150
|
-
# Responses:
|
151
|
-
# * 200 - The matching device names (https://api.losant.com/#/definitions/deviceNamesResponse)
|
152
|
-
#
|
153
|
-
# Errors:
|
154
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
155
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
156
|
-
def device_names(params = {})
|
157
|
-
params = Utils.symbolize_hash_keys(params)
|
158
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
159
|
-
headers = {}
|
160
|
-
body = nil
|
161
|
-
|
162
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
163
|
-
|
164
|
-
query_params[:query] = params[:query] if params.has_key?(:query)
|
165
|
-
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
166
|
-
query_params[:startsWith] = params[:startsWith] if params.has_key?(:startsWith)
|
167
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
168
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
169
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
170
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
171
|
-
|
172
|
-
path = "/applications/#{params[:applicationId]}/devices/deviceNames"
|
173
|
-
|
174
|
-
@client.request(
|
175
|
-
method: :get,
|
176
|
-
path: path,
|
177
|
-
query: query_params,
|
178
|
-
headers: headers,
|
179
|
-
body: body)
|
180
|
-
end
|
181
|
-
|
182
|
-
# Creates an export of all device metadata
|
183
|
-
#
|
184
|
-
# Authentication:
|
185
|
-
# The client must be configured with a valid api
|
186
|
-
# access token to call this action. The token
|
187
|
-
# must include at least one of the following scopes:
|
188
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, devices.*, or devices.export.
|
189
|
-
#
|
190
|
-
# Parameters:
|
191
|
-
# * {string} applicationId - ID associated with the application
|
192
|
-
# * {string} email - Email address to send export to. Defaults to current user's email.
|
193
|
-
# * {string} callbackUrl - Callback URL to call with export result
|
194
|
-
# * {hash} options - Object containing device query and optionally email or callback (https://api.losant.com/#/definitions/devicesExportPost)
|
195
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
196
|
-
# * {boolean} _actions - Return resource actions in response
|
197
|
-
# * {boolean} _links - Return resource link in response
|
198
|
-
# * {boolean} _embedded - Return embedded resources in response
|
199
|
-
#
|
200
|
-
# Responses:
|
201
|
-
# * 202 - If generation of export was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
202
|
-
#
|
203
|
-
# Errors:
|
204
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
205
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
206
|
-
def export(params = {})
|
207
|
-
params = Utils.symbolize_hash_keys(params)
|
208
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
209
|
-
headers = {}
|
210
|
-
body = nil
|
211
|
-
|
212
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
213
|
-
|
214
|
-
query_params[:email] = params[:email] if params.has_key?(:email)
|
215
|
-
query_params[:callbackUrl] = params[:callbackUrl] if params.has_key?(:callbackUrl)
|
216
|
-
body = params[:options] if params.has_key?(:options)
|
217
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
218
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
219
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
220
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
221
|
-
|
222
|
-
path = "/applications/#{params[:applicationId]}/devices/export"
|
223
|
-
|
224
|
-
@client.request(
|
225
|
-
method: :post,
|
226
|
-
path: path,
|
227
|
-
query: query_params,
|
228
|
-
headers: headers,
|
229
|
-
body: body)
|
230
|
-
end
|
231
|
-
|
232
|
-
# Returns the devices for an application
|
233
|
-
#
|
234
|
-
# Authentication:
|
235
|
-
# The client must be configured with a valid api
|
236
|
-
# access token to call this action. The token
|
237
|
-
# must include at least one of the following scopes:
|
238
|
-
# all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, devices.*, or devices.get.
|
239
|
-
#
|
240
|
-
# Parameters:
|
241
|
-
# * {string} applicationId - ID associated with the application
|
242
|
-
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, connectionStatus
|
243
|
-
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
244
|
-
# * {string} page - Which page of results to return
|
245
|
-
# * {string} perPage - How many items to return per page
|
246
|
-
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
247
|
-
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
248
|
-
# * {hash} deviceClass - Filter the devices by the given device class or classes (https://api.losant.com/#/definitions/deviceClassFilter)
|
249
|
-
# * {hash} tagFilter - Array of tag pairs to filter by (https://api.losant.com/#/definitions/deviceTagFilter)
|
250
|
-
# * {string} excludeConnectionInfo - If set, do not return connection info
|
251
|
-
# * {string} parentId - Filter devices as children of a given system id
|
252
|
-
# * {hash} query - Device filter JSON object which overrides the filterField, filter, deviceClass, tagFilter, and parentId parameters. (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
253
|
-
# * {string} tagsAsObject - Return tags as an object map instead of an array
|
254
|
-
# * {string} attributesAsObject - Return attributes as an object map instead of an array
|
255
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
256
|
-
# * {boolean} _actions - Return resource actions in response
|
257
|
-
# * {boolean} _links - Return resource link in response
|
258
|
-
# * {boolean} _embedded - Return embedded resources in response
|
259
|
-
#
|
260
|
-
# Responses:
|
261
|
-
# * 200 - Collection of devices (https://api.losant.com/#/definitions/devices)
|
262
|
-
#
|
263
|
-
# Errors:
|
264
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
265
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
266
|
-
def get(params = {})
|
267
|
-
params = Utils.symbolize_hash_keys(params)
|
268
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
269
|
-
headers = {}
|
270
|
-
body = nil
|
271
|
-
|
272
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
273
|
-
|
274
|
-
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
275
|
-
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
276
|
-
query_params[:page] = params[:page] if params.has_key?(:page)
|
277
|
-
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
278
|
-
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
279
|
-
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
280
|
-
query_params[:deviceClass] = params[:deviceClass] if params.has_key?(:deviceClass)
|
281
|
-
query_params[:tagFilter] = params[:tagFilter] if params.has_key?(:tagFilter)
|
282
|
-
query_params[:excludeConnectionInfo] = params[:excludeConnectionInfo] if params.has_key?(:excludeConnectionInfo)
|
283
|
-
query_params[:parentId] = params[:parentId] if params.has_key?(:parentId)
|
284
|
-
query_params[:query] = params[:query] if params.has_key?(:query)
|
285
|
-
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
286
|
-
query_params[:tagsAsObject] = params[:tagsAsObject] if params.has_key?(:tagsAsObject)
|
287
|
-
query_params[:attributesAsObject] = params[:attributesAsObject] if params.has_key?(:attributesAsObject)
|
288
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
289
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
290
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
291
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
292
|
-
|
293
|
-
path = "/applications/#{params[:applicationId]}/devices"
|
294
|
-
|
295
|
-
@client.request(
|
296
|
-
method: :get,
|
297
|
-
path: path,
|
298
|
-
query: query_params,
|
299
|
-
headers: headers,
|
300
|
-
body: body)
|
301
|
-
end
|
302
|
-
|
303
|
-
# Retrieve the composite last complete state of the matching devices
|
304
|
-
#
|
305
|
-
# Authentication:
|
306
|
-
# The client must be configured with a valid api
|
307
|
-
# access token to call this action. The token
|
308
|
-
# must include at least one of the following scopes:
|
309
|
-
# all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, devices.*, or devices.getCompositeState.
|
310
|
-
#
|
311
|
-
# Parameters:
|
312
|
-
# * {string} applicationId - ID associated with the application
|
313
|
-
# * {string} start - Start of time range to look at to build composite state
|
314
|
-
# * {string} end - End of time range to look at to build composite state
|
315
|
-
# * {string} attributes - Comma-separated list of attributes to include. When not provided, returns all attributes.
|
316
|
-
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, connectionStatus
|
317
|
-
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
318
|
-
# * {string} page - Which page of results to return
|
319
|
-
# * {string} perPage - How many items to return per page
|
320
|
-
# * {hash} query - Device advanced query JSON object (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
321
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
322
|
-
# * {boolean} _actions - Return resource actions in response
|
323
|
-
# * {boolean} _links - Return resource link in response
|
324
|
-
# * {boolean} _embedded - Return embedded resources in response
|
325
|
-
#
|
326
|
-
# Responses:
|
327
|
-
# * 200 - Collection of composite last state of the devices (https://api.losant.com/#/definitions/compositeDevicesState)
|
328
|
-
#
|
329
|
-
# Errors:
|
330
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
331
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
332
|
-
def get_composite_state(params = {})
|
333
|
-
params = Utils.symbolize_hash_keys(params)
|
334
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
335
|
-
headers = {}
|
336
|
-
body = nil
|
337
|
-
|
338
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
339
|
-
|
340
|
-
query_params[:start] = params[:start] if params.has_key?(:start)
|
341
|
-
query_params[:end] = params[:end] if params.has_key?(:end)
|
342
|
-
query_params[:attributes] = params[:attributes] if params.has_key?(:attributes)
|
343
|
-
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
344
|
-
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
345
|
-
query_params[:page] = params[:page] if params.has_key?(:page)
|
346
|
-
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
347
|
-
query_params[:query] = params[:query] if params.has_key?(:query)
|
348
|
-
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
349
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
350
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
351
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
352
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
353
|
-
|
354
|
-
path = "/applications/#{params[:applicationId]}/devices/compositeState"
|
355
|
-
|
356
|
-
@client.request(
|
357
|
-
method: :get,
|
358
|
-
path: path,
|
359
|
-
query: query_params,
|
360
|
-
headers: headers,
|
361
|
-
body: body)
|
362
|
-
end
|
363
|
-
|
364
|
-
# Update the fields of one or more devices
|
365
|
-
#
|
366
|
-
# Authentication:
|
367
|
-
# The client must be configured with a valid api
|
368
|
-
# access token to call this action. The token
|
369
|
-
# must include at least one of the following scopes:
|
370
|
-
# all.Application, all.Organization, all.User, devices.*, or devices.patch.
|
371
|
-
#
|
372
|
-
# Parameters:
|
373
|
-
# * {string} applicationId - ID associated with the application
|
374
|
-
# * {hash} patchInfo - Object containing device query or IDs and update operations (https://api.losant.com/#/definitions/devicesPatch)
|
375
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
376
|
-
# * {boolean} _actions - Return resource actions in response
|
377
|
-
# * {boolean} _links - Return resource link in response
|
378
|
-
# * {boolean} _embedded - Return embedded resources in response
|
379
|
-
#
|
380
|
-
# Responses:
|
381
|
-
# * 200 - Object including an update log link and the number of devices updated, failed, and skipped (https://api.losant.com/#/definitions/devicesUpdated)
|
382
|
-
# * 202 - Successfully queued bulk update job (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
383
|
-
#
|
384
|
-
# Errors:
|
385
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
386
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
387
|
-
def patch(params = {})
|
388
|
-
params = Utils.symbolize_hash_keys(params)
|
389
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
390
|
-
headers = {}
|
391
|
-
body = nil
|
392
|
-
|
393
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
394
|
-
raise ArgumentError.new("patchInfo is required") unless params.has_key?(:patchInfo)
|
395
|
-
|
396
|
-
body = params[:patchInfo] if params.has_key?(:patchInfo)
|
397
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
398
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
399
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
400
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
401
|
-
|
402
|
-
path = "/applications/#{params[:applicationId]}/devices"
|
403
|
-
|
404
|
-
@client.request(
|
405
|
-
method: :patch,
|
406
|
-
path: path,
|
407
|
-
query: query_params,
|
408
|
-
headers: headers,
|
409
|
-
body: body)
|
410
|
-
end
|
411
|
-
|
412
|
-
# Creates an export of payload count information for the matching devices
|
413
|
-
#
|
414
|
-
# Authentication:
|
415
|
-
# The client must be configured with a valid api
|
416
|
-
# access token to call this action. The token
|
417
|
-
# must include at least one of the following scopes:
|
418
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, devices.*, or devices.payloadCounts.
|
419
|
-
#
|
420
|
-
# Parameters:
|
421
|
-
# * {string} applicationId - ID associated with the application
|
422
|
-
# * {hash} options - Object containing export configuration (https://api.losant.com/#/definitions/devicesExportPayloadCountPost)
|
423
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
424
|
-
# * {boolean} _actions - Return resource actions in response
|
425
|
-
# * {boolean} _links - Return resource link in response
|
426
|
-
# * {boolean} _embedded - Return embedded resources in response
|
427
|
-
#
|
428
|
-
# Responses:
|
429
|
-
# * 202 - If generation of export was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
430
|
-
#
|
431
|
-
# Errors:
|
432
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
433
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
434
|
-
def payload_counts(params = {})
|
435
|
-
params = Utils.symbolize_hash_keys(params)
|
436
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
437
|
-
headers = {}
|
438
|
-
body = nil
|
439
|
-
|
440
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
441
|
-
|
442
|
-
body = params[:options] if params.has_key?(:options)
|
443
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
444
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
445
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
446
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
447
|
-
|
448
|
-
path = "/applications/#{params[:applicationId]}/devices/payloadCounts"
|
449
|
-
|
450
|
-
@client.request(
|
451
|
-
method: :post,
|
452
|
-
path: path,
|
453
|
-
query: query_params,
|
454
|
-
headers: headers,
|
455
|
-
body: body)
|
456
|
-
end
|
457
|
-
|
458
|
-
# Create a new device for an application
|
459
|
-
#
|
460
|
-
# Authentication:
|
461
|
-
# The client must be configured with a valid api
|
462
|
-
# access token to call this action. The token
|
463
|
-
# must include at least one of the following scopes:
|
464
|
-
# all.Application, all.Organization, all.User, devices.*, or devices.post.
|
465
|
-
#
|
466
|
-
# Parameters:
|
467
|
-
# * {string} applicationId - ID associated with the application
|
468
|
-
# * {hash} device - New device information (https://api.losant.com/#/definitions/devicePost)
|
469
|
-
# * {string} tagsAsObject - Return tags as an object map instead of an array
|
470
|
-
# * {string} attributesAsObject - Return attributes as an object map instead of an array
|
471
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
472
|
-
# * {boolean} _actions - Return resource actions in response
|
473
|
-
# * {boolean} _links - Return resource link in response
|
474
|
-
# * {boolean} _embedded - Return embedded resources in response
|
475
|
-
#
|
476
|
-
# Responses:
|
477
|
-
# * 201 - Successfully created device (https://api.losant.com/#/definitions/device)
|
478
|
-
#
|
479
|
-
# Errors:
|
480
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
481
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
482
|
-
def post(params = {})
|
483
|
-
params = Utils.symbolize_hash_keys(params)
|
484
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
485
|
-
headers = {}
|
486
|
-
body = nil
|
487
|
-
|
488
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
489
|
-
raise ArgumentError.new("device is required") unless params.has_key?(:device)
|
490
|
-
|
491
|
-
body = params[:device] if params.has_key?(:device)
|
492
|
-
query_params[:tagsAsObject] = params[:tagsAsObject] if params.has_key?(:tagsAsObject)
|
493
|
-
query_params[:attributesAsObject] = params[:attributesAsObject] if params.has_key?(:attributesAsObject)
|
494
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
495
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
496
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
497
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
498
|
-
|
499
|
-
path = "/applications/#{params[:applicationId]}/devices"
|
500
|
-
|
501
|
-
@client.request(
|
502
|
-
method: :post,
|
503
|
-
path: path,
|
504
|
-
query: query_params,
|
505
|
-
headers: headers,
|
506
|
-
body: body)
|
507
|
-
end
|
508
|
-
|
509
|
-
# Removes all device data for the specified time range. Defaults to all data.
|
510
|
-
#
|
511
|
-
# Authentication:
|
512
|
-
# The client must be configured with a valid api
|
513
|
-
# access token to call this action. The token
|
514
|
-
# must include at least one of the following scopes:
|
515
|
-
# all.Application, all.Organization, all.User, devices.*, or devices.removeData.
|
516
|
-
#
|
517
|
-
# Parameters:
|
518
|
-
# * {string} applicationId - ID associated with the application
|
519
|
-
# * {hash} options - Object defining the device data to delete and devices to delete from (https://api.losant.com/#/definitions/devicesRemoveDataPost)
|
520
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
521
|
-
# * {boolean} _actions - Return resource actions in response
|
522
|
-
# * {boolean} _links - Return resource link in response
|
523
|
-
# * {boolean} _embedded - Return embedded resources in response
|
524
|
-
#
|
525
|
-
# Responses:
|
526
|
-
# * 200 - Object indicating number of devices completed or skipped (https://api.losant.com/#/definitions/devicesDataRemoved)
|
527
|
-
# * 202 - If a job was enqueued for device data to be removed (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
528
|
-
#
|
529
|
-
# Errors:
|
530
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
531
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
532
|
-
def remove_data(params = {})
|
533
|
-
params = Utils.symbolize_hash_keys(params)
|
534
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
535
|
-
headers = {}
|
536
|
-
body = nil
|
537
|
-
|
538
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
539
|
-
raise ArgumentError.new("options is required") unless params.has_key?(:options)
|
540
|
-
|
541
|
-
body = params[:options] if params.has_key?(:options)
|
542
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
543
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
544
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
545
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
546
|
-
|
547
|
-
path = "/applications/#{params[:applicationId]}/devices/removeData"
|
548
|
-
|
549
|
-
@client.request(
|
550
|
-
method: :post,
|
551
|
-
path: path,
|
552
|
-
query: query_params,
|
553
|
-
headers: headers,
|
554
|
-
body: body)
|
555
|
-
end
|
556
|
-
|
557
|
-
# Send a command to multiple devices
|
558
|
-
#
|
559
|
-
# Authentication:
|
560
|
-
# The client must be configured with a valid api
|
561
|
-
# access token to call this action. The token
|
562
|
-
# must include at least one of the following scopes:
|
563
|
-
# all.Application, all.Device, all.Organization, all.User, devices.*, or devices.sendCommand.
|
564
|
-
#
|
565
|
-
# Parameters:
|
566
|
-
# * {string} applicationId - ID associated with the application
|
567
|
-
# * {hash} multiDeviceCommand - Command to send to the device (https://api.losant.com/#/definitions/multiDeviceCommand)
|
568
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
569
|
-
# * {boolean} _actions - Return resource actions in response
|
570
|
-
# * {boolean} _links - Return resource link in response
|
571
|
-
# * {boolean} _embedded - Return embedded resources in response
|
572
|
-
#
|
573
|
-
# Responses:
|
574
|
-
# * 200 - If command was successfully sent (https://api.losant.com/#/definitions/success)
|
575
|
-
# * 202 - If command was queued to be sent (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
576
|
-
#
|
577
|
-
# Errors:
|
578
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
579
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
580
|
-
def send_command(params = {})
|
581
|
-
params = Utils.symbolize_hash_keys(params)
|
582
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
583
|
-
headers = {}
|
584
|
-
body = nil
|
585
|
-
|
586
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
587
|
-
raise ArgumentError.new("multiDeviceCommand is required") unless params.has_key?(:multiDeviceCommand)
|
588
|
-
|
589
|
-
body = params[:multiDeviceCommand] if params.has_key?(:multiDeviceCommand)
|
590
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
591
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
592
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
593
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
594
|
-
|
595
|
-
path = "/applications/#{params[:applicationId]}/devices/command"
|
596
|
-
|
597
|
-
@client.request(
|
598
|
-
method: :post,
|
599
|
-
path: path,
|
600
|
-
query: query_params,
|
601
|
-
headers: headers,
|
602
|
-
body: body)
|
603
|
-
end
|
604
|
-
|
605
|
-
# Gets the unique tag keys for devices that match the given query. Maximum 1K returned.
|
606
|
-
#
|
607
|
-
# Authentication:
|
608
|
-
# The client must be configured with a valid api
|
609
|
-
# access token to call this action. The token
|
610
|
-
# must include at least one of the following scopes:
|
611
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, devices.*, or devices.tagKeys.
|
612
|
-
#
|
613
|
-
# Parameters:
|
614
|
-
# * {string} applicationId - ID associated with the application
|
615
|
-
# * {hash} query - Device filter JSON object (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
616
|
-
# * {string} startsWith - Filter keys down to those that start with the given string. Case insensitive.
|
617
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
618
|
-
# * {boolean} _actions - Return resource actions in response
|
619
|
-
# * {boolean} _links - Return resource link in response
|
620
|
-
# * {boolean} _embedded - Return embedded resources in response
|
621
|
-
#
|
622
|
-
# Responses:
|
623
|
-
# * 200 - The matching tag keys (https://api.losant.com/#/definitions/tagKeysResponse)
|
624
|
-
#
|
625
|
-
# Errors:
|
626
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
627
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
628
|
-
def tag_keys(params = {})
|
629
|
-
params = Utils.symbolize_hash_keys(params)
|
630
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
631
|
-
headers = {}
|
632
|
-
body = nil
|
633
|
-
|
634
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
635
|
-
|
636
|
-
query_params[:query] = params[:query] if params.has_key?(:query)
|
637
|
-
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
638
|
-
query_params[:startsWith] = params[:startsWith] if params.has_key?(:startsWith)
|
639
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
640
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
641
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
642
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
643
|
-
|
644
|
-
path = "/applications/#{params[:applicationId]}/devices/tagKeys"
|
645
|
-
|
646
|
-
@client.request(
|
647
|
-
method: :get,
|
648
|
-
path: path,
|
649
|
-
query: query_params,
|
650
|
-
headers: headers,
|
651
|
-
body: body)
|
652
|
-
end
|
653
|
-
|
654
|
-
# Gets the unique tag values for the given key for devices that match the given query. Maximum 1K returned.
|
655
|
-
#
|
656
|
-
# Authentication:
|
657
|
-
# The client must be configured with a valid api
|
658
|
-
# access token to call this action. The token
|
659
|
-
# must include at least one of the following scopes:
|
660
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, devices.*, or devices.tagValues.
|
661
|
-
#
|
662
|
-
# Parameters:
|
663
|
-
# * {string} applicationId - ID associated with the application
|
664
|
-
# * {hash} query - Device filter JSON object (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
665
|
-
# * {string} key - The tag key to get the values for
|
666
|
-
# * {string} startsWith - Filter values down to those that start with the given string. Case insensitive.
|
667
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
668
|
-
# * {boolean} _actions - Return resource actions in response
|
669
|
-
# * {boolean} _links - Return resource link in response
|
670
|
-
# * {boolean} _embedded - Return embedded resources in response
|
671
|
-
#
|
672
|
-
# Responses:
|
673
|
-
# * 200 - The matching tag values (https://api.losant.com/#/definitions/tagValuesResponse)
|
674
|
-
#
|
675
|
-
# Errors:
|
676
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
677
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
678
|
-
def tag_values(params = {})
|
679
|
-
params = Utils.symbolize_hash_keys(params)
|
680
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
681
|
-
headers = {}
|
682
|
-
body = nil
|
683
|
-
|
684
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
685
|
-
raise ArgumentError.new("key is required") unless params.has_key?(:key)
|
686
|
-
|
687
|
-
query_params[:query] = params[:query] if params.has_key?(:query)
|
688
|
-
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
689
|
-
query_params[:key] = params[:key] if params.has_key?(:key)
|
690
|
-
query_params[:startsWith] = params[:startsWith] if params.has_key?(:startsWith)
|
691
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
692
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
693
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
694
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
695
|
-
|
696
|
-
path = "/applications/#{params[:applicationId]}/devices/tagValues"
|
697
|
-
|
698
|
-
@client.request(
|
699
|
-
method: :get,
|
700
|
-
path: path,
|
701
|
-
query: query_params,
|
702
|
-
headers: headers,
|
703
|
-
body: body)
|
704
|
-
end
|
705
|
-
|
706
|
-
end
|
707
|
-
end
|