losant_rest 1.8.5 → 1.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/docs/_schemas.md +2209 -127
  3. data/docs/application.md +4 -2
  4. data/docs/applications.md +4 -2
  5. data/docs/data.md +41 -0
  6. data/docs/me.md +4 -2
  7. data/docs/notebook.md +305 -0
  8. data/docs/notebooks.md +93 -0
  9. data/docs/org.md +8 -2
  10. data/docs/orgs.md +4 -2
  11. data/lib/losant_rest/application.rb +6 -2
  12. data/lib/losant_rest/applications.rb +6 -2
  13. data/lib/losant_rest/client.rb +10 -2
  14. data/lib/losant_rest/data.rb +47 -0
  15. data/lib/losant_rest/me.rb +6 -2
  16. data/lib/losant_rest/notebook.rb +322 -0
  17. data/lib/losant_rest/notebooks.rb +136 -0
  18. data/lib/losant_rest/org.rb +14 -2
  19. data/lib/losant_rest/orgs.rb +6 -2
  20. data/lib/losant_rest/version.rb +1 -1
  21. data/lib/losant_rest.rb +2 -0
  22. data/schemas/application.json +15 -4
  23. data/schemas/applicationApiTokenPost.json +12 -0
  24. data/schemas/applications.json +15 -4
  25. data/schemas/dataExport.json +65 -0
  26. data/schemas/deviceCredentials.json +1 -0
  27. data/schemas/edgeDeployment.json +2 -1
  28. data/schemas/edgeDeployments.json +2 -1
  29. data/schemas/event.json +4 -2
  30. data/schemas/events.json +4 -2
  31. data/schemas/file.json +2 -1
  32. data/schemas/fileUploadPostResponse.json +20 -26
  33. data/schemas/files.json +2 -1
  34. data/schemas/flow.json +1 -0
  35. data/schemas/flowPatch.json +1 -0
  36. data/schemas/flowPost.json +1 -0
  37. data/schemas/flowVersion.json +2 -0
  38. data/schemas/flowVersionPost.json +1 -0
  39. data/schemas/flowVersions.json +2 -0
  40. data/schemas/flows.json +1 -0
  41. data/schemas/flowsImportPost.json +2 -0
  42. data/schemas/flowsImportResult.json +3 -0
  43. data/schemas/githubLogin.json +12 -0
  44. data/schemas/me.json +28 -8
  45. data/schemas/notebook.json +322 -0
  46. data/schemas/notebookDataExportOptions.json +34 -0
  47. data/schemas/notebookExecutionLogs.json +125 -0
  48. data/schemas/notebookExecutionOptions.json +29 -0
  49. data/schemas/notebookPatch.json +295 -0
  50. data/schemas/notebookPost.json +298 -0
  51. data/schemas/notebooks.json +364 -0
  52. data/schemas/org.json +27 -10
  53. data/schemas/orgs.json +27 -10
  54. data/schemas/userCredentials.json +12 -0
  55. data/schemas/userPost.json +12 -0
  56. metadata +14 -2
@@ -29,6 +29,53 @@ module LosantRest
29
29
  @client = client
30
30
  end
31
31
 
32
+ # Creates a csv file from a query of devices and attributes over a time range.
33
+ #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, data.*, or data.export.
39
+ #
40
+ # Parameters:
41
+ # * {string} applicationId - ID associated with the application
42
+ # * {hash} query - The query parameters (https://api.losant.com/#/definitions/dataExport)
43
+ # * {string} losantdomain - Domain scope of request (rarely needed)
44
+ # * {boolean} _actions - Return resource actions in response
45
+ # * {boolean} _links - Return resource link in response
46
+ # * {boolean} _embedded - Return embedded resources in response
47
+ #
48
+ # Responses:
49
+ # * 200 - If command was successfully sent (https://api.losant.com/#/definitions/success)
50
+ #
51
+ # Errors:
52
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
53
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
54
+ def export(params = {})
55
+ params = Utils.symbolize_hash_keys(params)
56
+ query_params = { _actions: false, _links: true, _embedded: true }
57
+ headers = {}
58
+ body = nil
59
+
60
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
61
+ raise ArgumentError.new("query is required") unless params.has_key?(:query)
62
+
63
+ body = params[:query] if params.has_key?(:query)
64
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
65
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
66
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
67
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
68
+
69
+ path = "/applications/#{params[:applicationId]}/data/export"
70
+
71
+ @client.request(
72
+ method: :post,
73
+ path: path,
74
+ query: query_params,
75
+ headers: headers,
76
+ body: body)
77
+ end
78
+
32
79
  # Returns the last known data for the given attribute
