losant_rest 1.19.0 → 1.19.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/docs/_schemas.md +872 -38
  3. data/docs/applications.md +49 -0
  4. data/docs/device.md +12 -3
  5. data/docs/me.md +116 -0
  6. data/lib/losant_rest/version.rb +1 -1
  7. data/lib/platform_rest/application.rb +932 -0
  8. data/lib/platform_rest/application_api_token.rb +176 -0
  9. data/lib/platform_rest/application_api_tokens.rb +136 -0
  10. data/lib/platform_rest/application_certificate.rb +176 -0
  11. data/lib/platform_rest/application_certificate_authorities.rb +138 -0
  12. data/lib/platform_rest/application_certificate_authority.rb +176 -0
  13. data/lib/platform_rest/application_certificates.rb +138 -0
  14. data/lib/platform_rest/application_dashboard.rb +225 -0
  15. data/lib/platform_rest/application_dashboards.rb +138 -0
  16. data/lib/platform_rest/application_key.rb +176 -0
  17. data/lib/platform_rest/application_keys.rb +141 -0
  18. data/lib/platform_rest/application_template.rb +79 -0
  19. data/lib/platform_rest/application_templates.rb +176 -0
  20. data/lib/platform_rest/applications.rb +209 -0
  21. data/lib/platform_rest/audit_log.rb +81 -0
  22. data/lib/platform_rest/audit_logs.rb +93 -0
  23. data/lib/platform_rest/auth.rb +245 -0
  24. data/lib/platform_rest/client.rb +410 -0
  25. data/lib/platform_rest/credential.rb +224 -0
  26. data/lib/platform_rest/credentials.rb +138 -0
  27. data/lib/platform_rest/dashboard.rb +268 -0
  28. data/lib/platform_rest/dashboards.rb +136 -0
  29. data/lib/platform_rest/data.rb +176 -0
  30. data/lib/platform_rest/data_table.rb +274 -0
  31. data/lib/platform_rest/data_table_row.rb +182 -0
  32. data/lib/platform_rest/data_table_rows.rb +343 -0
  33. data/lib/platform_rest/data_tables.rb +138 -0
  34. data/lib/platform_rest/device.rb +767 -0
  35. data/lib/platform_rest/device_recipe.rb +234 -0
  36. data/lib/platform_rest/device_recipes.rb +146 -0
  37. data/lib/platform_rest/devices.rb +707 -0
  38. data/lib/platform_rest/edge_deployment.rb +81 -0
  39. data/lib/platform_rest/edge_deployments.rb +236 -0
  40. data/lib/platform_rest/embedded_deployment.rb +81 -0
  41. data/lib/platform_rest/embedded_deployments.rb +280 -0
  42. data/lib/platform_rest/error.rb +34 -0
  43. data/lib/platform_rest/event.rb +176 -0
  44. data/lib/platform_rest/events.rb +341 -0
  45. data/lib/platform_rest/experience.rb +142 -0
  46. data/lib/platform_rest/experience_domain.rb +176 -0
  47. data/lib/platform_rest/experience_domains.rb +126 -0
  48. data/lib/platform_rest/experience_endpoint.rb +230 -0
  49. data/lib/platform_rest/experience_endpoints.rb +200 -0
  50. data/lib/platform_rest/experience_group.rb +180 -0
  51. data/lib/platform_rest/experience_groups.rb +141 -0
  52. data/lib/platform_rest/experience_slug.rb +176 -0
  53. data/lib/platform_rest/experience_slugs.rb +126 -0
  54. data/lib/platform_rest/experience_user.rb +176 -0
  55. data/lib/platform_rest/experience_users.rb +142 -0
  56. data/lib/platform_rest/experience_version.rb +176 -0
  57. data/lib/platform_rest/experience_versions.rb +138 -0
  58. data/lib/platform_rest/experience_view.rb +228 -0
  59. data/lib/platform_rest/experience_views.rb +142 -0
  60. data/lib/platform_rest/file.rb +226 -0
  61. data/lib/platform_rest/files.rb +144 -0
  62. data/lib/platform_rest/flow.rb +580 -0
  63. data/lib/platform_rest/flow_version.rb +352 -0
  64. data/lib/platform_rest/flow_versions.rb +201 -0
  65. data/lib/platform_rest/flows.rb +310 -0
  66. data/lib/platform_rest/instance.rb +377 -0
  67. data/lib/platform_rest/instance_api_token.rb +176 -0
  68. data/lib/platform_rest/instance_api_tokens.rb +136 -0
  69. data/lib/platform_rest/instance_custom_node.rb +282 -0
  70. data/lib/platform_rest/instance_custom_nodes.rb +136 -0
  71. data/lib/platform_rest/instance_member.rb +176 -0
  72. data/lib/platform_rest/instance_members.rb +134 -0
  73. data/lib/platform_rest/instance_org.rb +336 -0
  74. data/lib/platform_rest/instance_org_invite.rb +182 -0
  75. data/lib/platform_rest/instance_org_invites.rb +138 -0
  76. data/lib/platform_rest/instance_org_member.rb +182 -0
  77. data/lib/platform_rest/instance_org_members.rb +138 -0
  78. data/lib/platform_rest/instance_orgs.rb +139 -0
  79. data/lib/platform_rest/instance_sandbox.rb +181 -0
  80. data/lib/platform_rest/instance_sandboxes.rb +98 -0
  81. data/lib/platform_rest/instances.rb +88 -0
  82. data/lib/platform_rest/integration.rb +178 -0
  83. data/lib/platform_rest/integrations.rb +138 -0
  84. data/lib/platform_rest/me.rb +923 -0
  85. data/lib/platform_rest/notebook.rb +423 -0
  86. data/lib/platform_rest/notebooks.rb +138 -0
  87. data/lib/platform_rest/org.rb +663 -0
  88. data/lib/platform_rest/org_invites.rb +124 -0
  89. data/lib/platform_rest/orgs.rb +140 -0
  90. data/lib/platform_rest/resource_job.rb +326 -0
  91. data/lib/platform_rest/resource_jobs.rb +138 -0
  92. data/lib/platform_rest/user_api_token.rb +170 -0
  93. data/lib/platform_rest/user_api_tokens.rb +132 -0
  94. data/lib/platform_rest/utils.rb +44 -0
  95. data/lib/platform_rest/webhook.rb +178 -0
  96. data/lib/platform_rest/webhooks.rb +138 -0
  97. data/lib/platform_rest.rb +129 -0
  98. data/schemas/apiTokenPost.json +4 -0
  99. data/schemas/applicationDashboardPost.json +66 -0
  100. data/schemas/dashboard.json +66 -0
  101. data/schemas/dashboardPatch.json +66 -0
  102. data/schemas/dashboardPost.json +66 -0
  103. data/schemas/dashboards.json +66 -0
  104. data/schemas/deviceConnectionStatus.json +10 -0
  105. data/schemas/deviceLog.json +3 -0
  106. data/schemas/event.json +8 -0
  107. data/schemas/eventPlusNewCount.json +8 -0
  108. data/schemas/events.json +8 -0
  109. data/schemas/githubLogin.json +4 -0
  110. data/schemas/integrationPatch.json +0 -10
  111. data/schemas/orgInviteActionUser.json +18 -0
  112. data/schemas/orgInviteResultUser.json +18 -0
  113. data/schemas/orgInviteUser.json +51 -0
  114. data/schemas/orgInvitesUser.json +59 -0
  115. data/schemas/payloadCountsBreakdown.json +1 -25
  116. data/schemas/periodSummaries.json +172 -0
  117. data/schemas/samlResponse.json +4 -0
  118. data/schemas/userCredentials.json +4 -0
  119. data/schemas/userPost.json +4 -0
  120. metadata +98 -2
