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,410 @@
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 "httparty"
24
+
25
+ module PlatformRest
26
+ # Platform API
27
+ #
28
+ # User API for accessing platform data
29
+ #
30
+ # Built For Version 1.26.1
31
+ class Client
32
+ attr_accessor :auth_token, :url
33
+
34
+ def initialize(options = {})
35
+ self.auth_token = options.fetch(:auth_token, nil)
36
+ self.url = options.fetch(:url, "https://api.losant.com")
37
+ end
38
+
39
+ def application
40
+ @application ||= Application.new(self)
41
+ end
42
+
43
+ def application_api_token
44
+ @application_api_token ||= ApplicationApiToken.new(self)
45
+ end
46
+
47
+ def application_api_tokens
48
+ @application_api_tokens ||= ApplicationApiTokens.new(self)
49
+ end
50
+
51
+ def application_certificate
52
+ @application_certificate ||= ApplicationCertificate.new(self)
53
+ end
54
+
55
+ def application_certificate_authorities
56
+ @application_certificate_authorities ||= ApplicationCertificateAuthorities.new(self)
57
+ end
58
+
59
+ def application_certificate_authority
60
+ @application_certificate_authority ||= ApplicationCertificateAuthority.new(self)
61
+ end
62
+
63
+ def application_certificates
64
+ @application_certificates ||= ApplicationCertificates.new(self)
65
+ end
66
+
67
+ def application_dashboard
68
+ @application_dashboard ||= ApplicationDashboard.new(self)
69
+ end
70
+
71
+ def application_dashboards
72
+ @application_dashboards ||= ApplicationDashboards.new(self)
73
+ end
74
+
75
+ def application_key
76
+ @application_key ||= ApplicationKey.new(self)
77
+ end
78
+
79
+ def application_keys
80
+ @application_keys ||= ApplicationKeys.new(self)
81
+ end
82
+
83
+ def application_template
84
+ @application_template ||= ApplicationTemplate.new(self)
85
+ end
86
+
87
+ def application_templates
88
+ @application_templates ||= ApplicationTemplates.new(self)
89
+ end
90
+
91
+ def applications
92
+ @applications ||= Applications.new(self)
93
+ end
94
+
95
+ def audit_log
96
+ @audit_log ||= AuditLog.new(self)
97
+ end
98
+
99
+ def audit_logs
100
+ @audit_logs ||= AuditLogs.new(self)
101
+ end
102
+
103
+ def auth
104
+ @auth ||= Auth.new(self)
105
+ end
106
+
107
+ def credential
108
+ @credential ||= Credential.new(self)
109
+ end
110
+
111
+ def credentials
112
+ @credentials ||= Credentials.new(self)
113
+ end
114
+
115
+ def dashboard
116
+ @dashboard ||= Dashboard.new(self)
117
+ end
118
+
119
+ def dashboards
120
+ @dashboards ||= Dashboards.new(self)
121
+ end
122
+
123
+ def data
124
+ @data ||= Data.new(self)
125
+ end
126
+
127
+ def data_table
128
+ @data_table ||= DataTable.new(self)
129
+ end
130
+
131
+ def data_table_row
132
+ @data_table_row ||= DataTableRow.new(self)
133
+ end
134
+
135
+ def data_table_rows
136
+ @data_table_rows ||= DataTableRows.new(self)
137
+ end
138
+
139
+ def data_tables
140
+ @data_tables ||= DataTables.new(self)
141
+ end
142
+
143
+ def device
144
+ @device ||= Device.new(self)
145
+ end
146
+
147
+ def device_recipe
148
+ @device_recipe ||= DeviceRecipe.new(self)
149
+ end
150
+
151
+ def device_recipes
152
+ @device_recipes ||= DeviceRecipes.new(self)
153
+ end
154
+
155
+ def devices
156
+ @devices ||= Devices.new(self)
157
+ end
158
+
159
+ def edge_deployment
160
+ @edge_deployment ||= EdgeDeployment.new(self)
161
+ end
162
+
163
+ def edge_deployments
164
+ @edge_deployments ||= EdgeDeployments.new(self)
165
+ end
166
+
167
+ def embedded_deployment
168
+ @embedded_deployment ||= EmbeddedDeployment.new(self)
169
+ end
170
+
171
+ def embedded_deployments
172
+ @embedded_deployments ||= EmbeddedDeployments.new(self)
173
+ end
174
+
175
+ def event
176
+ @event ||= Event.new(self)
177
+ end
178
+
179
+ def events
180
+ @events ||= Events.new(self)
181
+ end
182
+
183
+ def experience
184
+ @experience ||= Experience.new(self)
185
+ end
186
+
187
+ def experience_domain
188
+ @experience_domain ||= ExperienceDomain.new(self)
189
+ end
190
+
191
+ def experience_domains
192
+ @experience_domains ||= ExperienceDomains.new(self)
193
+ end
194
+
195
+ def experience_endpoint
196
+ @experience_endpoint ||= ExperienceEndpoint.new(self)
197
+ end
198
+
199
+ def experience_endpoints
200
+ @experience_endpoints ||= ExperienceEndpoints.new(self)
201
+ end
202
+
203
+ def experience_group
204
+ @experience_group ||= ExperienceGroup.new(self)
205
+ end
206
+
207
+ def experience_groups
208
+ @experience_groups ||= ExperienceGroups.new(self)
209
+ end
210
+
211
+ def experience_slug
212
+ @experience_slug ||= ExperienceSlug.new(self)
213
+ end
214
+
215
+ def experience_slugs
216
+ @experience_slugs ||= ExperienceSlugs.new(self)
217
+ end
218
+
219
+ def experience_user
220
+ @experience_user ||= ExperienceUser.new(self)
221
+ end
222
+
223
+ def experience_users
224
+ @experience_users ||= ExperienceUsers.new(self)
225
+ end
226
+
227
+ def experience_version
228
+ @experience_version ||= ExperienceVersion.new(self)
229
+ end
230
+
231
+ def experience_versions
232
+ @experience_versions ||= ExperienceVersions.new(self)
233
+ end
234
+
235
+ def experience_view
236
+ @experience_view ||= ExperienceView.new(self)
237
+ end
238
+
239
+ def experience_views
240
+ @experience_views ||= ExperienceViews.new(self)
241
+ end
242
+
243
+ def file
244
+ @file ||= File.new(self)
245
+ end
246
+
247
+ def files
248
+ @files ||= Files.new(self)
249
+ end
250
+
251
+ def flow
252
+ @flow ||= Flow.new(self)
253
+ end
254
+
255
+ def flow_version
256
+ @flow_version ||= FlowVersion.new(self)
257
+ end
258
+
259
+ def flow_versions
260
+ @flow_versions ||= FlowVersions.new(self)
261
+ end
262
+
263
+ def flows
264
+ @flows ||= Flows.new(self)
265
+ end
266
+
267
+ def instance
268
+ @instance ||= Instance.new(self)
269
+ end
270
+
271
+ def instance_api_token
272
+ @instance_api_token ||= InstanceApiToken.new(self)
273
+ end
274
+
275
+ def instance_api_tokens
276
+ @instance_api_tokens ||= InstanceApiTokens.new(self)
277
+ end
278
+
279
+ def instance_custom_node
280
+ @instance_custom_node ||= InstanceCustomNode.new(self)
281
+ end
282
+
283
+ def instance_custom_nodes
284
+ @instance_custom_nodes ||= InstanceCustomNodes.new(self)
285
+ end
286
+
287
+ def instance_member
288
+ @instance_member ||= InstanceMember.new(self)
289
+ end
290
+
291
+ def instance_members
292
+ @instance_members ||= InstanceMembers.new(self)
293
+ end
294
+
295
+ def instance_org
296
+ @instance_org ||= InstanceOrg.new(self)
297
+ end
298
+
299
+ def instance_org_invite
300
+ @instance_org_invite ||= InstanceOrgInvite.new(self)
301
+ end
302
+
303
+ def instance_org_invites
304
+ @instance_org_invites ||= InstanceOrgInvites.new(self)
305
+ end
306
+
307
+ def instance_org_member
308
+ @instance_org_member ||= InstanceOrgMember.new(self)
309
+ end
310
+
311
+ def instance_org_members
312
+ @instance_org_members ||= InstanceOrgMembers.new(self)
313
+ end
314
+
315
+ def instance_orgs
316
+ @instance_orgs ||= InstanceOrgs.new(self)
317
+ end
318
+
319
+ def instance_sandbox
320
+ @instance_sandbox ||= InstanceSandbox.new(self)
321
+ end
322
+
323
+ def instance_sandboxes
324
+ @instance_sandboxes ||= InstanceSandboxes.new(self)
325
+ end
326
+
327
+ def instances
328
+ @instances ||= Instances.new(self)
329
+ end
330
+
331
+ def integration
332
+ @integration ||= Integration.new(self)
333
+ end
334
+
335
+ def integrations
336
+ @integrations ||= Integrations.new(self)
337
+ end
338
+
339
+ def me
340
+ @me ||= Me.new(self)
341
+ end
342
+
343
+ def notebook
344
+ @notebook ||= Notebook.new(self)
345
+ end
346
+
347
+ def notebooks
348
+ @notebooks ||= Notebooks.new(self)
349
+ end
350
+
351
+ def org
352
+ @org ||= Org.new(self)
353
+ end
354
+
355
+ def org_invites
356
+ @org_invites ||= OrgInvites.new(self)
357
+ end
358
+
359
+ def orgs
360
+ @orgs ||= Orgs.new(self)
361
+ end
362
+
363
+ def resource_job
364
+ @resource_job ||= ResourceJob.new(self)
365
+ end
366
+
367
+ def resource_jobs
368
+ @resource_jobs ||= ResourceJobs.new(self)
369
+ end
370
+
371
+ def user_api_token
372
+ @user_api_token ||= UserApiToken.new(self)
373
+ end
374
+
375
+ def user_api_tokens
376
+ @user_api_tokens ||= UserApiTokens.new(self)
377
+ end
378
+
379
+ def webhook
380
+ @webhook ||= Webhook.new(self)
381
+ end
382
+
383
+ def webhooks
384
+ @webhooks ||= Webhooks.new(self)
385
+ end
386
+
387
+ def request(options = {})
388
+ headers = options.fetch(:headers, {})
389
+ method = options.fetch(:method, :get)
390
+
391
+ headers["Accept"] = "application/json"
392
+ headers["Content-Type"] = "application/json"
393
+ headers["Accept-Version"] = "^1.26.1"
394
+ headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
395
+ path = self.url + options.fetch(:path, "")
396
+
397
+ response = HTTParty.send(method, path,
398
+ query: Utils.fix_query_arrays(options[:query]),
399
+ body: options[:body] && options[:body].to_json(),
400
+ headers: headers)
401
+
402
+ result = response.parsed_response
403
+ if response.code >= 400
404
+ raise ResponseError.new(response.code, result)
405
+ end
406
+
407
+ result
408
+ end
409
+ end
410
+ end
@@ -0,0 +1,224 @@
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 Credential Resource
28
+ class Credential
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Deletes a credential
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, credential.*, or credential.delete.
41
+ #
42
+ # Parameters:
43
+ # * {string} applicationId - ID associated with the application
44
+ # * {string} credentialId - ID associated with the credential
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 credential 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 credential 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("applicationId is required") unless params.has_key?(:applicationId)
63
+ raise ArgumentError.new("credentialId is required") unless params.has_key?(:credentialId)
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 = "/applications/#{params[:applicationId]}/credentials/#{params[:credentialId]}"
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 a credential
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.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, credential.*, or credential.get.
87
+ #
88
+ # Parameters:
89
+ # * {string} applicationId - ID associated with the application
90
+ # * {string} credentialId - ID associated with the credential
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 - credential information (https://api.losant.com/#/definitions/credential)
98
+ #
99
+ # Errors:
100
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
101
+ # * 404 - Error if credential 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("applicationId is required") unless params.has_key?(:applicationId)
109
+ raise ArgumentError.new("credentialId is required") unless params.has_key?(:credentialId)
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 = "/applications/#{params[:applicationId]}/credentials/#{params[:credentialId]}"
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 resources linked to a credential
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.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, credential.*, or credential.linkedResources.
133
+ #
134
+ # Parameters:
135
+ # * {string} applicationId - ID associated with the application
136
+ # * {string} credentialId - ID associated with the credential
137
+ # * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by returned workflows
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 - Linked resource information (https://api.losant.com/#/definitions/credentialLinkedResources)
145
+ #
146
+ # Errors:
147
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
148
+ # * 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
149
+ def linked_resources(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("applicationId is required") unless params.has_key?(:applicationId)
156
+ raise ArgumentError.new("credentialId is required") unless params.has_key?(:credentialId)
157
+
158
+ query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes)
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 = "/applications/#{params[:applicationId]}/credentials/#{params[:credentialId]}/linkedResources"
165
+
166
+ @client.request(
167
+ method: :get,
168
+ path: path,
169
+ query: query_params,
170
+ headers: headers,
171
+ body: body)
172
+ end
173
+
174
+ # Updates information about a credential
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.Application, all.Organization, all.User, credential.*, or credential.patch.
181
+ #
182
+ # Parameters:
183
+ # * {string} applicationId - ID associated with the application
184
+ # * {string} credentialId - ID associated with the credential
185
+ # * {hash} credential - Object containing new properties of the credential (https://api.losant.com/#/definitions/credentialPatch)
186
+ # * {string} losantdomain - Domain scope of request (rarely needed)
187
+ # * {boolean} _actions - Return resource actions in response
188
+ # * {boolean} _links - Return resource link in response
189
+ # * {boolean} _embedded - Return embedded resources in response
190
+ #
191
+ # Responses:
192
+ # * 200 - Updated credential information (https://api.losant.com/#/definitions/credential)
193
+ #
194
+ # Errors:
195
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
196
+ # * 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
197
+ def patch(params = {})
198
+ params = Utils.symbolize_hash_keys(params)
199
+ query_params = { _actions: false, _links: true, _embedded: true }
200
+ headers = {}
201
+ body = nil
202
+
203
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
204
+ raise ArgumentError.new("credentialId is required") unless params.has_key?(:credentialId)
205
+ raise ArgumentError.new("credential is required") unless params.has_key?(:credential)
206
+
207
+ body = params[:credential] if params.has_key?(:credential)
208
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
209
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
210
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
211
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
212
+
213
+ path = "/applications/#{params[:applicationId]}/credentials/#{params[:credentialId]}"
214
+
215
+ @client.request(
216
+ method: :patch,
217
+ path: path,
218
+ query: query_params,
219
+ headers: headers,
220
+ body: body)
221
+ end
222
+
223
+ end
224
+ end