33
80
  #
34
81
  # Authentication:
@@ -387,8 +387,8 @@ module LosantRest
387
387
  #
388
388
  # Parameters:
389
389
  # * {undefined} includeRecent - Should the user include recent app/dashboard info
390
- # * {string} summaryExclude - Comma seperated list of summary fields to exclude from user summary
391
- # * {string} summaryInclude - Comma seperated list of summary fields to include in user summary
390
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from user summary
391
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in user summary
392
392
  # * {string} losantdomain - Domain scope of request (rarely needed)
393
393
  # * {boolean} _actions - Return resource actions in response
394
394
  # * {boolean} _links - Return resource link in response
@@ -433,6 +433,8 @@ module LosantRest
433
433
  #
434
434
  # Parameters:
435
435
  # * {hash} user - Object containing new user properties (https://api.losant.com/#/definitions/mePatch)
436
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from user summary
437
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in user summary
436
438
  # * {string} losantdomain - Domain scope of request (rarely needed)
437
439
  # * {boolean} _actions - Return resource actions in response
438
440
  # * {boolean} _links - Return resource link in response
@@ -452,6 +454,8 @@ module LosantRest
452
454
  raise ArgumentError.new("user is required") unless params.has_key?(:user)
453
455
 
454
456
  body = params[:user] if params.has_key?(:user)
