losant_rest 1.13.0 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. data/docs/_schemas.md +19437 -10622
  3. data/docs/application.md +6 -6
  4. data/docs/applicationApiTokens.md +1 -1
  5. data/docs/applications.md +1 -1
  6. data/docs/dataTable.md +1 -1
  7. data/docs/dataTableRows.md +1 -1
  8. data/docs/dataTables.md +1 -1
  9. data/docs/device.md +43 -0
  10. data/docs/devices.md +41 -2
  11. data/docs/edgeDeployment.md +49 -0
  12. data/docs/embeddedDeployment.md +49 -0
  13. data/docs/embeddedDeployments.md +215 -0
  14. data/docs/experience.md +1 -1
  15. data/docs/experienceDomains.md +1 -1
  16. data/docs/experienceGroup.md +2 -0
  17. data/docs/experienceSlugs.md +1 -1
  18. data/docs/experienceVersion.md +3 -3
  19. data/docs/experienceVersions.md +2 -2
  20. data/docs/experienceView.md +4 -4
  21. data/docs/experienceViews.md +2 -2
  22. data/docs/file.md +5 -5
  23. data/docs/files.md +2 -2
  24. data/docs/flow.md +3 -3
  25. data/docs/flowVersions.md +44 -0
  26. data/docs/flows.md +2 -2
  27. data/docs/instance.md +40 -0
  28. data/docs/instanceApiToken.md +133 -0
  29. data/docs/instanceApiTokens.md +91 -0
  30. data/docs/instanceMembers.md +1 -1
  31. data/docs/instanceOrg.md +2 -0
  32. data/docs/instanceOrgInvite.md +139 -0
  33. data/docs/instanceOrgInvites.md +96 -0
  34. data/docs/instanceOrgMembers.md +3 -3
  35. data/docs/instanceOrgs.md +1 -1
  36. data/docs/me.md +1 -1
  37. data/docs/org.md +1 -1
  38. data/docs/userApiToken.md +125 -0
  39. data/docs/userApiTokens.md +87 -0
  40. data/lib/losant_rest/application.rb +5 -5
  41. data/lib/losant_rest/application_api_tokens.rb +1 -1
  42. data/lib/losant_rest/applications.rb +1 -1
  43. data/lib/losant_rest/client.rb +38 -2
  44. data/lib/losant_rest/data_table.rb +1 -1
  45. data/lib/losant_rest/data_table_rows.rb +1 -1
  46. data/lib/losant_rest/data_tables.rb +1 -1
  47. data/lib/losant_rest/device.rb +50 -0
  48. data/lib/losant_rest/devices.rb +48 -2
  49. data/lib/losant_rest/edge_deployment.rb +81 -0
  50. data/lib/losant_rest/embedded_deployment.rb +81 -0
  51. data/lib/losant_rest/embedded_deployments.rb +280 -0
  52. data/lib/losant_rest/experience.rb +1 -1
  53. data/lib/losant_rest/experience_domains.rb +1 -1
  54. data/lib/losant_rest/experience_group.rb +4 -0
  55. data/lib/losant_rest/experience_slugs.rb +1 -1
  56. data/lib/losant_rest/experience_version.rb +3 -3
  57. data/lib/losant_rest/experience_versions.rb +2 -2
  58. data/lib/losant_rest/experience_view.rb +4 -4
  59. data/lib/losant_rest/experience_views.rb +2 -2
  60. data/lib/losant_rest/file.rb +4 -4
  61. data/lib/losant_rest/files.rb +2 -2
  62. data/lib/losant_rest/flow.rb +3 -3
  63. data/lib/losant_rest/flow_versions.rb +50 -0
  64. data/lib/losant_rest/flows.rb +2 -2
  65. data/lib/losant_rest/instance.rb +47 -1
  66. data/lib/losant_rest/instance_api_token.rb +176 -0
  67. data/lib/losant_rest/instance_api_tokens.rb +136 -0
  68. data/lib/losant_rest/instance_member.rb +1 -1
  69. data/lib/losant_rest/instance_members.rb +2 -2
  70. data/lib/losant_rest/instance_org.rb +5 -1
  71. data/lib/losant_rest/instance_org_invite.rb +182 -0
  72. data/lib/losant_rest/instance_org_invites.rb +138 -0
  73. data/lib/losant_rest/instance_org_member.rb +1 -1
  74. data/lib/losant_rest/instance_org_members.rb +4 -4
  75. data/lib/losant_rest/instance_orgs.rb +3 -3
  76. data/lib/losant_rest/instances.rb +1 -1
  77. data/lib/losant_rest/user_api_token.rb +170 -0
  78. data/lib/losant_rest/user_api_tokens.rb +132 -0
  79. data/lib/losant_rest/version.rb +1 -1
  80. data/lib/losant_rest.rb +9 -0
  81. data/schemas/apiToken.json +2 -1
  82. data/schemas/apiTokenPost.json +439 -0
  83. data/schemas/apiTokens.json +4 -2
  84. data/schemas/application.json +32 -32
  85. data/schemas/applicationCreationByTemplateResult.json +32 -32
  86. data/schemas/applicationDashboardPost.json +28 -21
  87. data/schemas/applicationPatch.json +13 -13
  88. data/schemas/applicationPost.json +13 -13
  89. data/schemas/applicationTemplate.json +16 -16
  90. data/schemas/applicationTemplates.json +16 -16
  91. data/schemas/applications.json +32 -32
  92. data/schemas/auditLog.json +4 -0
  93. data/schemas/auditLogFilter.json +4 -0
  94. data/schemas/auditLogs.json +4 -0
  95. data/schemas/authedDevice.json +2 -1
  96. data/schemas/bulkDeleteResponse.json +12 -0
  97. data/schemas/dashboard.json +28 -21
  98. data/schemas/dashboardPatch.json +28 -21
  99. data/schemas/dashboardPost.json +28 -21
  100. data/schemas/dashboardSendReport.json +9 -5
  101. data/schemas/dashboards.json +28 -21
  102. data/schemas/dataTableRowsDelete.json +1 -1
  103. data/schemas/device.json +2 -1
  104. data/schemas/deviceClassFilter.json +4 -2
  105. data/schemas/devicePatch.json +2 -1
  106. data/schemas/devicePayloadCounts.json +24 -0
  107. data/schemas/devicePost.json +2 -1
  108. data/schemas/deviceRecipe.json +2 -1
  109. data/schemas/deviceRecipePatch.json +2 -1
  110. data/schemas/deviceRecipePost.json +2 -1
  111. data/schemas/deviceRecipes.json +2 -1
  112. data/schemas/devices.json +4 -2
  113. data/schemas/devicesExportPayloadCountPost.json +1350 -0
  114. data/schemas/devicesPatch.json +4 -2
  115. data/schemas/edgeDeployment.json +20 -0
  116. data/schemas/edgeDeployments.json +20 -0
  117. data/schemas/embeddedDeployment.json +179 -0
  118. data/schemas/embeddedDeploymentExport.json +44 -0
  119. data/schemas/embeddedDeploymentRelease.json +58 -0
  120. data/schemas/embeddedDeploymentRemove.json +25 -0
  121. data/schemas/embeddedDeploymentReplace.json +29 -0
  122. data/schemas/embeddedDeployments.json +212 -0
  123. data/schemas/eventsDeleted.json +1 -1
  124. data/schemas/experienceEndpoint.json +6 -8
  125. data/schemas/experienceEndpointPatch.json +6 -8
  126. data/schemas/experienceEndpointPost.json +6 -8
  127. data/schemas/experienceEndpoints.json +6 -8
  128. data/schemas/experienceGroup.json +6 -0
  129. data/schemas/experienceGroups.json +6 -0
  130. data/schemas/experienceLinkedResources.json +790 -85
  131. data/schemas/flow.json +252 -16
  132. data/schemas/flowPatch.json +251 -16
  133. data/schemas/flowPost.json +252 -16
  134. data/schemas/flowVersion.json +503 -33
  135. data/schemas/flowVersionPost.json +251 -16
  136. data/schemas/flowVersions.json +503 -33
  137. data/schemas/flowVersionsDeletePost.json +941 -0
  138. data/schemas/flows.json +253 -16
  139. data/schemas/flowsImportPost.json +503 -32
  140. data/schemas/flowsImportResult.json +785 -79
  141. data/schemas/githubLogin.json +38 -1
  142. data/schemas/historicalSummary.json +150 -102
  143. data/schemas/instance.json +150 -77
  144. data/schemas/instanceMember.json +10 -0
  145. data/schemas/instanceMemberPost.json +18 -3
  146. data/schemas/instanceMembers.json +14 -0
  147. data/schemas/instanceOrg.json +87 -74
  148. data/schemas/instanceOrgMember.json +14 -0
  149. data/schemas/instanceOrgMembers.json +8 -0
  150. data/schemas/instanceOrgPatch.json +64 -26
  151. data/schemas/instanceOrgPost.json +229 -25
  152. data/schemas/instanceOrgs.json +91 -74
  153. data/schemas/instancePatch.json +67 -0
  154. data/schemas/instanceReportOptionsPost.json +1 -0
  155. data/schemas/me.json +134 -105
  156. data/schemas/notebook.json +45 -0
  157. data/schemas/notebookPatch.json +30 -0
  158. data/schemas/notebookPost.json +30 -0
  159. data/schemas/notebooks.json +45 -0
  160. data/schemas/org.json +145 -110
  161. data/schemas/orgInvite.json +90 -0
  162. data/schemas/orgInviteCollection.json +130 -0
  163. data/schemas/orgInvites.json +82 -77
  164. data/schemas/orgRoleInfo.json +69 -0
  165. data/schemas/orgs.json +145 -110
  166. data/schemas/payloadStats.json +28 -12
  167. data/schemas/userCredentials.json +38 -1
  168. data/schemas/userPost.json +38 -1
  169. data/schemas/validateContextError.json +34 -0
  170. data/schemas/validateContextSuccess.json +34 -0
  171. data/schemas/virtualButtonPress.json +4 -0
  172. metadata +39 -6
