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
@@ -0,0 +1,182 @@
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 Org Invite Resource
28
+ class InstanceOrgInvite
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Revokes an instance org invitation
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, instanceOrgInvite.*, or instanceOrgInvite.delete.
41
+ #
42
+ # Parameters:
43
+ # * {string} instanceId - ID associated with the instance
44
+ # * {string} orgId - ID associated with the organization
45
+ # * {string} inviteId - ID associated with the organization invite
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 - If an invite was successfully deleted (https://api.losant.com/#/definitions/success)
53
+ #
54
+ # Errors:
55
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
56
+ # * 404 - Error if instance, organization or invite was not found (https://api.losant.com/#/definitions/error)
57
+ def delete(params = {})
58
+ params = Utils.symbolize_hash_keys(params)
59
+ query_params = { _actions: false, _links: true, _embedded: true }
60
+ headers = {}
61
+ body = nil
62
+
63
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
64
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
65
+ raise ArgumentError.new("inviteId is required") unless params.has_key?(:inviteId)
66
+
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]}/orgs/#{params[:orgId]}/invites/#{params[:inviteId]}"
73
+
74
+ @client.request(
75
+ method: :delete,
76
+ path: path,
77
+ query: query_params,
78
+ headers: headers,
79
+ body: body)
80
+ end
81
+
82
+ # Returns an organization invite
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, instanceOrgInvite.*, or instanceOrgInvite.get.
89
+ #
90
+ # Parameters:
91
+ # * {string} instanceId - ID associated with the instance
92
+ # * {string} orgId - ID associated with the organization
93
+ # * {string} inviteId - ID associated with the organization invite
94
+ # * {string} losantdomain - Domain scope of request (rarely needed)
95
+ # * {boolean} _actions - Return resource actions in response
96
+ # * {boolean} _links - Return resource link in response
97
+ # * {boolean} _embedded - Return embedded resources in response
98
+ #
99
+ # Responses:
100
+ # * 200 - A single organization invite (https://api.losant.com/#/definitions/orgInvite)
101
+ #
102
+ # Errors:
103
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
104
+ # * 404 - Error if instance, organization, or invite was not found (https://api.losant.com/#/definitions/error)
105
+ def get(params = {})
106
+ params = Utils.symbolize_hash_keys(params)
107
+ query_params = { _actions: false, _links: true, _embedded: true }
108
+ headers = {}
109
+ body = nil
110
+
111
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
112
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
113
+ raise ArgumentError.new("inviteId is required") unless params.has_key?(:inviteId)
114
+
115
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
116
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
117
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
118
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
119
+
120
+ path = "/instances/#{params[:instanceId]}/orgs/#{params[:orgId]}/invites/#{params[:inviteId]}"
121
+
122
+ @client.request(
123
+ method: :get,
124
+ path: path,
125
+ query: query_params,
126
+ headers: headers,
127
+ body: body)
128
+ end
129
+
130
+ # Resend an organization invite with modified role info
131
+ #
132
+ # Authentication:
133
+ # The client must be configured with a valid api
134
+ # access token to call this action. The token
135
+ # must include at least one of the following scopes:
136
+ # all.Instance, all.User, instanceOrgInvite.*, or instanceOrgInvite.resendInvite.
137
+ #
138
+ # Parameters:
139
+ # * {string} instanceId - ID associated with the instance
140
+ # * {string} orgId - ID associated with the organization
141
+ # * {string} inviteId - ID associated with the organization invite
142
+ # * {hash} roleInfo - Object containing updated role info (https://api.losant.com/#/definitions/orgRoleInfo)
143
+ # * {string} losantdomain - Domain scope of request (rarely needed)
144
+ # * {boolean} _actions - Return resource actions in response
145
+ # * {boolean} _links - Return resource link in response
146
+ # * {boolean} _embedded - Return embedded resources in response
147
+ #
148
+ # Responses:
149
+ # * 201 - The new org invite (https://api.losant.com/#/definitions/orgInvite)
150
+ #
151
+ # Errors:
152
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
153
+ # * 404 - Error if instance, organization, or invite was not found (https://api.losant.com/#/definitions/error)
154
+ def resend_invite(params = {})
155
+ params = Utils.symbolize_hash_keys(params)
156
+ query_params = { _actions: false, _links: true, _embedded: true }
157
+ headers = {}
158
+ body = nil
159
+
160
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
161
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
162
+ raise ArgumentError.new("inviteId is required") unless params.has_key?(:inviteId)
163
+ raise ArgumentError.new("roleInfo is required") unless params.has_key?(:roleInfo)
164
+
165
+ body = params[:roleInfo] if params.has_key?(:roleInfo)
166
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
167
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
168
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
169
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
170
+
171
+ path = "/instances/#{params[:instanceId]}/orgs/#{params[:orgId]}/invites/#{params[:inviteId]}"
172
+
173
+ @client.request(
174
+ method: :post,
175
+ path: path,
176
+ query: query_params,
177
+ headers: headers,
178
+ body: body)
179
+ end
180
+
181
+ end
182
+ end
@@ -0,0 +1,138 @@
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 Org Invites Resource
28
+ class InstanceOrgInvites
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Returns a collection of instance organization invites
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, instanceOrgInvites.*, or instanceOrgInvites.get.
41
+ #
42
+ # Parameters:
43
+ # * {string} instanceId - ID associated with the instance
44
+ # * {string} orgId - ID associated with the organization
45
+ # * {string} sortField - Field to sort the results by. Accepted values are: email, role, inviteDate
46
+ # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
47
+ # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: email, role
48
+ # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
49
+ # * {string} losantdomain - Domain scope of request (rarely needed)
50
+ # * {boolean} _actions - Return resource actions in response
51
+ # * {boolean} _links - Return resource link in response
52
+ # * {boolean} _embedded - Return embedded resources in response
53
+ #
54
+ # Responses:
55
+ # * 200 - A collection of instance organization invitations (https://api.losant.com/#/definitions/orgInviteCollection)
56
+ #
57
+ # Errors:
58
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
59
+ # * 404 - Error if instance or organization was not found (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
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
68
+
69
+ query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
70
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
71
+ query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
72
+ query_params[:filter] = params[:filter] if params.has_key?(:filter)
73
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
74
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
75
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
76
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
77
+
78
+ path = "/instances/#{params[:instanceId]}/orgs/#{params[:orgId]}/invites"
79
+
80
+ @client.request(
81
+ method: :get,
82
+ path: path,
83
+ query: query_params,
84
+ headers: headers,
85
+ body: body)
86
+ end
87
+
88
+ # Invites a member to an instance organization
89
+ #
90
+ # Authentication:
91
+ # The client must be configured with a valid api
92
+ # access token to call this action. The token
93
+ # must include at least one of the following scopes:
94
+ # all.Instance, all.User, instanceOrgInvites.*, or instanceOrgInvites.post.
95
+ #
96
+ # Parameters:
97
+ # * {string} instanceId - ID associated with the instance
98
+ # * {string} orgId - ID associated with the organization
99
+ # * {hash} invite - Object containing new invite info (https://api.losant.com/#/definitions/orgInvitePost)
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 new organization invite (https://api.losant.com/#/definitions/orgInviteCollection)
107
+ #
108
+ # Errors:
109
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
110
+ # * 404 - Error if instance or organization was not found (https://api.losant.com/#/definitions/error)
111
+ def post(params = {})
112
+ params = Utils.symbolize_hash_keys(params)
113
+ query_params = { _actions: false, _links: true, _embedded: true }
114
+ headers = {}
115
+ body = nil
116
+
117
+ raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
118
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
119
+ raise ArgumentError.new("invite is required") unless params.has_key?(:invite)
120
+
121
+ body = params[:invite] if params.has_key?(:invite)
122
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
123
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
124
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
125
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
126
+
127
+ path = "/instances/#{params[:instanceId]}/orgs/#{params[:orgId]}/invites"
128
+
129
+ @client.request(
130
+ method: :post,
131
+ path: path,
132
+ query: query_params,
133
+ headers: headers,
134
+ body: body)
135
+ end
136
+
137
+ end
138
+ 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 organization members
35
35
  #
36
36
  # Authentication:
37
37
  # The client must be configured with a valid api
@@ -41,7 +41,7 @@ module LosantRest
41
41
  #
42
42
  # Parameters:
43
43
  # * {string} instanceId - ID associated with the instance
44
- # * {string} orgId - ID associated with the instance
44
+ # * {string} orgId - ID associated with the organization
45
45
  # * {string} sortField - Field to sort the results by. Accepted values are: email, role
46
46
  # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
47
47
  # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: email, role
@@ -95,7 +95,7 @@ module LosantRest
95
95
  #
96
96
  # Parameters:
97
97
  # * {string} instanceId - ID associated with the instance
98
- # * {string} orgId - ID associated with the instance
98
+ # * {string} orgId - ID associated with the organization
99
99
  # * {hash} member - Object containing new member info (https://api.losant.com/#/definitions/instanceOrgMemberPost)
100
100
  # * {string} losantdomain - Domain scope of request (rarely needed)
101
101
  # * {boolean} _actions - Return resource actions in response
@@ -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
@@ -47,7 +47,6 @@ 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} summaryExclude - Comma-separated list of summary fields to exclude from org summaries
51
50
  # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