457
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
458
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
455
459
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
456
460
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
457
461
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -0,0 +1,322 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 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
+ module LosantRest
24
+
25
+ # Class containing all the actions for the Notebook Resource
26
+ class Notebook
27
+
28
+ def initialize(client)
29
+ @client = client
30
+ end
31
+
32
+ # Deletes a notebook
33
+ #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Application, all.Organization, all.User, notebook.*, or notebook.delete.
39
+ #
40
+ # Parameters:
41
+ # * {string} applicationId - ID associated with the application
42
+ # * {string} notebookId - ID associated with the notebook
43
+ # * {string} losantdomain - Domain scope of request (rarely needed)
44
+ # * {boolean} _actions - Return resource actions in response
45
+ # * {boolean} _links - Return resource link in response
46
+ # * {boolean} _embedded - Return embedded resources in response
47
+ #
48
+ # Responses:
49
+ # * 200 - If notebook was successfully deleted (https://api.losant.com/#/definitions/success)
50
+ #
51
+ # Errors:
52
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
53
+ # * 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
54
+ def delete(params = {})
55
+ params = Utils.symbolize_hash_keys(params)
56
+ query_params = { _actions: false, _links: true, _embedded: true }
57
+ headers = {}
58
+ body = nil
59
+
60
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
61
+ raise ArgumentError.new("notebookId is required") unless params.has_key?(:notebookId)
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 = "/applications/#{params[:applicationId]}/notebooks/#{params[:notebookId]}"
69
+
70
+ @client.request(
71
+ method: :delete,
72
+ path: path,
73
+ query: query_params,
74
+ headers: headers,
75
+ body: body)
76
+ end
77
+
78
+ # Triggers the execution of a notebook
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.Application, all.Organization, all.User, notebook.*, or notebook.execute.
85
+ #
86
+ # Parameters:
87
+ # * {string} applicationId - ID associated with the application
88
+ # * {string} notebookId - ID associated with the notebook
89
+ # * {hash} executionOptions - The options for the execution (https://api.losant.com/#/definitions/notebookExecutionOptions)
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 - If execution request was accepted and successfully queued (https://api.losant.com/#/definitions/success)
97
+ #
98
+ # Errors:
99
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
100
+ # * 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
101
+ def execute(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("applicationId is required") unless params.has_key?(:applicationId)
108
+ raise ArgumentError.new("notebookId is required") unless params.has_key?(:notebookId)
109
+ raise ArgumentError.new("executionOptions is required") unless params.has_key?(:executionOptions)
110
+
111
+ body = params[:executionOptions] if params.has_key?(:executionOptions)
112
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
113
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
114
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
115
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
116
+
117
+ path = "/applications/#{params[:applicationId]}/notebooks/#{params[:notebookId]}/execute"
118
+
119
+ @client.request(
120
+ method: :post,
121
+ path: path,
122
+ query: query_params,
123
+ headers: headers,
124
+ body: body)
125
+ end
126
+
127
+ # Retrieves information on a notebook
128
+ #
129
+ # Authentication:
130
+ # The client must be configured with a valid api
131
+ # access token to call this action. The token
132
+ # must include at least one of the following scopes:
133
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.get.
134
+ #
135
+ # Parameters:
136
+ # * {string} applicationId - ID associated with the application
137
+ # * {string} notebookId - ID associated with the notebook
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 - notebook information (https://api.losant.com/#/definitions/notebook)
145
+ #
146
+ # Errors:
147
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
148
+ # * 404 - Error if notebook was 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("applicationId is required") unless params.has_key?(:applicationId)
156
+ raise ArgumentError.new("notebookId is required") unless params.has_key?(:notebookId)
157
+
158
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
159
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
160
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
161
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
162
+
163
+ path = "/applications/#{params[:applicationId]}/notebooks/#{params[:notebookId]}"
164
+
165
+ @client.request(
166
+ method: :get,
167
+ path: path,
168
+ query: query_params,
169
+ headers: headers,
170
+ body: body)
171
+ end
172
+
173
+ # Retrieves information on notebook executions
174
+ #
175
+ # Authentication:
176
+ # The client must be configured with a valid api
177
+ # access token to call this action. The token
178
+ # must include at least one of the following scopes:
179
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.logs.
180
+ #
181
+ # Parameters:
182
+ # * {string} applicationId - ID associated with the application
183
+ # * {string} notebookId - ID associated with the notebook
184
+ # * {string} limit - Max log entries to return (ordered by time descending)
185
+ # * {string} since - Look for log entries since this time (ms since epoch)
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 - notebook execution information (https://api.losant.com/#/definitions/notebookExecutionLogs)
193
+ #
194
+ # Errors:
195
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
196
+ # * 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
197
+ def logs(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("notebookId is required") unless params.has_key?(:notebookId)
205
+
206
+ query_params[:limit] = params[:limit] if params.has_key?(:limit)
207
+ query_params[:since] = params[:since] if params.has_key?(:since)
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]}/notebooks/#{params[:notebookId]}/logs"
214
+
215
+ @client.request(
216
+ method: :get,
217
+ path: path,
218
+ query: query_params,
219
+ headers: headers,
220
+ body: body)
221
+ end
222
+
223
+ # Updates information about a notebook
224
+ #
225
+ # Authentication:
226
+ # The client must be configured with a valid api
227
+ # access token to call this action. The token
228
+ # must include at least one of the following scopes:
229
+ # all.Application, all.Organization, all.User, notebook.*, or notebook.patch.
230
+ #
231
+ # Parameters:
232
+ # * {string} applicationId - ID associated with the application
233
+ # * {string} notebookId - ID associated with the notebook
234
+ # * {hash} notebook - Object containing new properties of the notebook (https://api.losant.com/#/definitions/notebookPatch)
235
+ # * {string} losantdomain - Domain scope of request (rarely needed)
236
+ # * {boolean} _actions - Return resource actions in response
237
+ # * {boolean} _links - Return resource link in response
238
+ # * {boolean} _embedded - Return embedded resources in response
239
+ #
240
+ # Responses:
241
+ # * 200 - Updated notebook information (https://api.losant.com/#/definitions/notebook)
242
+ #
243
+ # Errors:
244
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
245
+ # * 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
246
+ def patch(params = {})
247
+ params = Utils.symbolize_hash_keys(params)
248
+ query_params = { _actions: false, _links: true, _embedded: true }
249
+ headers = {}
250
+ body = nil
251
+
252
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
253
+ raise ArgumentError.new("notebookId is required") unless params.has_key?(:notebookId)
254
+ raise ArgumentError.new("notebook is required") unless params.has_key?(:notebook)
255
+
256
+ body = params[:notebook] if params.has_key?(:notebook)
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 = "/applications/#{params[:applicationId]}/notebooks/#{params[:notebookId]}"
263
+
264
+ @client.request(
265
+ method: :patch,
266
+ path: path,
267
+ query: query_params,
268
+ headers: headers,
269
+ body: body)
270
+ end
271
+
272
+ # Requests a combined zip file of the potential input data for a notebook execution
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.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.requestInputDataExport.
279
+ #
280
+ # Parameters:
281
+ # * {string} applicationId - ID associated with the application
282
+ # * {string} notebookId - ID associated with the notebook
283
+ # * {hash} exportOptions - The options for the export (https://api.losant.com/#/definitions/notebookDataExportOptions)
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 - If export request was accepted and successfully queued (https://api.losant.com/#/definitions/success)
291
+ #
292
+ # Errors:
293
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
294
+ # * 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
295
+ def request_input_data_export(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("applicationId is required") unless params.has_key?(:applicationId)
302
+ raise ArgumentError.new("notebookId is required") unless params.has_key?(:notebookId)
303
+ raise ArgumentError.new("exportOptions is required") unless params.has_key?(:exportOptions)
304
+
305
+ body = params[:exportOptions] if params.has_key?(:exportOptions)
306
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
307
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
308
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
309
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
310
+
311
+ path = "/applications/#{params[:applicationId]}/notebooks/#{params[:notebookId]}/requestInputDataExport"
312
+
313
+ @client.request(
314
+ method: :post,
315
+ path: path,
316
+ query: query_params,
317
+ headers: headers,
318
+ body: body)
319
+ end
320
+
321
+ end
322
+ end
@@ -0,0 +1,136 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 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
+ module LosantRest
24
+
25
+ # Class containing all the actions for the Notebooks Resource
26
+ class Notebooks
27
+
28
+ def initialize(client)
29
+ @client = client
30
+ end
31
+
32
+ # Returns the notebooks for an application
33
+ #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebooks.*, or notebooks.get.
39
+ #
40
+ # Parameters:
41
+ # * {string} applicationId - ID associated with the application
42
+ # * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
43
+ # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
44
+ # * {string} page - Which page of results to return
45
+ # * {string} perPage - How many items to return per page
46
+ # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
47
+ # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
48
+ # * {string} losantdomain - Domain scope of request (rarely needed)
49
+ # * {boolean} _actions - Return resource actions in response
50
+ # * {boolean} _links - Return resource link in response
51
+ # * {boolean} _embedded - Return embedded resources in response
52
+ #
53
+ # Responses:
54
+ # * 200 - Collection of notebooks (https://api.losant.com/#/definitions/notebooks)
55
+ #
56
+ # Errors:
57
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
58
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
59
+ def get(params = {})
60
+ params = Utils.symbolize_hash_keys(params)
61
+ query_params = { _actions: false, _links: true, _embedded: true }
62
+ headers = {}
63
+ body = nil
64
+
65
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
66
+
67
+ query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
68
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
69
+ query_params[:page] = params[:page] if params.has_key?(:page)
70
+ query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
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 = "/applications/#{params[:applicationId]}/notebooks"
79
+
80
+ @client.request(
81
+ method: :get,
82
+ path: path,
83
+ query: query_params,
84
+ headers: headers,
85
+ body: body)
86
+ end
87
+
88
+ # Create a new notebook for an application
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.Application, all.Organization, all.User, notebooks.*, or notebooks.post.
95
+ #
96
+ # Parameters:
97
+ # * {string} applicationId - ID associated with the application
98
+ # * {hash} notebook - New notebook information (https://api.losant.com/#/definitions/notebookPost)
99
+ # * {string} losantdomain - Domain scope of request (rarely needed)
100
+ # * {boolean} _actions - Return resource actions in response
101
+ # * {boolean} _links - Return resource link in response
102
+ # * {boolean} _embedded - Return embedded resources in response
103
+ #
104
+ # Responses:
105
+ # * 201 - Successfully created notebook (https://api.losant.com/#/definitions/notebook)
106
+ #
107
+ # Errors:
108
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
109
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
110
+ def post(params = {})
111
+ params = Utils.symbolize_hash_keys(params)
112
+ query_params = { _actions: false, _links: true, _embedded: true }
113
+ headers = {}
114
+ body = nil
115
+
116
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
117
+ raise ArgumentError.new("notebook is required") unless params.has_key?(:notebook)
118
+
119
+ body = params[:notebook] if params.has_key?(:notebook)
120
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
121
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
122
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
123
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
124
+
125
+ path = "/applications/#{params[:applicationId]}/notebooks"
126
+
127
+ @client.request(
128
+ method: :post,
129
+ path: path,
130
+ query: query_params,
131
+ headers: headers,
132
+ body: body)
133
+ end
134
+
135
+ end
136
+ end
@@ -83,8 +83,8 @@ module LosantRest
83
83
  #
84
84
  # Parameters:
85
85
  # * {string} orgId - ID associated with the organization
86
- # * {string} summaryExclude - Comma seperated list of summary fields to exclude from org summary
87
- # * {string} summaryInclude - Comma seperated list of summary fields to include in org summary
86
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
87
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
88
88
  # * {string} losantdomain - Domain scope of request (rarely needed)
89
89
  # * {boolean} _actions - Return resource actions in response
90
90
  # * {boolean} _links - Return resource link in response
@@ -179,6 +179,8 @@ module LosantRest
179
179
  # Parameters:
180
180
  # * {string} orgId - ID associated with the organization
181
181
  # * {hash} member - Object containing new member pair (https://api.losant.com/#/definitions/orgMemberPatch)
182
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
183
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
182
184
  # * {string} losantdomain - Domain scope of request (rarely needed)
183
185
  # * {boolean} _actions - Return resource actions in response
184
186
  # * {boolean} _links - Return resource link in response
@@ -200,6 +202,8 @@ module LosantRest
200
202
  raise ArgumentError.new("member is required") unless params.has_key?(:member)
201
203
 
202
204
  body = params[:member] if params.has_key?(:member)
205
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
206
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
203
207
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
204
208
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
205
209
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -226,6 +230,8 @@ module LosantRest
226
230
  # Parameters:
227
231
  # * {string} orgId - ID associated with the organization
228
232
  # * {hash} organization - Object containing new organization properties (https://api.losant.com/#/definitions/orgPatch)
233
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
234
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
229
235
  # * {string} losantdomain - Domain scope of request (rarely needed)
230
236
  # * {boolean} _actions - Return resource actions in response
231
237
  # * {boolean} _links - Return resource link in response
@@ -247,6 +253,8 @@ module LosantRest
247
253
  raise ArgumentError.new("organization is required") unless params.has_key?(:organization)
248
254
 
249
255
  body = params[:organization] if params.has_key?(:organization)
256
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
257
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
250
258
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
251
259
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
252
260
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -365,6 +373,8 @@ module LosantRest
365
373
  # Parameters:
366
374
  # * {string} orgId - ID associated with the organization
367
375
  # * {string} userId - Id of user to remove
376
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
377
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
368
378
  # * {string} losantdomain - Domain scope of request (rarely needed)
369
379
  # * {boolean} _actions - Return resource actions in response
370
380
  # * {boolean} _links - Return resource link in response
@@ -386,6 +396,8 @@ module LosantRest
386
396
  raise ArgumentError.new("userId is required") unless params.has_key?(:userId)
387
397
 
388
398
  query_params[:userId] = params[:userId] if params.has_key?(:userId)
399
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
400
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
389
401
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
390
402
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
391
403
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -44,8 +44,8 @@ module LosantRest
44
44
  # * {string} perPage - How many items to return per page
45
45
  # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
46
46
  # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
47
- # * {string} summaryExclude - Comma seperated list of summary fields to exclude from org summaries
48
- # * {string} summaryInclude - Comma seperated list of summary fields to include in org summary
47
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summaries
48
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
49
49
  # * {string} losantdomain - Domain scope of request (rarely needed)
50
50
  # * {boolean} _actions - Return resource actions in response
51
51
  # * {boolean} _links - Return resource link in response
@@ -96,6 +96,8 @@ module LosantRest
96
96
  #
97
97
  # Parameters:
98
98
  # * {hash} organization - New organization information (https://api.losant.com/#/definitions/orgPost)
99
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
100
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in org summary
99
101
  # * {string} losantdomain - Domain scope of request (rarely needed)
100
102
  # * {boolean} _actions - Return resource actions in response
101
103
  # * {boolean} _links - Return resource link in response
@@ -115,6 +117,8 @@ module LosantRest
115
117
  raise ArgumentError.new("organization is required") unless params.has_key?(:organization)
116
118
 
117
119
  body = params[:organization] if params.has_key?(:organization)
120
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
121
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
118
122
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
119
123
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
120
124
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -21,5 +21,5 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  module LosantRest
24
- VERSION = "1.8.5"
24
+ VERSION = "1.8.6"
25
25
  end
data/lib/losant_rest.rb CHANGED
@@ -70,6 +70,8 @@ require_relative "losant_rest/flows"
70
70
  require_relative "losant_rest/integration"
71
71
  require_relative "losant_rest/integrations"
72
72
  require_relative "losant_rest/me"
73
+ require_relative "losant_rest/notebook"
74
+ require_relative "losant_rest/notebooks"
73
75
  require_relative "losant_rest/org"
74
76
  require_relative "losant_rest/org_invites"
75
77
  require_relative "losant_rest/orgs"