@@ -37,7 +37,7 @@ module LosantRest
37
37
  # The client must be configured with a valid api
38
38
  # access token to call this action. The token
39
39
  # must include at least one of the following scopes:
40
- # all.Application, all.Organization, all.User, file.*, or file.delete.
40
+ # all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.delete.
41
41
  #
42
42
  # Parameters:
43
43
  # * {string} applicationId - ID associated with the application
@@ -83,7 +83,7 @@ module LosantRest
83
83
  # The client must be configured with a valid api
84
84
  # access token to call this action. The token
85
85
  # must include at least one of the following scopes:
86
- # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, file.*, or file.get.
86
+ # all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, file.*, or file.get.
87
87
  #
88
88
  # Parameters:
89
89
  # * {string} applicationId - ID associated with the application
@@ -129,7 +129,7 @@ module LosantRest
129
129
  # The client must be configured with a valid api
130
130
  # access token to call this action. The token
131
131
  # must include at least one of the following scopes:
132
- # all.Application, all.Organization, all.User, file.*, or file.move.
132
+ # all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.move.
133
133
  #
134
134
  # Parameters:
135
135
  # * {string} applicationId - ID associated with the application
@@ -179,7 +179,7 @@ module LosantRest
179
179
  # The client must be configured with a valid api
180
180
  # access token to call this action. The token
