losant_rest 1.22.1 → 1.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,49 @@
1
+ # Application Job Log Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Application Job Log resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Get](#get)
10
+
11
+ <br/>
12
+
13
+ ## Get
14
+
15
+ Returns the job log for the given ID
16
+
17
+ ```ruby
18
+ result = client.application_job_log.get(
19
+ applicationId: my_application_id,
20
+ jobId: my_job_id)
21
+
22
+ puts result
23
+ ```
24
+
25
+ #### Authentication
26
+ The client must be configured with a valid api access token to call this
27
+ action. The token must include at least one of the following scopes:
28
+ all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationJobLog.*, or applicationJobLog.get.
29
+
30
+ #### Available Parameters
31
+
32
+ | Name | Type | Required | Description | Default | Example |
33
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
34
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
35
+ | jobId | string | Y | ID associated with the job execution | | 575ec8687ae143cd83dc4a98 |
36
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
37
+
38
+ #### Successful Responses
39
+
40
+ | Code | Type | Description |
41
+ | ---- | ---- | ----------- |
42
+ | 200 | [Application Job Log](_schemas.md#application-job-log) | An application job log |
43
+
44
+ #### Error Responses
45
+
46
+ | Code | Type | Description |
47
+ | ---- | ---- | ----------- |
48
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
49
+ | 404 | [Error](_schemas.md#error) | Error if application job log was not found |
@@ -0,0 +1,51 @@
1
+ # Application Job Logs Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Application Job Logs resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Get](#get)
10
+
11
+ <br/>
12
+
13
+ ## Get
14
+
15
+ Returns the job logs for an application
16
+
17
+ ```ruby
18
+ result = client.application_job_logs.get(applicationId: my_application_id)
19
+
20
+ puts result
21
+ ```
22
+
23
+ #### Authentication
24
+ The client must be configured with a valid api access token to call this
25
+ action. The token must include at least one of the following scopes:
26
+ all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationJobLogs.*, or applicationJobLogs.get.
27
+
28
+ #### Available Parameters
29
+
30
+ | Name | Type | Required | Description | Default | Example |
31
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
32
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
33
+ | sortField | string | N | Field to sort the results by. Accepted values are: name, status, resourceType, runQueuedAt, runStartedAt, runCompletedAt | runQueuedAt | status |
34
+ | sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
35
+ | page | string | N | Which page of results to return | 0 | 0 |
36
+ | perPage | string | N | How many items to return per page | 100 | 10 |
37
+ | query | [Advanced Application Job Log Query](_schemas.md#advanced-application-job-log-query) | N | Filter application job logs by a query. | | [Advanced Application Job Log Query Example](_schemas.md#advanced-application-job-log-query-example) |
38
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
39
+
40
+ #### Successful Responses
41
+
42
+ | Code | Type | Description |
43
+ | ---- | ---- | ----------- |
44
+ | 200 | [Application Job Logs](_schemas.md#application-job-logs) | Collection of application job logs |
45
+
46
+ #### Error Responses
47
+
48
+ | Code | Type | Description |
49
+ | ---- | ---- | ----------- |
50
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
51
+ | 404 | [Error](_schemas.md#error) | Error if application was not found |
data/docs/data.md CHANGED
@@ -34,7 +34,7 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
34
34
  | Name | Type | Required | Description | Default | Example |
35
35
  | ---- | ---- | -------- | ----------- | ------- | ------- |
36
36
  | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
37
- | query | [Data Export](_schemas.md#data-export) | Y | The query parameters | | [Data Export Example](_schemas.md#data-export-example) |
37
+ | query | [Devices Data Export](_schemas.md#devices-data-export) | Y | The query parameters | | [Devices Data Export Example](_schemas.md#devices-data-export-example) |
38
38
  | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
39
39
 
40
40
  #### Successful Responses
data/docs/device.md CHANGED
@@ -91,6 +91,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
91
91
  | email | string | N | Email address to send export to. Defaults to current user&#x27;s email. | | email@example.com |
92
92
  | callbackUrl | string | N | Callback URL to call with export result | | https://example.com/cburl |
93
93
  | includeBlobData | string | N | If set will export any blob attributes in base64 form, otherwise they will be downloadable links which will expire. | | true |
94
+ | query | [Device Data Export](_schemas.md#device-data-export) | N | The export parameters. When provided overrides any options provided as a query param. | | [Device Data Export Example](_schemas.md#device-data-export-example) |
94
95
  | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
95
96
 
96
97
  #### Successful Responses
data/docs/events.md CHANGED
@@ -36,6 +36,8 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
36
36
  | ---- | ---- | -------- | ----------- | ------- | ------- |
37
37
  | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
38
38
  | query | [Advanced Event Query](_schemas.md#advanced-event-query) | N | Query to apply to filter the events | | [Advanced Event Query Example](_schemas.md#advanced-event-query-example) |
39
+ | email | string | N | Email address to send job complete notification to. Defaults to current user&#x27;s email. | | email@example.com |
40
+ | callbackUrl | string | N | Callback URL to call with delete result | | https://example.com/cburl |
39
41
  | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
40
42
 
41
43
  #### Successful Responses
@@ -43,6 +45,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
43
45
  | Code | Type | Description |
44
46
  | ---- | ---- | ----------- |
45
47
  | 200 | [Events Deleted](_schemas.md#events-deleted) | If request successfully deletes a set of Events |
48
+ | 202 | [Job Enqueued API Result](_schemas.md#job-enqueued-api-result) | If a bulk delete job has been enqueued |
46
49
 
47
50
  #### Error Responses
48
51
 
@@ -0,0 +1,81 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2024 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 Application Job Log Resource
28
+ class ApplicationJobLog
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Returns the job log for the given ID
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.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationJobLog.*, or applicationJobLog.get.
41
+ #
42
+ # Parameters:
43
+ # * {string} applicationId - ID associated with the application
44
+ # * {string} jobId - ID associated with the job execution
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 - An application job log (https://api.losant.com/#/definitions/applicationJobLog)
52
+ #
53
+ # Errors:
54
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
55
+ # * 404 - Error if application job log was not found (https://api.losant.com/#/definitions/error)
56
+ def get(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("jobId is required") unless params.has_key?(:jobId)
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]}/jobLogs/#{params[:jobId]}"
71
+
72
+ @client.request(
73
+ method: :get,
74
+ path: path,
75
+ query: query_params,
76
+ headers: headers,
77
+ body: body)
78
+ end
79
+
80
+ end
81
+ end
@@ -0,0 +1,90 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2024 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 Application Job Logs Resource
28
+ class ApplicationJobLogs
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Returns the job logs for an application
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.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationJobLogs.*, or applicationJobLogs.get.
41
+ #
42
+ # Parameters:
43
+ # * {string} applicationId - ID associated with the application
44
+ # * {string} sortField - Field to sort the results by. Accepted values are: name, status, resourceType, runQueuedAt, runStartedAt, runCompletedAt
45
+ # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
46
+ # * {string} page - Which page of results to return
47
+ # * {string} perPage - How many items to return per page
48
+ # * {hash} query - Filter application job logs by a query. (https://api.losant.com/#/definitions/advancedApplicationJobLogQuery)
49
+ # * {string} losantdomain - Domain scope of request (rarely needed)
50
+ # * {boolean} _actions - Return resource actions in response
51
+ # * {boolean} _links - Return resource link in response
52
+ # * {boolean} _embedded - Return embedded resources in response
53
+ #
54
+ # Responses:
55
+ # * 200 - Collection of application job logs (https://api.losant.com/#/definitions/applicationJobLogs)
56
+ #
57
+ # Errors:
58
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
59
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
60
+ def get(params = {})
61
+ params = Utils.symbolize_hash_keys(params)
62
+ query_params = { _actions: false, _links: true, _embedded: true }
63
+ headers = {}
64
+ body = nil
65
+
66
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
67
+
68
+ query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
69
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
70
+ query_params[:page] = params[:page] if params.has_key?(:page)
71
+ query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
72
+ query_params[:query] = params[:query] if params.has_key?(:query)
73
+ query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
74
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
75
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
76
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
77
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
78
+
79
+ path = "/applications/#{params[:applicationId]}/jobLogs"
80
+
81
+ @client.request(
82
+ method: :get,
83
+ path: path,
84
+ query: query_params,
85
+ headers: headers,
86
+ body: body)
87
+ end
88
+
89
+ end
90
+ end
@@ -72,6 +72,14 @@ module PlatformRest
72
72
  @application_dashboards ||= ApplicationDashboards.new(self)
73
73
  end
74
74
 
75
+ def application_job_log
76
+ @application_job_log ||= ApplicationJobLog.new(self)
77
+ end
78
+
79
+ def application_job_logs
80
+ @application_job_logs ||= ApplicationJobLogs.new(self)
81
+ end
82
+
75
83
  def application_key
76
84
  @application_key ||= ApplicationKey.new(self)
77
85
  end
@@ -41,7 +41,7 @@ module PlatformRest
41
41
  #
42
42
  # Parameters:
43
43
  # * {string} applicationId - ID associated with the application
44
- # * {hash} query - The query parameters (https://api.losant.com/#/definitions/dataExport)
44
+ # * {hash} query - The query parameters (https://api.losant.com/#/definitions/devicesDataExport)
45
45
  # * {string} losantdomain - Domain scope of request (rarely needed)
46
46
  # * {boolean} _actions - Return resource actions in response
47
47
  # * {boolean} _links - Return resource link in response
@@ -93,6 +93,7 @@ module PlatformRest
93
93
  # * {string} email - Email address to send export to. Defaults to current user's email.
94
94
  # * {string} callbackUrl - Callback URL to call with export result
95
95
  # * {string} includeBlobData - If set will export any blob attributes in base64 form, otherwise they will be downloadable links which will expire.
96
+ # * {hash} query - The export parameters. When provided overrides any options provided as a query param. (https://api.losant.com/#/definitions/deviceDataExport)
96
97
  # * {string} losantdomain - Domain scope of request (rarely needed)
97
98
  # * {boolean} _actions - Return resource actions in response
98
99
  # * {boolean} _links - Return resource link in response
@@ -118,6 +119,7 @@ module PlatformRest
118
119
  query_params[:email] = params[:email] if params.has_key?(:email)
119
120
  query_params[:callbackUrl] = params[:callbackUrl] if params.has_key?(:callbackUrl)
120
121
  query_params[:includeBlobData] = params[:includeBlobData] if params.has_key?(:includeBlobData)
122
+ body = params[:query] if params.has_key?(:query)
121
123
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
122
124
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
123
125
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -42,6 +42,8 @@ module PlatformRest
42
42
  # Parameters:
43
43
  # * {string} applicationId - ID associated with the application
44
44
  # * {hash} query - Query to apply to filter the events (https://api.losant.com/#/definitions/advancedEventQuery)
45
+ # * {string} email - Email address to send job complete notification to. Defaults to current user's email.
46
+ # * {string} callbackUrl - Callback URL to call with delete result
45
47
  # * {string} losantdomain - Domain scope of request (rarely needed)
46
48
  # * {boolean} _actions - Return resource actions in response
47
49
  # * {boolean} _links - Return resource link in response
@@ -49,6 +51,7 @@ module PlatformRest
49
51
  #
50
52
  # Responses:
51
53
  # * 200 - If request successfully deletes a set of Events (https://api.losant.com/#/definitions/eventsDeleted)
54
+ # * 202 - If a bulk delete job has been enqueued (https://api.losant.com/#/definitions/jobEnqueuedResult)
52
55
  #
53
56
  # Errors:
54
57
  # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
@@ -62,6 +65,8 @@ module PlatformRest
62
65
  raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
63
66
 
64
67
  body = params[:query] if params.has_key?(:query)
68
+ query_params[:email] = params[:email] if params.has_key?(:email)
69
+ query_params[:callbackUrl] = params[:callbackUrl] if params.has_key?(:callbackUrl)
65
70
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
66
71
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
67
72
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -21,5 +21,5 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  module PlatformRest
24
- VERSION = "1.22.1"
24
+ VERSION = "1.22.2"
25
25
  end
data/lib/platform_rest.rb CHANGED
@@ -32,6 +32,8 @@ require_relative "platform_rest/application_certificate_authority"
32
32
  require_relative "platform_rest/application_certificates"
33
33
  require_relative "platform_rest/application_dashboard"
34
34
  require_relative "platform_rest/application_dashboards"
35
+ require_relative "platform_rest/application_job_log"
36
+ require_relative "platform_rest/application_job_logs"
35
37
  require_relative "platform_rest/application_key"
36
38
  require_relative "platform_rest/application_keys"
37
39
  require_relative "platform_rest/application_template"