losant_rest 1.19.4 → 1.19.6
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 +1142 -63
- 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 +1 -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/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 +50 -1
- data/schemas/credentialLinkedResources.json +81 -4
- data/schemas/credentialPatch.json +56 -0
- data/schemas/credentialPost.json +71 -1
- data/schemas/credentials.json +50 -1
- data/schemas/deviceConnectionStatus.json +6 -2
- data/schemas/devicesHistoricalImportPost.json +25 -0
- data/schemas/experienceLinkedResources.json +7 -5
- 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 +2 -1
- data/schemas/flowPatch.json +2 -1
- data/schemas/flowPost.json +2 -1
- data/schemas/flowVersion.json +4 -2
- data/schemas/flowVersionPost.json +2 -1
- data/schemas/flowVersions.json +4 -2
- data/schemas/flows.json +2 -1
- data/schemas/flowsImportPost.json +4 -2
- data/schemas/flowsImportResult.json +6 -3
- 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/instanceCustomNodePatch.json +2 -1
- data/schemas/instanceCustomNodePost.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/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 +11 -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/flows.rb
DELETED
@@ -1,310 +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 Flows Resource
|
28
|
-
class Flows
|
29
|
-
|
30
|
-
def initialize(client)
|
31
|
-
@client = client
|
32
|
-
end
|
33
|
-
|
34
|
-
# Returns the flows for an application
|
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, flows.*, or flows.get.
|
41
|
-
#
|
42
|
-
# Parameters:
|
43
|
-
# * {string} applicationId - ID associated with the application
|
44
|
-
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
|
45
|
-
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
46
|
-
# * {string} page - Which page of results to return
|
47
|
-
# * {string} perPage - How many items to return per page
|
48
|
-
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
49
|
-
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
50
|
-
# * {string} flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
|
51
|
-
# * {hash} triggerFilter - Array of triggers to filter by - always filters against default flow version. (https://api.losant.com/#/definitions/flowTriggerFilter)
|
52
|
-
# * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
|
53
|
-
# * {hash} query - Workflow filter JSON object which overrides the filterField, filter, triggerFilter, and flowClass parameters. (https://api.losant.com/#/definitions/advancedFlowQuery)
|
54
|
-
# * {string} allVersions - If the request should also return flows with matching versions. Only applicable for requests with an advanced query.
|
55
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
56
|
-
# * {boolean} _actions - Return resource actions in response
|
57
|
-
# * {boolean} _links - Return resource link in response
|
58
|
-
# * {boolean} _embedded - Return embedded resources in response
|
59
|
-
#
|
60
|
-
# Responses:
|
61
|
-
# * 200 - Collection of flows (https://api.losant.com/#/definitions/flows)
|
62
|
-
#
|
63
|
-
# Errors:
|
64
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
65
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
66
|
-
def get(params = {})
|
67
|
-
params = Utils.symbolize_hash_keys(params)
|
68
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
69
|
-
headers = {}
|
70
|
-
body = nil
|
71
|
-
|
72
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
73
|
-
|
74
|
-
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
75
|
-
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
76
|
-
query_params[:page] = params[:page] if params.has_key?(:page)
|
77
|
-
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
78
|
-
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
79
|
-
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
80
|
-
query_params[:flowClass] = params[:flowClass] if params.has_key?(:flowClass)
|
81
|
-
query_params[:triggerFilter] = params[:triggerFilter] if params.has_key?(:triggerFilter)
|
82
|
-
query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes)
|
83
|
-
query_params[:query] = params[:query] if params.has_key?(:query)
|
84
|
-
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
85
|
-
query_params[:allVersions] = params[:allVersions] if params.has_key?(:allVersions)
|
86
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
87
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
88
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
89
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
90
|
-
|
91
|
-
path = "/applications/#{params[:applicationId]}/flows"
|
92
|
-
|
93
|
-
@client.request(
|
94
|
-
method: :get,
|
95
|
-
path: path,
|
96
|
-
query: query_params,
|
97
|
-
headers: headers,
|
98
|
-
body: body)
|
99
|
-
end
|
100
|
-
|
101
|
-
# Returns the flows by version for an application
|
102
|
-
#
|
103
|
-
# Authentication:
|
104
|
-
# The client must be configured with a valid api
|
105
|
-
# access token to call this action. The token
|
106
|
-
# must include at least one of the following scopes:
|
107
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.getByVersion.
|
108
|
-
#
|
109
|
-
# Parameters:
|
110
|
-
# * {string} applicationId - ID associated with the application
|
111
|
-
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
|
112
|
-
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
113
|
-
# * {string} page - Which page of results to return
|
114
|
-
# * {string} perPage - How many items to return per page
|
115
|
-
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
116
|
-
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
117
|
-
# * {string} flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
|
118
|
-
# * {string} version - Return the workflow versions for the given version.
|
119
|
-
# * {hash} triggerFilter - Array of triggers to filter by - always filters against default flow version. (https://api.losant.com/#/definitions/flowTriggerFilter)
|
120
|
-
# * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
|
121
|
-
# * {hash} query - Workflow filter JSON object which overrides the filterField, filter, triggerFilter, and flowClass parameters. (https://api.losant.com/#/definitions/advancedFlowByVersionQuery)
|
122
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
123
|
-
# * {boolean} _actions - Return resource actions in response
|
124
|
-
# * {boolean} _links - Return resource link in response
|
125
|
-
# * {boolean} _embedded - Return embedded resources in response
|
126
|
-
#
|
127
|
-
# Responses:
|
128
|
-
# * 200 - Collection of flow versions (https://api.losant.com/#/definitions/flowVersions)
|
129
|
-
#
|
130
|
-
# Errors:
|
131
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
132
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
133
|
-
def get_by_version(params = {})
|
134
|
-
params = Utils.symbolize_hash_keys(params)
|
135
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
136
|
-
headers = {}
|
137
|
-
body = nil
|
138
|
-
|
139
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
140
|
-
raise ArgumentError.new("version is required") unless params.has_key?(:version)
|
141
|
-
|
142
|
-
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
143
|
-
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
144
|
-
query_params[:page] = params[:page] if params.has_key?(:page)
|
145
|
-
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
146
|
-
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
147
|
-
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
148
|
-
query_params[:flowClass] = params[:flowClass] if params.has_key?(:flowClass)
|
149
|
-
query_params[:version] = params[:version] if params.has_key?(:version)
|
150
|
-
query_params[:triggerFilter] = params[:triggerFilter] if params.has_key?(:triggerFilter)
|
151
|
-
query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes)
|
152
|
-
query_params[:query] = params[:query] if params.has_key?(:query)
|
153
|
-
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
154
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
155
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
156
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
157
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
158
|
-
|
159
|
-
path = "/applications/#{params[:applicationId]}/flows/version"
|
160
|
-
|
161
|
-
@client.request(
|
162
|
-
method: :get,
|
163
|
-
path: path,
|
164
|
-
query: query_params,
|
165
|
-
headers: headers,
|
166
|
-
body: body)
|
167
|
-
end
|
168
|
-
|
169
|
-
# Import a set of flows and flow versions
|
170
|
-
#
|
171
|
-
# Authentication:
|
172
|
-
# The client must be configured with a valid api
|
173
|
-
# access token to call this action. The token
|
174
|
-
# must include at least one of the following scopes:
|
175
|
-
# all.Application, all.Organization, all.User, flows.*, or flows.import.
|
176
|
-
#
|
177
|
-
# Parameters:
|
178
|
-
# * {string} applicationId - ID associated with the application
|
179
|
-
# * {hash} importData - New flow and flow version information (https://api.losant.com/#/definitions/flowsImportPost)
|
180
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
181
|
-
# * {boolean} _actions - Return resource actions in response
|
182
|
-
# * {boolean} _links - Return resource link in response
|
183
|
-
# * {boolean} _embedded - Return embedded resources in response
|
184
|
-
#
|
185
|
-
# Responses:
|
186
|
-
# * 201 - Successfully imported workflows (https://api.losant.com/#/definitions/flowsImportResult)
|
187
|
-
#
|
188
|
-
# Errors:
|
189
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
190
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
191
|
-
def import(params = {})
|
192
|
-
params = Utils.symbolize_hash_keys(params)
|
193
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
194
|
-
headers = {}
|
195
|
-
body = nil
|
196
|
-
|
197
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
198
|
-
raise ArgumentError.new("importData is required") unless params.has_key?(:importData)
|
199
|
-
|
200
|
-
body = params[:importData] if params.has_key?(:importData)
|
201
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
202
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
203
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
204
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
205
|
-
|
206
|
-
path = "/applications/#{params[:applicationId]}/flows/import"
|
207
|
-
|
208
|
-
@client.request(
|
209
|
-
method: :post,
|
210
|
-
path: path,
|
211
|
-
query: query_params,
|
212
|
-
headers: headers,
|
213
|
-
body: body)
|
214
|
-
end
|
215
|
-
|
216
|
-
# Gets additional nodes that should be available in the palette
|
217
|
-
#
|
218
|
-
# Authentication:
|
219
|
-
# The client must be configured with a valid api
|
220
|
-
# access token to call this action. The token
|
221
|
-
# must include at least one of the following scopes:
|
222
|
-
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.palette.
|
223
|
-
#
|
224
|
-
# Parameters:
|
225
|
-
# * {string} applicationId - ID associated with the application
|
226
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
227
|
-
# * {boolean} _actions - Return resource actions in response
|
228
|
-
# * {boolean} _links - Return resource link in response
|
229
|
-
# * {boolean} _embedded - Return embedded resources in response
|
230
|
-
#
|
231
|
-
# Responses:
|
232
|
-
# * 200 - The additional nodes available in the palette (https://api.losant.com/#/definitions/paletteResponse)
|
233
|
-
#
|
234
|
-
# Errors:
|
235
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
236
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
237
|
-
def palette(params = {})
|
238
|
-
params = Utils.symbolize_hash_keys(params)
|
239
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
240
|
-
headers = {}
|
241
|
-
body = nil
|
242
|
-
|
243
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
244
|
-
|
245
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
246
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
247
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
248
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
249
|
-
|
250
|
-
path = "/applications/#{params[:applicationId]}/flows/palette"
|
251
|
-
|
252
|
-
@client.request(
|
253
|
-
method: :get,
|
254
|
-
path: path,
|
255
|
-
query: query_params,
|
256
|
-
headers: headers,
|
257
|
-
body: body)
|
258
|
-
end
|
259
|
-
|
260
|
-
# Create a new flow for an application
|
261
|
-
#
|
262
|
-
# Authentication:
|
263
|
-
# The client must be configured with a valid api
|
264
|
-
# access token to call this action. The token
|
265
|
-
# must include at least one of the following scopes:
|
266
|
-
# all.Application, all.Organization, all.User, flows.*, or flows.post.
|
267
|
-
#
|
268
|
-
# Parameters:
|
269
|
-
# * {string} applicationId - ID associated with the application
|
270
|
-
# * {hash} flow - New flow information (https://api.losant.com/#/definitions/flowPost)
|
271
|
-
# * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
|
272
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
273
|
-
# * {boolean} _actions - Return resource actions in response
|
274
|
-
# * {boolean} _links - Return resource link in response
|
275
|
-
# * {boolean} _embedded - Return embedded resources in response
|
276
|
-
#
|
277
|
-
# Responses:
|
278
|
-
# * 201 - Successfully created flow (https://api.losant.com/#/definitions/flow)
|
279
|
-
#
|
280
|
-
# Errors:
|
281
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
282
|
-
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
283
|
-
def post(params = {})
|
284
|
-
params = Utils.symbolize_hash_keys(params)
|
285
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
286
|
-
headers = {}
|
287
|
-
body = nil
|
288
|
-
|
289
|
-
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
290
|
-
raise ArgumentError.new("flow is required") unless params.has_key?(:flow)
|
291
|
-
|
292
|
-
body = params[:flow] if params.has_key?(:flow)
|
293
|
-
query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes)
|
294
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
295
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
296
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
297
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
298
|
-
|
299
|
-
path = "/applications/#{params[:applicationId]}/flows"
|
300
|
-
|
301
|
-
@client.request(
|
302
|
-
method: :post,
|
303
|
-
path: path,
|
304
|
-
query: query_params,
|
305
|
-
headers: headers,
|
306
|
-
body: body)
|
307
|
-
end
|
308
|
-
|
309
|
-
end
|
310
|
-
end
|
data/lib/losant_rest/instance.rb
DELETED
@@ -1,377 +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 Instance Resource
|
28
|
-
class Instance
|
29
|
-
|
30
|
-
def initialize(client)
|
31
|
-
@client = client
|
32
|
-
end
|
33
|
-
|
34
|
-
# Returns device counts by day for the time range specified for this instance
|
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.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.deviceCounts.
|
41
|
-
#
|
42
|
-
# Parameters:
|
43
|
-
# * {string} instanceId - ID associated with the instance
|
44
|
-
# * {string} start - Start of range for device count query (ms since epoch)
|
45
|
-
# * {string} end - End of range for device count query (ms since epoch)
|
46
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
47
|
-
# * {boolean} _actions - Return resource actions in response
|
48
|
-
# * {boolean} _links - Return resource link in response
|
49
|
-
# * {boolean} _embedded - Return embedded resources in response
|
50
|
-
#
|
51
|
-
# Responses:
|
52
|
-
# * 200 - Device counts by day (https://api.losant.com/#/definitions/deviceCounts)
|
53
|
-
#
|
54
|
-
# Errors:
|
55
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
56
|
-
# * 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
|
57
|
-
def device_counts(params = {})
|
58
|
-
params = Utils.symbolize_hash_keys(params)
|
59
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
60
|
-
headers = {}
|
61
|
-
body = nil
|
62
|
-
|
63
|
-
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
64
|
-
|
65
|
-
query_params[:start] = params[:start] if params.has_key?(:start)
|
66
|
-
query_params[:end] = params[:end] if params.has_key?(:end)
|
67
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
68
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
69
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
70
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
71
|
-
|
72
|
-
path = "/instances/#{params[:instanceId]}/deviceCounts"
|
73
|
-
|
74
|
-
@client.request(
|
75
|
-
method: :get,
|
76
|
-
path: path,
|
77
|
-
query: query_params,
|
78
|
-
headers: headers,
|
79
|
-
body: body)
|
80
|
-
end
|
81
|
-
|
82
|
-
# Generates a CSV report on instance stats
|
83
|
-
#
|
84
|
-
# Authentication:
|
85
|
-
# The client must be configured with a valid api
|
86
|
-
# access token to call this action. The token
|
87
|
-
# must include at least one of the following scopes:
|
88
|
-
# all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.generateReport.
|
89
|
-
#
|
90
|
-
# Parameters:
|
91
|
-
# * {string} instanceId - ID associated with the instance
|
92
|
-
# * {hash} options - Object containing report configuration (https://api.losant.com/#/definitions/instanceReportOptionsPost)
|
93
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
94
|
-
# * {boolean} _actions - Return resource actions in response
|
95
|
-
# * {boolean} _links - Return resource link in response
|
96
|
-
# * {boolean} _embedded - Return embedded resources in response
|
97
|
-
#
|
98
|
-
# Responses:
|
99
|
-
# * 202 - If generation of report was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
100
|
-
#
|
101
|
-
# Errors:
|
102
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
103
|
-
def generate_report(params = {})
|
104
|
-
params = Utils.symbolize_hash_keys(params)
|
105
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
106
|
-
headers = {}
|
107
|
-
body = nil
|
108
|
-
|
109
|
-
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
110
|
-
|
111
|
-
body = params[:options] if params.has_key?(:options)
|
112
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
113
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
114
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
115
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
116
|
-
|
117
|
-
path = "/instances/#{params[:instanceId]}/generateReport"
|
118
|
-
|
119
|
-
@client.request(
|
120
|
-
method: :post,
|
121
|
-
path: path,
|
122
|
-
query: query_params,
|
123
|
-
headers: headers,
|
124
|
-
body: body)
|
125
|
-
end
|
126
|
-
|
127
|
-
# Returns an instance
|
128
|
-
#
|
129
|
-
# Authentication:
|
130
|
-
# The client must be configured with a valid api
|
131
|
-
# access token to call this action. The token
|
132
|
-
# must include at least one of the following scopes:
|
133
|
-
# all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.get.
|
134
|
-
#
|
135
|
-
# Parameters:
|
136
|
-
# * {string} instanceId - ID associated with the instance
|
137
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
138
|
-
# * {boolean} _actions - Return resource actions in response
|
139
|
-
# * {boolean} _links - Return resource link in response
|
140
|
-
# * {boolean} _embedded - Return embedded resources in response
|
141
|
-
#
|
142
|
-
# Responses:
|
143
|
-
# * 200 - A single instance (https://api.losant.com/#/definitions/instance)
|
144
|
-
#
|
145
|
-
# Errors:
|
146
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
147
|
-
# * 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
|
148
|
-
def get(params = {})
|
149
|
-
params = Utils.symbolize_hash_keys(params)
|
150
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
151
|
-
headers = {}
|
152
|
-
body = nil
|
153
|
-
|
154
|
-
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
155
|
-
|
156
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
157
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
158
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
159
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
160
|
-
|
161
|
-
path = "/instances/#{params[:instanceId]}"
|
162
|
-
|
163
|
-
@client.request(
|
164
|
-
method: :get,
|
165
|
-
path: path,
|
166
|
-
query: query_params,
|
167
|
-
headers: headers,
|
168
|
-
body: body)
|
169
|
-
end
|
170
|
-
|
171
|
-
# Return historical summary entries for an instance
|
172
|
-
#
|
173
|
-
# Authentication:
|
174
|
-
# The client must be configured with a valid api
|
175
|
-
# access token to call this action. The token
|
176
|
-
# must include at least one of the following scopes:
|
177
|
-
# all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.historicalSummaries.
|
178
|
-
#
|
179
|
-
# Parameters:
|
180
|
-
# * {string} instanceId - ID associated with the instance
|
181
|
-
# * {string} month - Timestamp within the month to report a summary for.
|
182
|
-
# * {string} sortField - Field to sort the results by. Accepted values are: resourceId, currentPeriodStart
|
183
|
-
# * {string} sortDirection - Direction to sort the results in. Accepted values are: asc, desc
|
184
|
-
# * {string} page - Which page of results to return
|
185
|
-
# * {string} perPage - How many items to return per page
|
186
|
-
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: resourceType, resourceId, ownerId, ownerType
|
187
|
-
# * {string} filter - Filter to apply against the filtered field. Blank or not provided means no filtering.
|
188
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
189
|
-
# * {boolean} _actions - Return resource actions in response
|
190
|
-
# * {boolean} _links - Return resource link in response
|
191
|
-
# * {boolean} _embedded - Return embedded resources in response
|
192
|
-
#
|
193
|
-
# Responses:
|
194
|
-
# * 200 - Collection of historical summaries (https://api.losant.com/#/definitions/historicalSummaries)
|
195
|
-
#
|
196
|
-
# Errors:
|
197
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
198
|
-
def historical_summaries(params = {})
|
199
|
-
params = Utils.symbolize_hash_keys(params)
|
200
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
201
|
-
headers = {}
|
202
|
-
body = nil
|
203
|
-
|
204
|
-
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
205
|
-
|
206
|
-
query_params[:month] = params[:month] if params.has_key?(:month)
|
207
|
-
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
208
|
-
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
209
|
-
query_params[:page] = params[:page] if params.has_key?(:page)
|
210
|
-
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
211
|
-
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
212
|
-
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
213
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
214
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
215
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
216
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
217
|
-
|
218
|
-
path = "/instances/#{params[:instanceId]}/historicalSummaries"
|
219
|
-
|
220
|
-
@client.request(
|
221
|
-
method: :get,
|
222
|
-
path: path,
|
223
|
-
query: query_params,
|
224
|
-
headers: headers,
|
225
|
-
body: body)
|
226
|
-
end
|
227
|
-
|
228
|
-
# Returns notebook execution usage by day for the time range specified for this instance
|
229
|
-
#
|
230
|
-
# Authentication:
|
231
|
-
# The client must be configured with a valid api
|
232
|
-
# access token to call this action. The token
|
233
|
-
# must include at least one of the following scopes:
|
234
|
-
# all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.notebookMinuteCounts.
|
235
|
-
#
|
236
|
-
# Parameters:
|
237
|
-
# * {string} instanceId - ID associated with the instance
|
238
|
-
# * {string} start - Start of range for notebook execution query (ms since epoch)
|
239
|
-
# * {string} end - End of range for notebook execution query (ms since epoch)
|
240
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
241
|
-
# * {boolean} _actions - Return resource actions in response
|
242
|
-
# * {boolean} _links - Return resource link in response
|
243
|
-
# * {boolean} _embedded - Return embedded resources in response
|
244
|
-
#
|
245
|
-
# Responses:
|
246
|
-
# * 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
|
247
|
-
#
|
248
|
-
# Errors:
|
249
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
250
|
-
# * 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
|
251
|
-
def notebook_minute_counts(params = {})
|
252
|
-
params = Utils.symbolize_hash_keys(params)
|
253
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
254
|
-
headers = {}
|
255
|
-
body = nil
|
256
|
-
|
257
|
-
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
258
|
-
|
259
|
-
query_params[:start] = params[:start] if params.has_key?(:start)
|
260
|
-
query_params[:end] = params[:end] if params.has_key?(:end)
|
261
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
262
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
263
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
264
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
265
|
-
|
266
|
-
path = "/instances/#{params[:instanceId]}/notebookMinuteCounts"
|
267
|
-
|
268
|
-
@client.request(
|
269
|
-
method: :get,
|
270
|
-
path: path,
|
271
|
-
query: query_params,
|
272
|
-
headers: headers,
|
273
|
-
body: body)
|
274
|
-
end
|
275
|
-
|
276
|
-
# Updates information about an instance
|
277
|
-
#
|
278
|
-
# Authentication:
|
279
|
-
# The client must be configured with a valid api
|
280
|
-
# access token to call this action. The token
|
281
|
-
# must include at least one of the following scopes:
|
282
|
-
# all.Instance, all.User, instance.*, or instance.patch.
|
283
|
-
#
|
284
|
-
# Parameters:
|
285
|
-
# * {string} instanceId - ID associated with the instance
|
286
|
-
# * {hash} instance - Updated instance information (https://api.losant.com/#/definitions/instancePatch)
|
287
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
288
|
-
# * {boolean} _actions - Return resource actions in response
|
289
|
-
# * {boolean} _links - Return resource link in response
|
290
|
-
# * {boolean} _embedded - Return embedded resources in response
|
291
|
-
#
|
292
|
-
# Responses:
|
293
|
-
# * 200 - The updated instance object (https://api.losant.com/#/definitions/instance)
|
294
|
-
#
|
295
|
-
# Errors:
|
296
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
297
|
-
def patch(params = {})
|
298
|
-
params = Utils.symbolize_hash_keys(params)
|
299
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
300
|
-
headers = {}
|
301
|
-
body = nil
|
302
|
-
|
303
|
-
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
304
|
-
raise ArgumentError.new("instance is required") unless params.has_key?(:instance)
|
305
|
-
|
306
|
-
body = params[:instance] if params.has_key?(:instance)
|
307
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
308
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
309
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
310
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
311
|
-
|
312
|
-
path = "/instances/#{params[:instanceId]}"
|
313
|
-
|
314
|
-
@client.request(
|
315
|
-
method: :patch,
|
316
|
-
path: path,
|
317
|
-
query: query_params,
|
318
|
-
headers: headers,
|
319
|
-
body: body)
|
320
|
-
end
|
321
|
-
|
322
|
-
# Returns payload counts per resolution in the time range specified for this instance
|
323
|
-
#
|
324
|
-
# Authentication:
|
325
|
-
# The client must be configured with a valid api
|
326
|
-
# access token to call this action. The token
|
327
|
-
# must include at least one of the following scopes:
|
328
|
-
# all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.payloadCountsBreakdown.
|
329
|
-
#
|
330
|
-
# Parameters:
|
331
|
-
# * {string} instanceId - ID associated with the instance
|
332
|
-
# * {string} start - Start of range for payload count query (ms since epoch)
|
333
|
-
# * {string} end - End of range for payload count query (ms since epoch)
|
334
|
-
# * {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
|
335
|
-
# * {string} asBytes - If the resulting stats should be returned as bytes
|
336
|
-
# * {string} includeNonBillable - If non-billable payloads should be included in the result
|
337
|
-
# * {string} losantdomain - Domain scope of request (rarely needed)
|
338
|
-
# * {boolean} _actions - Return resource actions in response
|
339
|
-
# * {boolean} _links - Return resource link in response
|
340
|
-
# * {boolean} _embedded - Return embedded resources in response
|
341
|
-
#
|
342
|
-
# Responses:
|
343
|
-
# * 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
|
344
|
-
#
|
345
|
-
# Errors:
|
346
|
-
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
347
|
-
# * 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
|
348
|
-
def payload_counts_breakdown(params = {})
|
349
|
-
params = Utils.symbolize_hash_keys(params)
|
350
|
-
query_params = { _actions: false, _links: true, _embedded: true }
|
351
|
-
headers = {}
|
352
|
-
body = nil
|
353
|
-
|
354
|
-
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
355
|
-
|
356
|
-
query_params[:start] = params[:start] if params.has_key?(:start)
|
357
|
-
query_params[:end] = params[:end] if params.has_key?(:end)
|
358
|
-
query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
|
359
|
-
query_params[:asBytes] = params[:asBytes] if params.has_key?(:asBytes)
|
360
|
-
query_params[:includeNonBillable] = params[:includeNonBillable] if params.has_key?(:includeNonBillable)
|
361
|
-
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
362
|
-
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
363
|
-
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
364
|
-
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
365
|
-
|
366
|
-
path = "/instances/#{params[:instanceId]}/payloadCountsBreakdown"
|
367
|
-
|
368
|
-
@client.request(
|
369
|
-
method: :get,
|
370
|
-
path: path,
|
371
|
-
query: query_params,
|
372
|
-
headers: headers,
|
373
|
-
body: body)
|
374
|
-
end
|
375
|
-
|
376
|
-
end
|
377
|
-
end
|