181
181
  # must include at least one of the following scopes:
182
- # all.Application, all.Organization, all.User, file.*, or file.patch.
182
+ # all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.patch.
183
183
  #
184
184
  # Parameters:
185
185
  # * {string} applicationId - ID associated with the application
@@ -37,7 +37,7 @@ module LosantRest
37
37
  # The client must be configured with a valid api
38
38
  # access token to call this action. The token
39
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, files.*, or files.get.
40
+ # all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, files.*, or files.get.
41
41
  #
42
42
  # Parameters:
43
43
  # * {string} applicationId - ID associated with the application
@@ -99,7 +99,7 @@ module LosantRest
99
99
  # The client must be configured with a valid api
100
100
  # access token to call this action. The token
101
101
  # must include at least one of the following scopes:
102
- # all.Application, all.Organization, all.User, files.*, or files.post.
102
+ # all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, files.*, or files.post.
103
103
  #
104
104
  # Parameters:
105
105
  # * {string} applicationId - ID associated with the application
@@ -139,7 +139,7 @@ module LosantRest
139
139
  # * {string} limit - Maximum number of errors to return
140
140
  # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
141
141
  # * {string} flowVersion - Flow version name or ID. When not included, will be errors for all versions. Pass develop for just the develop version.
142
- # * {string} deviceId - For edge workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs.
142
+ # * {string} deviceId - For edge or embedded workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs.
143
143
  # * {string} losantdomain - Domain scope of request (rarely needed)