@@ -0,0 +1,663 @@
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 PlatformRest
26
+
27
+ # Class containing all the actions for the Org Resource
28
+ class Org
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Deletes an organization
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.Organization, all.User, org.*, or org.delete.
41
+ #
42
+ # Parameters:
43
+ # * {string} orgId - ID associated with the organization
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 organization 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 organization 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("orgId is required") unless params.has_key?(:orgId)
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 = "/orgs/#{params[:orgId]}"
69
+
70
+ @client.request(
71
+ method: :delete,
72
+ path: path,
73
+ query: query_params,
74
+ headers: headers,
75
+ body: body)
76
+ end
77
+
78
+ # Returns device counts by day for the time range specified for this organization
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.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.deviceCounts.
85
+ #
86
+ # Parameters:
87
+ # * {string} orgId - ID associated with the organization
88
+ # * {string} start - Start of range for device count query (ms since epoch)
89
+ # * {string} end - End of range for device count query (ms since epoch)
90
+ # * {string} losantdomain - Domain scope of request (rarely needed)
91
+ # * {boolean} _actions - Return resource actions in response
92
+ # * {boolean} _links - Return resource link in response
93
+ # * {boolean} _embedded - Return embedded resources in response
94
+ #
95
+ # Responses:
96
+ # * 200 - Device counts by day (https://api.losant.com/#/definitions/deviceCounts)
97
+ #
98
+ # Errors:
99
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
100
+ # * 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
101
+ def device_counts(params = {})
102
+ params = Utils.symbolize_hash_keys(params)
103
+ query_params = { _actions: false, _links: true, _embedded: true }
104
+ headers = {}
105
+ body = nil
106
+
107
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
108
+
109
+ query_params[:start] = params[:start] if params.has_key?(:start)
110
+ query_params[:end] = params[:end] if params.has_key?(:end)
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 = "/orgs/#{params[:orgId]}/deviceCounts"
117
+
118
+ @client.request(
119
+ method: :get,
120
+ path: path,
121
+ query: query_params,
122
+ headers: headers,
123
+ body: body)
124
+ end
125
+
126
+ # Retrieves information on an organization
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.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.get.
133
+ #
134
+ # Parameters:
135
+ # * {string} orgId - ID associated with the organization
136
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
137
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
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 - Organization information (https://api.losant.com/#/definitions/org)
145
+ #
146
+ # Errors:
147
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
148
+ # * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
149
+ def get(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("orgId is required") unless params.has_key?(:orgId)
156
+
157
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
158
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
159
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
160
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
161
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
162
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
163
+
164
+ path = "/orgs/#{params[:orgId]}"
165
+
166
+ @client.request(
167
+ method: :get,
168
+ path: path,
169
+ query: query_params,
170
+ headers: headers,
171
+ body: body)
172
+ end
173
+
174
+ # Invites a person to an organization
175
+ #
176
+ # Authentication:
177
+ # The client must be configured with a valid api
178
+ # access token to call this action. The token
179
+ # must include at least one of the following scopes:
180
+ # all.Organization, all.User, org.*, or org.inviteMember.
181
+ #
182
+ # Parameters:
183
+ # * {string} orgId - ID associated with the organization
184
+ # * {hash} invite - Object containing new invite info (https://api.losant.com/#/definitions/orgInvitePost)
185
+ # * {string} losantdomain - Domain scope of request (rarely needed)
186
+ # * {boolean} _actions - Return resource actions in response
187
+ # * {boolean} _links - Return resource link in response
188
+ # * {boolean} _embedded - Return embedded resources in response
189
+ #
190
+ # Responses:
191
+ # * 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
192
+ #
193
+ # Errors:
194
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
195
+ # * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
196
+ def invite_member(params = {})
197
+ params = Utils.symbolize_hash_keys(params)
198
+ query_params = { _actions: false, _links: true, _embedded: true }
199
+ headers = {}
200
+ body = nil
201
+
202
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
203
+ raise ArgumentError.new("invite is required") unless params.has_key?(:invite)
204
+
205
+ body = params[:invite] if params.has_key?(:invite)
206
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
207
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
208
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
209
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
210
+
211
+ path = "/orgs/#{params[:orgId]}/invites"
212
+
213
+ @client.request(
214
+ method: :post,
215
+ path: path,
216
+ query: query_params,
217
+ headers: headers,
218
+ body: body)
219
+ end
220
+
221
+ # Modifies a current org member's role
222
+ #
223
+ # Authentication:
224
+ # The client must be configured with a valid api
225
+ # access token to call this action. The token
226
+ # must include at least one of the following scopes:
227
+ # all.Organization, all.User, org.*, or org.modifyMember.
228
+ #
229
+ # Parameters:
230
+ # * {string} orgId - ID associated with the organization
231
+ # * {hash} member - Object containing new member pair (https://api.losant.com/#/definitions/orgMemberPatch)
232
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
233
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
234
+ # * {string} losantdomain - Domain scope of request (rarely needed)
235
+ # * {boolean} _actions - Return resource actions in response
236
+ # * {boolean} _links - Return resource link in response
237
+ # * {boolean} _embedded - Return embedded resources in response
238
+ #
239
+ # Responses:
240
+ # * 200 - Updated organization information (https://api.losant.com/#/definitions/org)
241
+ #
242
+ # Errors:
243
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
244
+ # * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
245
+ def modify_member(params = {})
246
+ params = Utils.symbolize_hash_keys(params)
247
+ query_params = { _actions: false, _links: true, _embedded: true }
248
+ headers = {}
249
+ body = nil
250
+
251
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
252
+ raise ArgumentError.new("member is required") unless params.has_key?(:member)
253
+
254
+ body = params[:member] if params.has_key?(:member)
255
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
256
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
257
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
258
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
259
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
260
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
261
+
262
+ path = "/orgs/#{params[:orgId]}/member"
263
+
264
+ @client.request(
265
+ method: :patch,
266
+ path: path,
267
+ query: query_params,
268
+ headers: headers,
269
+ body: body)
270
+ end
271
+
272
+ # Returns notebook execution usage by day for the time range specified for this organization
273
+ #
274
+ # Authentication:
275
+ # The client must be configured with a valid api
276
+ # access token to call this action. The token
277
+ # must include at least one of the following scopes:
278
+ # all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.notebookMinuteCounts.
279
+ #
280
+ # Parameters:
281
+ # * {string} orgId - ID associated with the organization
282
+ # * {string} start - Start of range for notebook execution query (ms since epoch)
283
+ # * {string} end - End of range for notebook execution query (ms since epoch)
284
+ # * {string} losantdomain - Domain scope of request (rarely needed)
285
+ # * {boolean} _actions - Return resource actions in response
286
+ # * {boolean} _links - Return resource link in response
287
+ # * {boolean} _embedded - Return embedded resources in response
288
+ #
289
+ # Responses:
290
+ # * 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
291
+ #
292
+ # Errors:
293
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
294
+ # * 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
295
+ def notebook_minute_counts(params = {})
296
+ params = Utils.symbolize_hash_keys(params)
297
+ query_params = { _actions: false, _links: true, _embedded: true }
298
+ headers = {}
299
+ body = nil
300
+
301
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
302
+
303
+ query_params[:start] = params[:start] if params.has_key?(:start)
304
+ query_params[:end] = params[:end] if params.has_key?(:end)
305
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
306
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
307
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
308
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
309
+
310
+ path = "/orgs/#{params[:orgId]}/notebookMinuteCounts"
311
+
312
+ @client.request(
313
+ method: :get,
314
+ path: path,
315
+ query: query_params,
316
+ headers: headers,
317
+ body: body)
318
+ end
319
+
320
+ # Updates information about an organization
321
+ #
322
+ # Authentication:
323
+ # The client must be configured with a valid api
324
+ # access token to call this action. The token
325
+ # must include at least one of the following scopes:
326
+ # all.Organization, all.User, org.*, or org.patch.
327
+ #
328
+ # Parameters:
329
+ # * {string} orgId - ID associated with the organization
330
+ # * {hash} organization - Object containing new organization properties (https://api.losant.com/#/definitions/orgPatch)
331
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
332
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
333
+ # * {string} losantdomain - Domain scope of request (rarely needed)
334
+ # * {boolean} _actions - Return resource actions in response
335
+ # * {boolean} _links - Return resource link in response
336
+ # * {boolean} _embedded - Return embedded resources in response
337
+ #
338
+ # Responses:
339
+ # * 200 - Updated organization information (https://api.losant.com/#/definitions/org)
340
+ #
341
+ # Errors:
342
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
343
+ # * 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
344
+ def patch(params = {})
345
+ params = Utils.symbolize_hash_keys(params)
346
+ query_params = { _actions: false, _links: true, _embedded: true }
347
+ headers = {}
348
+ body = nil
349
+
350
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
351
+ raise ArgumentError.new("organization is required") unless params.has_key?(:organization)
352
+
353
+ body = params[:organization] if params.has_key?(:organization)
354
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
355
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
356
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
357
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
358
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
359
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
360
+
361
+ path = "/orgs/#{params[:orgId]}"
362
+
363
+ @client.request(
364
+ method: :patch,
365
+ path: path,
366
+ query: query_params,
367
+ headers: headers,
368
+ body: body)
369
+ end
370
+
371
+ # Returns payload counts for the time range specified for all applications this organization owns
372
+ #
373
+ # Authentication:
374
+ # The client must be configured with a valid api
375
+ # access token to call this action. The token
376
+ # must include at least one of the following scopes:
377
+ # all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.payloadCounts.
378
+ #
379
+ # Parameters:
380
+ # * {string} orgId - ID associated with the organization
381
+ # * {string} start - Start of range for payload count query (ms since epoch)
382
+ # * {string} end - End of range for payload count query (ms since epoch)
383
+ # * {string} losantdomain - Domain scope of request (rarely needed)
384
+ # * {boolean} _actions - Return resource actions in response
385
+ # * {boolean} _links - Return resource link in response
386
+ # * {boolean} _embedded - Return embedded resources in response
387
+ #
388
+ # Responses:
389
+ # * 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadStats)
390
+ #
391
+ # Errors:
392
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
393
+ # * 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
394
+ def payload_counts(params = {})
395
+ params = Utils.symbolize_hash_keys(params)
396
+ query_params = { _actions: false, _links: true, _embedded: true }
397
+ headers = {}
398
+ body = nil
399
+
400
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
401
+
402
+ query_params[:start] = params[:start] if params.has_key?(:start)
403
+ query_params[:end] = params[:end] if params.has_key?(:end)
404
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
405
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
406
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
407
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
408
+
409
+ path = "/orgs/#{params[:orgId]}/payloadCounts"
410
+
411
+ @client.request(
412
+ method: :get,
413
+ path: path,
414
+ query: query_params,
415
+ headers: headers,
416
+ body: body)
417
+ end
418
+
419
+ # Returns payload counts per resolution in the time range specified for all application this organization owns
420
+ #
421
+ # Authentication:
422
+ # The client must be configured with a valid api
423
+ # access token to call this action. The token
424
+ # must include at least one of the following scopes:
425
+ # all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.payloadCountsBreakdown.
426
+ #
427
+ # Parameters:
428
+ # * {string} orgId - ID associated with the organization
429
+ # * {string} start - Start of range for payload count query (ms since epoch)
430
+ # * {string} end - End of range for payload count query (ms since epoch)
431
+ # * {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
432
+ # * {string} asBytes - If the resulting stats should be returned as bytes
433
+ # * {string} includeNonBillable - If non-billable payloads should be included in the result
434
+ # * {string} losantdomain - Domain scope of request (rarely needed)
435
+ # * {boolean} _actions - Return resource actions in response
436
+ # * {boolean} _links - Return resource link in response
437
+ # * {boolean} _embedded - Return embedded resources in response
438
+ #
439
+ # Responses:
440
+ # * 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
441
+ #
442
+ # Errors:
443
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
444
+ # * 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
445
+ def payload_counts_breakdown(params = {})
446
+ params = Utils.symbolize_hash_keys(params)
447
+ query_params = { _actions: false, _links: true, _embedded: true }
448
+ headers = {}
449
+ body = nil
450
+
451
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
452
+
453
+ query_params[:start] = params[:start] if params.has_key?(:start)
454
+ query_params[:end] = params[:end] if params.has_key?(:end)
455
+ query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
456
+ query_params[:asBytes] = params[:asBytes] if params.has_key?(:asBytes)
457
+ query_params[:includeNonBillable] = params[:includeNonBillable] if params.has_key?(:includeNonBillable)
458
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
459
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
460
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
461
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
462
+
463
+ path = "/orgs/#{params[:orgId]}/payloadCountsBreakdown"
464
+
465
+ @client.request(
466
+ method: :get,
467
+ path: path,
468
+ query: query_params,
469
+ headers: headers,
470
+ body: body)
471
+ end
472
+
473
+ # Gets the current pending invites
474
+ #
475
+ # Authentication:
476
+ # The client must be configured with a valid api
477
+ # access token to call this action. The token
478
+ # must include at least one of the following scopes:
479
+ # all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.pendingInvites.
480
+ #
481
+ # Parameters:
482
+ # * {string} orgId - ID associated with the organization
483
+ # * {string} losantdomain - Domain scope of request (rarely needed)
484
+ # * {boolean} _actions - Return resource actions in response
485
+ # * {boolean} _links - Return resource link in response
486
+ # * {boolean} _embedded - Return embedded resources in response
487
+ #
488
+ # Responses:
489
+ # * 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
490
+ #
491
+ # Errors:
492
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
493
+ # * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
494
+ def pending_invites(params = {})
495
+ params = Utils.symbolize_hash_keys(params)
496
+ query_params = { _actions: false, _links: true, _embedded: true }
497
+ headers = {}
498
+ body = nil
499
+
500
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
501
+
502
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
503
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
504
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
505
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
506
+
507
+ path = "/orgs/#{params[:orgId]}/invites"
508
+
509
+ @client.request(
510
+ method: :get,
511
+ path: path,
512
+ query: query_params,
513
+ headers: headers,
514
+ body: body)
515
+ end
516
+
517
+ # Removes a member from the org
518
+ #
519
+ # Authentication:
520
+ # The client must be configured with a valid api
521
+ # access token to call this action. The token
522
+ # must include at least one of the following scopes:
523
+ # all.Organization, all.User, org.*, or org.removeMember.
524
+ #
525
+ # Parameters:
526
+ # * {string} orgId - ID associated with the organization
527
+ # * {string} userId - Id of user to remove
528
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
529
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
530
+ # * {string} losantdomain - Domain scope of request (rarely needed)
531
+ # * {boolean} _actions - Return resource actions in response
532
+ # * {boolean} _links - Return resource link in response
533
+ # * {boolean} _embedded - Return embedded resources in response
534
+ #
535
+ # Responses:
536
+ # * 200 - Updated organization information (https://api.losant.com/#/definitions/org)
537
+ #
538
+ # Errors:
539
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
540
+ # * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
541
+ def remove_member(params = {})
542
+ params = Utils.symbolize_hash_keys(params)
543
+ query_params = { _actions: false, _links: true, _embedded: true }
544
+ headers = {}
545
+ body = nil
546
+
547
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
548
+ raise ArgumentError.new("userId is required") unless params.has_key?(:userId)
549
+
550
+ query_params[:userId] = params[:userId] if params.has_key?(:userId)
551
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
552
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
553
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
554
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
555
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
556
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
557
+
558
+ path = "/orgs/#{params[:orgId]}/member"
559
+
560
+ @client.request(
561
+ method: :delete,
562
+ path: path,
563
+ query: query_params,
564
+ headers: headers,
565
+ body: body)
566
+ end
567
+
568
+ # Revokes an existing invite
569
+ #
570
+ # Authentication:
571
+ # The client must be configured with a valid api
572
+ # access token to call this action. The token
573
+ # must include at least one of the following scopes:
574
+ # all.Organization, all.User, org.*, or org.revokeInvite.
575
+ #
576
+ # Parameters:
577
+ # * {string} orgId - ID associated with the organization
578
+ # * {string} inviteId - Id of invite to revoke
579
+ # * {string} losantdomain - Domain scope of request (rarely needed)
580
+ # * {boolean} _actions - Return resource actions in response
581
+ # * {boolean} _links - Return resource link in response
582
+ # * {boolean} _embedded - Return embedded resources in response
583
+ #
584
+ # Responses:
585
+ # * 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
586
+ #
587
+ # Errors:
588
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
589
+ # * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
590
+ def revoke_invite(params = {})
591
+ params = Utils.symbolize_hash_keys(params)
592
+ query_params = { _actions: false, _links: true, _embedded: true }
593
+ headers = {}
594
+ body = nil
595
+
596
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
597
+ raise ArgumentError.new("inviteId is required") unless params.has_key?(:inviteId)
598
+
599
+ query_params[:inviteId] = params[:inviteId] if params.has_key?(:inviteId)
600
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
601
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
602
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
603
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
604
+
605
+ path = "/orgs/#{params[:orgId]}/invites"
606
+
607
+ @client.request(
608
+ method: :delete,
609
+ path: path,
610
+ query: query_params,
611
+ headers: headers,
612
+ body: body)
613
+ end
614
+
615
+ # Moves resources to a new owner
616
+ #
617
+ # Authentication:
618
+ # The client must be configured with a valid api
619
+ # access token to call this action. The token
620
+ # must include at least one of the following scopes:
621
+ # all.Organization, all.User, org.*, or org.transferResources.
622
+ #
623
+ # Parameters:
624
+ # * {string} orgId - ID associated with the organization
625
+ # * {hash} transfer - Object containing properties of the transfer (https://api.losant.com/#/definitions/resourceTransfer)
626
+ # * {string} losantdomain - Domain scope of request (rarely needed)
627
+ # * {boolean} _actions - Return resource actions in response
628
+ # * {boolean} _links - Return resource link in response
629
+ # * {boolean} _embedded - Return embedded resources in response
630
+ #
631
+ # Responses:
632
+ # * 200 - If resource transfer was successful (https://api.losant.com/#/definitions/success)
633
+ #
634
+ # Errors:
635
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
636
+ # * 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
637
+ def transfer_resources(params = {})
638
+ params = Utils.symbolize_hash_keys(params)
639
+ query_params = { _actions: false, _links: true, _embedded: true }
640
+ headers = {}
641
+ body = nil
642
+
643
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
644
+ raise ArgumentError.new("transfer is required") unless params.has_key?(:transfer)
645
+
646
+ body = params[:transfer] if params.has_key?(:transfer)
647
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
648
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
649
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
650
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
651
+
652
+ path = "/orgs/#{params[:orgId]}/transferResources"
653
+
654
+ @client.request(
655
+ method: :patch,
656
+ path: path,
657
+ query: query_params,
658
+ headers: headers,
659
+ body: body)
660
+ end
661
+
662
+ end
663
+ end