52
51
  # * {string} losantdomain - Domain scope of request (rarely needed)
53
52
  # * {boolean} _actions - Return resource actions in response
@@ -73,7 +72,6 @@ module LosantRest
73
72
  query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
74
73
  query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
75
74
  query_params[:filter] = params[:filter] if params.has_key?(:filter)
76
- query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
77
75
  query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
78
76
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
79
77
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
@@ -100,6 +98,7 @@ module LosantRest
100
98
  #
101
99
  # Parameters:
102
100
  # * {string} instanceId - ID associated with the instance
101
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
103
102
  # * {hash} orgConfig - Object containing configurations for the new organization (https://api.losant.com/#/definitions/instanceOrgPost)
104
103
  # * {string} losantdomain - Domain scope of request (rarely needed)
105
104
  # * {boolean} _actions - Return resource actions in response
@@ -119,6 +118,7 @@ module LosantRest
119
118
 
120
119
  raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
121
120
 
121
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
122
122
  body = params[:orgConfig] if params.has_key?(:orgConfig)
123
123
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
124
124
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
@@ -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
@@ -0,0 +1,170 @@
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 User Api Token Resource
28
+ class UserApiToken
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.User, userApiToken.*, or userApiToken.delete.
41
+ #
42
+ # Parameters:
43
+ # * {string} apiTokenId - ID associated with the API token
44
+ # * {string} losantdomain - Domain scope of request (rarely needed)
45
+ # * {boolean} _actions - Return resource actions in response
46
+ # * {boolean} _links - Return resource link in response
47
+ # * {boolean} _embedded - Return embedded resources in response
48
+ #
49
+ # Responses:
50
+ # * 200 - If API token was successfully deleted (https://api.losant.com/#/definitions/success)
51
+ #
52
+ # Errors:
53
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
54
+ # * 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
55
+ def delete(params = {})
56
+ params = Utils.symbolize_hash_keys(params)
57
+ query_params = { _actions: false, _links: true, _embedded: true }
58
+ headers = {}
59
+ body = nil
60
+
61
+ raise ArgumentError.new("apiTokenId is required") unless params.has_key?(:apiTokenId)
62
+
63
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
64
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
65
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
66
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
67
+
68
+ path = "/me/tokens/#{params[:apiTokenId]}"
69
+
70
+ @client.request(
71
+ method: :delete,
72
+ path: path,
73
+ query: query_params,
74
+ headers: headers,
75
+ body: body)
76
+ end
77
+
78
+ # Retrieves information on an API token
79
+ #
80
+ # Authentication:
81
+ # The client must be configured with a valid api
82
+ # access token to call this action. The token
83
+ # must include at least one of the following scopes:
84
+ # all.User, all.User.read, userApiToken.*, or userApiToken.get.
85
+ #
86
+ # Parameters:
87
+ # * {string} apiTokenId - ID associated with the API token
88
+ # * {string} losantdomain - Domain scope of request (rarely needed)
89
+ # * {boolean} _actions - Return resource actions in response
90
+ # * {boolean} _links - Return resource link in response
91
+ # * {boolean} _embedded - Return embedded resources in response
92
+ #
93
+ # Responses:
94
+ # * 200 - API token information (https://api.losant.com/#/definitions/apiToken)
95
+ #
96
+ # Errors:
97
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
98
+ # * 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
99
+ def get(params = {})
100
+ params = Utils.symbolize_hash_keys(params)
101
+ query_params = { _actions: false, _links: true, _embedded: true }
102
+ headers = {}
103
+ body = nil
104
+
105
+ raise ArgumentError.new("apiTokenId is required") unless params.has_key?(:apiTokenId)
106
+
107
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
108
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
109
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
110
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
111
+
112
+ path = "/me/tokens/#{params[:apiTokenId]}"
113
+
114
+ @client.request(
115
+ method: :get,
116
+ path: path,
117
+ query: query_params,
118
+ headers: headers,
119
+ body: body)
120
+ end
121
+
122
+ # Updates information about an API token
123
+ #
124
+ # Authentication:
125
+ # The client must be configured with a valid api
126
+ # access token to call this action. The token
127
+ # must include at least one of the following scopes:
128
+ # all.User, userApiToken.*, or userApiToken.patch.
129
+ #
130
+ # Parameters:
131
+ # * {string} apiTokenId - ID associated with the API token
132
+ # * {hash} apiToken - Object containing new properties of the API token (https://api.losant.com/#/definitions/apiTokenPatch)
133
+ # * {string} losantdomain - Domain scope of request (rarely needed)
134
+ # * {boolean} _actions - Return resource actions in response
135
+ # * {boolean} _links - Return resource link in response
136
+ # * {boolean} _embedded - Return embedded resources in response
137
+ #
138
+ # Responses:
139
+ # * 200 - Updated API token information (https://api.losant.com/#/definitions/apiToken)
140
+ #
141
+ # Errors:
142
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
143
+ # * 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
144
+ def patch(params = {})
145
+ params = Utils.symbolize_hash_keys(params)
146
+ query_params = { _actions: false, _links: true, _embedded: true }
147
+ headers = {}
148
+ body = nil
149
+
150
+ raise ArgumentError.new("apiTokenId is required") unless params.has_key?(:apiTokenId)
151
+ raise ArgumentError.new("apiToken is required") unless params.has_key?(:apiToken)
152
+
153
+ body = params[:apiToken] if params.has_key?(:apiToken)
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 = "/me/tokens/#{params[:apiTokenId]}"
160
+
161
+ @client.request(
162
+ method: :patch,
163
+ path: path,
164
+ query: query_params,
165
+ headers: headers,
166
+ body: body)
167
+ end
168
+
169
+ end
170
+ end