144
144
  # * {boolean} _actions - Return resource actions in response
145
145
  # * {boolean} _links - Return resource link in response
@@ -331,7 +331,7 @@ module LosantRest
331
331
  # The client must be configured with a valid api
332
332
  # access token to call this action. The token
333
333
  # must include at least one of the following scopes:
334
- # all.Application, all.Organization, all.User, flow.*, or flow.getStorageEntriesMetadata.
334
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.getStorageEntriesMetadata.
335
335
  #
336
336
  # Parameters:
337
337
  # * {string} applicationId - ID associated with the application
@@ -535,7 +535,7 @@ module LosantRest
535
535
  # * {string} end - End of time range in milliseconds since epoch
536
536
  # * {string} resolution - Resolution in milliseconds
537
537
  # * {string} flowVersion - Flow version name or ID. When not included, will be aggregate for all versions. Pass develop for just the develop version.
538
- # * {string} deviceId - For edge workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs.
538
+ # * {string} deviceId - For edge or embedded workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs.
539
539
  # * {string} losantdomain - Domain scope of request (rarely needed)
540
540
  # * {boolean} _actions - Return resource actions in response
541
541
  # * {boolean} _links - Return resource link in response
@@ -31,6 +31,56 @@ module LosantRest
31
31
  @client = client
32
32
  end
33
33
 
34
+ # Delete flow versions
35
+ #
36
+ # Authentication:
37
+ # The client must be configured with a valid api
38
+ # access token to call this action. The token
39
+ # must include at least one of the following scopes:
40
+ # all.Application, all.Organization, all.User, flowVersions.*, or flowVersions.delete.
41
+ #
42
+ # Parameters:
43
+ # * {string} applicationId - ID associated with the application
44
+ # * {string} flowId - ID associated with the flow
45
+ # * {hash} options - Object containing flow version deletion options (https://api.losant.com/#/definitions/flowVersionsDeletePost)
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 - Object indicating number of flow versions deleted or failed (https://api.losant.com/#/definitions/bulkDeleteResponse)
53
+ # * 202 - If a job was enqueued for the flow versions to be deleted (https://api.losant.com/#/definitions/jobEnqueuedResult)
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 delete(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
+ raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
66
+ raise ArgumentError.new("options is required") unless params.has_key?(:options)
67
+
68
+ body = params[:options] if params.has_key?(:options)
69
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
70
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
71
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
72
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
73
+
74
+ path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/versions/delete"
75
+
76
+ @client.request(
77
+ method: :post,
78
+ path: path,
79
+ query: query_params,
80
+ headers: headers,
81
+ body: body)
82
+ end
83
+
34
84
  # Returns the flow versions for a flow
35
85
  #
36
86
  # Authentication:
@@ -47,7 +47,7 @@ module LosantRest
47
47
  # * {string} perPage - How many items to return per page
48
48
  # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
49
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, cloud, customNode, experience
50
+ # * {string} flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
51
51
  # * {hash} triggerFilter - Array of triggers to filter by - always filters against default flow version. (https://api.losant.com/#/definitions/flowTriggerFilter)
52
52
  # * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
53
53
  # * {hash} query - Workflow filter JSON object which overrides the filterField, filter, triggerFilter, and flowClass parameters. (https://api.losant.com/#/definitions/advancedFlowQuery)
@@ -114,7 +114,7 @@ module LosantRest
114
114
  # * {string} perPage - How many items to return per page
115
115
  # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
116
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, cloud, customNode, experience
117
+ # * {string} flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
118
118
  # * {string} version - Return the workflow versions for the given version.
119
119
  # * {hash} triggerFilter - Array of triggers to filter by - always filters against default flow version. (https://api.losant.com/#/definitions/flowTriggerFilter)
120
120
  # * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
@@ -1,6 +1,6 @@
1
1
  # The MIT License (MIT)
2
2
  #
3
- # Copyright (c) 2020 Losant IoT, Inc.
3
+ # Copyright (c) 2021 Losant IoT, Inc.
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -177,5 +177,51 @@ module LosantRest
177
177
  body: body)
178
178
  end
179
179
 
180
+ # Updates information about an instance
181
+ #
182
+ # Authentication:
183
+ # The client must be configured with a valid api
184
+ # access token to call this action. The token
185
+ # must include at least one of the following scopes:
186
+ # all.Instance, all.User, instance.*, or instance.patch.
187
+ #
188
+ # Parameters:
189
+ # * {string} instanceId - ID associated with the instance
190
+ # * {hash} instance - Updated instance information (https://api.losant.com/#/definitions/instancePatch)
191
+ # * {string} losantdomain - Domain scope of request (rarely needed)
192
+ # * {boolean} _actions - Return resource actions in response
193
+ # * {boolean} _links - Return resource link in response
194
+ # * {boolean} _embedded - Return embedded resources in response
195
+ #
196
+ # Responses:
197
+ # * 200 - The updated instance object (https://api.losant.com/#/definitions/instance)
198
+ #
199
+ # Errors:
200
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
201
+ def patch(params = {})
202
+ params = Utils.symbolize_hash_keys(params)
203
+ query_params = { _actions: false, _links: true, _embedded: true }
204
+ headers = {}
205
+ body = nil
206
+
207
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
208
+ raise ArgumentError.new("instance is required") unless params.has_key?(:instance)
209
+
210
+ body = params[:instance] if params.has_key?(:instance)
211
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
212
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
213
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
214
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
215
+
216
+ path = "/instances/#{params[:instanceId]}"
217
+
218
+ @client.request(
219
+ method: :patch,
220
+ path: path,
221
+ query: query_params,
222
+ headers: headers,
223
+ body: body)
224
+ end
225
+
180
226
  end
181
227
  end
@@ -0,0 +1,176 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2021 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 Api Token Resource
28
+ class InstanceApiToken
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Deletes an API Token
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.User, instanceApiToken.*, or instanceApiToken.delete.
41
+ #
42
+ # Parameters:
43
+ # * {string} instanceId - ID associated with the instance
44
+ # * {string} apiTokenId - ID associated with the API token
45
+ # * {string} losantdomain - Domain scope of request (rarely needed)
46
+ # * {boolean} _actions - Return resource actions in response
47
+ # * {boolean} _links - Return resource link in response
48
+ # * {boolean} _embedded - Return embedded resources in response
49
+ #
50
+ # Responses:
51
+ # * 200 - If API token was successfully deleted (https://api.losant.com/#/definitions/success)
52
+ #
53
+ # Errors:
54
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
55
+ # * 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
56
+ def delete(params = {})
57
+ params = Utils.symbolize_hash_keys(params)
58
+ query_params = { _actions: false, _links: true, _embedded: true }
59
+ headers = {}
60
+ body = nil
61
+
62
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
63
+ raise ArgumentError.new("apiTokenId is required") unless params.has_key?(:apiTokenId)
64
+
65
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
66
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
67
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
68
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
69
+
70
+ path = "/instances/#{params[:instanceId]}/tokens/#{params[:apiTokenId]}"
71
+
72
+ @client.request(
73
+ method: :delete,
74
+ path: path,
75
+ query: query_params,
76
+ headers: headers,
77
+ body: body)
78
+ end
79
+
80
+ # Retrieves information on an API token
81
+ #
82
+ # Authentication:
83
+ # The client must be configured with a valid api
84
+ # access token to call this action. The token
85
+ # must include at least one of the following scopes:
86
+ # all.Instance, all.Instance.read, all.User, all.User.read, instanceApiToken.*, or instanceApiToken.get.
87
+ #
88
+ # Parameters:
89
+ # * {string} instanceId - ID associated with the instance
90
+ # * {string} apiTokenId - ID associated with the API token
91
+ # * {string} losantdomain - Domain scope of request (rarely needed)
92
+ # * {boolean} _actions - Return resource actions in response
93
+ # * {boolean} _links - Return resource link in response
94
+ # * {boolean} _embedded - Return embedded resources in response
95
+ #
96
+ # Responses:
97
+ # * 200 - API token information (https://api.losant.com/#/definitions/apiToken)
98
+ #
99
+ # Errors:
100
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
101
+ # * 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
102
+ def get(params = {})
103
+ params = Utils.symbolize_hash_keys(params)
104
+ query_params = { _actions: false, _links: true, _embedded: true }
105
+ headers = {}
106
+ body = nil
107
+
108
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
109
+ raise ArgumentError.new("apiTokenId is required") unless params.has_key?(:apiTokenId)
110
+
111
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
112
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
113
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
114
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
115
+
116
+ path = "/instances/#{params[:instanceId]}/tokens/#{params[:apiTokenId]}"
117
+
118
+ @client.request(
119
+ method: :get,
120
+ path: path,
121
+ query: query_params,
122
+ headers: headers,
123
+ body: body)
124
+ end
125
+
126
+ # Updates information about an API token
127
+ #
128
+ # Authentication:
129
+ # The client must be configured with a valid api
130
+ # access token to call this action. The token
131
+ # must include at least one of the following scopes:
132
+ # all.Instance, all.User, instanceApiToken.*, or instanceApiToken.patch.
133
+ #
134
+ # Parameters:
135
+ # * {string} instanceId - ID associated with the instance
136
+ # * {string} apiTokenId - ID associated with the API token
137
+ # * {hash} apiToken - Object containing new properties of the API token (https://api.losant.com/#/definitions/apiTokenPatch)
138
+ # * {string} losantdomain - Domain scope of request (rarely needed)
139
+ # * {boolean} _actions - Return resource actions in response
140
+ # * {boolean} _links - Return resource link in response
141
+ # * {boolean} _embedded - Return embedded resources in response
142
+ #
143
+ # Responses:
144
+ # * 200 - Updated API token information (https://api.losant.com/#/definitions/apiToken)
145
+ #
146
+ # Errors:
147
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
148
+ # * 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
149
+ def patch(params = {})
150
+ params = Utils.symbolize_hash_keys(params)
151
+ query_params = { _actions: false, _links: true, _embedded: true }
152
+ headers = {}
153
+ body = nil
154
+
155
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
156
+ raise ArgumentError.new("apiTokenId is required") unless params.has_key?(:apiTokenId)
157
+ raise ArgumentError.new("apiToken is required") unless params.has_key?(:apiToken)
158
+
159
+ body = params[:apiToken] if params.has_key?(:apiToken)
160
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
161
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
162
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
163
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
164
+
165
+ path = "/instances/#{params[:instanceId]}/tokens/#{params[:apiTokenId]}"
166
+
167
+ @client.request(
168
+ method: :patch,
169
+ path: path,
170
+ query: query_params,
171
+ headers: headers,
172
+ body: body)
173
+ end
174
+
175
+ end
176
+ end
@@ -0,0 +1,136 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2021 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 Api Tokens Resource
28
+ class InstanceApiTokens
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Returns the API tokens for an 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, instanceApiTokens.*, or instanceApiTokens.get.
41
+ #
42
+ # Parameters:
43
+ # * {string} instanceId - ID associated with the instance
44
+ # * {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated, expirationDate
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, status
49
+ # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
50
+ # * {string} losantdomain - Domain scope of request (rarely needed)
51
+ # * {boolean} _actions - Return resource actions in response
52
+ # * {boolean} _links - Return resource link in response
53
+ # * {boolean} _embedded - Return embedded resources in response
54
+ #
55
+ # Responses:
56
+ # * 200 - Collection of API tokens (https://api.losant.com/#/definitions/apiToken)
57
+ #
58
+ # Errors:
59
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
60
+ def get(params = {})
61
+ params = Utils.symbolize_hash_keys(params)
62
+ query_params = { _actions: false, _links: true, _embedded: true }
63
+ headers = {}
64
+ body = nil
65
+
66
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
67
+
68
+ query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
69
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
70
+ query_params[:page] = params[:page] if params.has_key?(:page)
71
+ query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
72
+ query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
73
+ query_params[:filter] = params[:filter] if params.has_key?(:filter)
74
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
75
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
76
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
77
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
78
+
79
+ path = "/instances/#{params[:instanceId]}/tokens"
80
+
81
+ @client.request(
82
+ method: :get,
83
+ path: path,
84
+ query: query_params,
85
+ headers: headers,
86
+ body: body)
87
+ end
88
+
89
+ # Create a new API token for an instance
90
+ #
91
+ # Authentication:
92
+ # The client must be configured with a valid api
93
+ # access token to call this action. The token
94
+ # must include at least one of the following scopes:
95
+ # all.Instance, all.User, instanceApiTokens.*, or instanceApiTokens.post.
96
+ #
97
+ # Parameters:
98
+ # * {string} instanceId - ID associated with the instance
99
+ # * {hash} apiToken - API token information (https://api.losant.com/#/definitions/apiTokenPost)
100
+ # * {string} losantdomain - Domain scope of request (rarely needed)
101
+ # * {boolean} _actions - Return resource actions in response
102
+ # * {boolean} _links - Return resource link in response
103
+ # * {boolean} _embedded - Return embedded resources in response
104
+ #
105
+ # Responses:
106
+ # * 201 - The successfully created API token (https://api.losant.com/#/definitions/apiToken)
107
+ #
108
+ # Errors:
109
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
110
+ def post(params = {})
111
+ params = Utils.symbolize_hash_keys(params)
112
+ query_params = { _actions: false, _links: true, _embedded: true }
113
+ headers = {}
114
+ body = nil
115
+
116
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
117
+ raise ArgumentError.new("apiToken is required") unless params.has_key?(:apiToken)
118
+
119
+ body = params[:apiToken] if params.has_key?(:apiToken)
120
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
121
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
122
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
123
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
124
+
125
+ path = "/instances/#{params[:instanceId]}/tokens"
126
+
127
+ @client.request(
128
+ method: :post,
129
+ path: path,
130
+ query: query_params,
131
+ headers: headers,
132
+ body: body)
133
+ end
134
+
135
+ end
136
+ end
@@ -1,6 +1,6 @@
1
1
  # The MIT License (MIT)
2
2
  #
3
- # Copyright (c) 2020 Losant IoT, Inc.
3
+ # Copyright (c) 2021 Losant IoT, Inc.
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  # The MIT License (MIT)
2
2
  #
3
- # Copyright (c) 2020 Losant IoT, Inc.
3
+ # Copyright (c) 2021 Losant IoT, Inc.
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -31,7 +31,7 @@ module LosantRest
31
31
  @client = client
32
32
  end
33
33
 
34
- # Returns an instance member
34
+ # Returns a collection of instance members
35
35
  #
36
36
  # Authentication:
37
37
  # The client must be configured with a valid api
@@ -1,6 +1,6 @@
1
1
  # The MIT License (MIT)
2
2
  #
3
- # Copyright (c) 2020 Losant IoT, Inc.
3
+ # Copyright (c) 2021 Losant IoT, Inc.
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -88,6 +88,7 @@ module LosantRest
88
88
  # Parameters:
89
89
  # * {string} instanceId - ID associated with the instance
90
90
  # * {string} orgId - ID associated with the organization
91
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
91
92
  # * {string} losantdomain - Domain scope of request (rarely needed)
92
93
  # * {boolean} _actions - Return resource actions in response
93
94
  # * {boolean} _links - Return resource link in response
@@ -108,6 +109,7 @@ module LosantRest
108
109
  raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
109
110
  raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
110
111
 
112
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
111
113
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
112
114
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
113
115
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -134,6 +136,7 @@ module LosantRest
134
136
  # Parameters:
135
137
  # * {string} instanceId - ID associated with the instance
136
138
  # * {string} orgId - ID associated with the organization
139
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
137
140
  # * {hash} organization - Object containing new organization properties (https://api.losant.com/#/definitions/instanceOrgPatch)
138
141
  # * {string} losantdomain - Domain scope of request (rarely needed)
139
142
  # * {boolean} _actions - Return resource actions in response
@@ -156,6 +159,7 @@ module LosantRest
156
159
  raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
157
160
  raise ArgumentError.new("organization is required") unless params.has_key?(:organization)
158
161
 
162
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
159
163
  body = params[:organization] if params.has_key?(:organization)
160
164
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
161
165
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)