losant_rest 1.8.4 → 1.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/_schemas.md +505 -19
- data/docs/application.md +2 -0
- data/docs/applications.md +2 -0
- data/docs/dashboard.md +43 -2
- data/docs/me.md +2 -1
- data/docs/org.md +2 -1
- data/docs/orgs.md +2 -1
- data/lib/losant_rest/application.rb +4 -0
- data/lib/losant_rest/applications.rb +4 -0
- data/lib/losant_rest/client.rb +2 -2
- data/lib/losant_rest/dashboard.rb +49 -2
- data/lib/losant_rest/me.rb +3 -1
- data/lib/losant_rest/org.rb +3 -1
- data/lib/losant_rest/orgs.rb +3 -1
- data/lib/losant_rest/version.rb +1 -1
- data/schemas/compositeDeviceState.json +0 -3
- data/schemas/dashboard.json +3 -0
- data/schemas/dashboardPatch.json +3 -0
- data/schemas/dashboardPost.json +3 -0
- data/schemas/dashboardSendReport.json +38 -0
- data/schemas/dashboards.json +3 -0
- data/schemas/deviceState.json +0 -3
- data/schemas/deviceStateOrStates.json +0 -6
- data/schemas/deviceStates.json +0 -3
- data/schemas/githubLogin.json +1 -0
- data/schemas/userCredentials.json +1 -0
- data/schemas/userPost.json +1 -0
- data/schemas/validateContextError.json +78 -0
- data/schemas/validateContextSuccess.json +78 -0
- metadata +5 -2
data/docs/application.md
CHANGED
@@ -151,6 +151,8 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
151
151
|
| Name | Type | Required | Description | Default | Example |
|
152
152
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
153
153
|
| applicationId | string | Y | ID of the associated application | | 575ec8687ae143cd83dc4a97 |
|
154
|
+
| summaryExclude | string | N | Comma seperated list of summary fields to exclude from application summary | | payloadCount |
|
155
|
+
| summaryInclude | string | N | Comma seperated list of summary fields to include in application summary | | payloadCount |
|
154
156
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
155
157
|
|
156
158
|
#### Successful Responses
|
data/docs/applications.md
CHANGED
@@ -37,6 +37,8 @@ all.Organization, all.Organization.read, all.User, all.User.read, applications.*
|
|
37
37
|
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | name |
|
38
38
|
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my * app |
|
39
39
|
| orgId | string | N | If not provided, return all applications. If provided but blank, only return applications belonging to the current user. If provided and an id, only return applications belonging to the given organization id. | | 575ecdf07ae143cd83dc4a9a |
|
40
|
+
| summaryExclude | string | N | Comma seperated list of summary fields to exclude from application summary | | payloadCount |
|
41
|
+
| summaryInclude | string | N | Comma seperated list of summary fields to include in application summary | | payloadCount |
|
40
42
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
41
43
|
|
42
44
|
#### Successful Responses
|
data/docs/dashboard.md
CHANGED
@@ -9,6 +9,7 @@ parameters and the potential responses.
|
|
9
9
|
* [Delete](#delete)
|
10
10
|
* [Get](#get)
|
11
11
|
* [Patch](#patch)
|
12
|
+
* [Send Report](#send-report)
|
12
13
|
* [Validate Context](#validate-context)
|
13
14
|
|
14
15
|
<br/>
|
@@ -126,6 +127,46 @@ all.Organization, all.User, dashboard.*, or dashboard.patch.
|
|
126
127
|
|
127
128
|
<br/>
|
128
129
|
|
130
|
+
## Send Report
|
131
|
+
|
132
|
+
Sends a snapshot of a dashboard
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
result = client.dashboard.send_report(
|
136
|
+
dashboardId: my_dashboard_id,
|
137
|
+
reportConfig: my_report_config)
|
138
|
+
|
139
|
+
puts result
|
140
|
+
```
|
141
|
+
|
142
|
+
#### Authentication
|
143
|
+
The client must be configured with a valid api access token to call this
|
144
|
+
action. The token must include at least one of the following scopes:
|
145
|
+
all.Organization, all.User, dashboard.*, or dashboard.sendReport.
|
146
|
+
|
147
|
+
#### Available Parameters
|
148
|
+
|
149
|
+
| Name | Type | Required | Description | Default | Example |
|
150
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
151
|
+
| dashboardId | string | Y | ID of the associated dashboard | | 575ece2b7ae143cd83dc4a9b |
|
152
|
+
| reportConfig | [Dashboard Send Report](_schemas.md#dashboard-send-report) | Y | Object containing report options | | [Dashboard Send Report Example](_schemas.md#dashboard-send-report-example) |
|
153
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
154
|
+
|
155
|
+
#### Successful Responses
|
156
|
+
|
157
|
+
| Code | Type | Description |
|
158
|
+
| ---- | ---- | ----------- |
|
159
|
+
| 200 | [Success](_schemas.md#success) | Send dashboard report |
|
160
|
+
|
161
|
+
#### Error Responses
|
162
|
+
|
163
|
+
| Code | Type | Description |
|
164
|
+
| ---- | ---- | ----------- |
|
165
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
166
|
+
| 404 | [Error](_schemas.md#error) | Error if dashboard was not found |
|
167
|
+
|
168
|
+
<br/>
|
169
|
+
|
129
170
|
## Validate Context
|
130
171
|
|
131
172
|
Validates a context object against the dashboard's context configuration
|
@@ -154,11 +195,11 @@ No api access token is required to call this action.
|
|
154
195
|
|
155
196
|
| Code | Type | Description |
|
156
197
|
| ---- | ---- | ----------- |
|
157
|
-
| 200 | [Success](_schemas.md#success) | If context is valid |
|
198
|
+
| 200 | [Validate Context Success](_schemas.md#validate-context-success) | If context is valid |
|
158
199
|
|
159
200
|
#### Error Responses
|
160
201
|
|
161
202
|
| Code | Type | Description |
|
162
203
|
| ---- | ---- | ----------- |
|
163
|
-
| 400 | [Error](_schemas.md#error) | Error if context is invalid |
|
204
|
+
| 400 | [Validate Context Error](_schemas.md#validate-context-error) | Error if context is invalid |
|
164
205
|
| 404 | [Error](_schemas.md#error) | Error if dashboard or application was not found |
|
data/docs/me.md
CHANGED
@@ -329,7 +329,8 @@ all.SolutionUser, all.SolutionUser.read, all.User, all.User.read, me.*, or me.ge
|
|
329
329
|
| Name | Type | Required | Description | Default | Example |
|
330
330
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
331
331
|
| includeRecent | undefined | N | Should the user include recent app/dashboard info | | true |
|
332
|
-
| summaryExclude | string | N |
|
332
|
+
| summaryExclude | string | N | Comma seperated list of summary fields to exclude from user summary | | payloadCount |
|
333
|
+
| summaryInclude | string | N | Comma seperated list of summary fields to include in user summary | | payloadCount |
|
333
334
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
334
335
|
|
335
336
|
#### Successful Responses
|
data/docs/org.md
CHANGED
@@ -76,7 +76,8 @@ all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.
|
|
76
76
|
| Name | Type | Required | Description | Default | Example |
|
77
77
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
78
78
|
| orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
|
79
|
-
| summaryExclude | string | N |
|
79
|
+
| summaryExclude | string | N | Comma seperated list of summary fields to exclude from org summary | | payloadCount |
|
80
|
+
| summaryInclude | string | N | Comma seperated list of summary fields to include in org summary | | payloadCount |
|
80
81
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
81
82
|
|
82
83
|
#### Successful Responses
|
data/docs/orgs.md
CHANGED
@@ -36,7 +36,8 @@ all.User, all.User.read, orgs.*, or orgs.get.
|
|
36
36
|
| perPage | string | N | How many items to return per page | 1000 | 10 |
|
37
37
|
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | name |
|
38
38
|
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*org |
|
39
|
-
| summaryExclude | string | N |
|
39
|
+
| summaryExclude | string | N | Comma seperated list of summary fields to exclude from org summaries | | payloadCount |
|
40
|
+
| summaryInclude | string | N | Comma seperated list of summary fields to include in org summary | | payloadCount |
|
40
41
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
41
42
|
|
42
43
|
#### Successful Responses
|
@@ -174,6 +174,8 @@ module LosantRest
|
|
174
174
|
#
|
175
175
|
# Parameters:
|
176
176
|
# * {string} applicationId - ID of the associated application
|
177
|
+
# * {string} summaryExclude - Comma seperated list of summary fields to exclude from application summary
|
178
|
+
# * {string} summaryInclude - Comma seperated list of summary fields to include in application summary
|
177
179
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
178
180
|
# * {boolean} _actions - Return resource actions in response
|
179
181
|
# * {boolean} _links - Return resource link in response
|
@@ -193,6 +195,8 @@ module LosantRest
|
|
193
195
|
|
194
196
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
195
197
|
|
198
|
+
query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
|
199
|
+
query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
|
196
200
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
197
201
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
198
202
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
@@ -45,6 +45,8 @@ module LosantRest
|
|
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
47
|
# * {string} orgId - If not provided, return all applications. If provided but blank, only return applications belonging to the current user. If provided and an id, only return applications belonging to the given organization id.
|
48
|
+
# * {string} summaryExclude - Comma seperated list of summary fields to exclude from application summary
|
49
|
+
# * {string} summaryInclude - Comma seperated list of summary fields to include in application summary
|
48
50
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
49
51
|
# * {boolean} _actions - Return resource actions in response
|
50
52
|
# * {boolean} _links - Return resource link in response
|
@@ -69,6 +71,8 @@ module LosantRest
|
|
69
71
|
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
70
72
|
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
71
73
|
query_params[:orgId] = params[:orgId] if params.has_key?(:orgId)
|
74
|
+
query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
|
75
|
+
query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
|
72
76
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
73
77
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
74
78
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/losant_rest/client.rb
CHANGED
@@ -27,7 +27,7 @@ module LosantRest
|
|
27
27
|
#
|
28
28
|
# User API for accessing Losant data
|
29
29
|
#
|
30
|
-
# Built For Version 1.14.
|
30
|
+
# Built For Version 1.14.1
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -266,7 +266,7 @@ module LosantRest
|
|
266
266
|
|
267
267
|
headers["Accept"] = "application/json"
|
268
268
|
headers["Content-Type"] = "application/json"
|
269
|
-
headers["Accept-Version"] = "^1.14.
|
269
|
+
headers["Accept-Version"] = "^1.14.1"
|
270
270
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
271
271
|
path = self.url + options.fetch(:path, "")
|
272
272
|
|
@@ -163,6 +163,53 @@ module LosantRest
|
|
163
163
|
body: body)
|
164
164
|
end
|
165
165
|
|
166
|
+
# Sends a snapshot of a dashboard
|
167
|
+
#
|
168
|
+
# Authentication:
|
169
|
+
# The client must be configured with a valid api
|
170
|
+
# access token to call this action. The token
|
171
|
+
# must include at least one of the following scopes:
|
172
|
+
# all.Organization, all.User, dashboard.*, or dashboard.sendReport.
|
173
|
+
#
|
174
|
+
# Parameters:
|
175
|
+
# * {string} dashboardId - ID of the associated dashboard
|
176
|
+
# * {hash} reportConfig - Object containing report options (https://api.losant.com/#/definitions/dashboardSendReport)
|
177
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
178
|
+
# * {boolean} _actions - Return resource actions in response
|
179
|
+
# * {boolean} _links - Return resource link in response
|
180
|
+
# * {boolean} _embedded - Return embedded resources in response
|
181
|
+
#
|
182
|
+
# Responses:
|
183
|
+
# * 200 - Send dashboard report (https://api.losant.com/#/definitions/success)
|
184
|
+
#
|
185
|
+
# Errors:
|
186
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
187
|
+
# * 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
|
188
|
+
def send_report(params = {})
|
189
|
+
params = Utils.symbolize_hash_keys(params)
|
190
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
191
|
+
headers = {}
|
192
|
+
body = nil
|
193
|
+
|
194
|
+
raise ArgumentError.new("dashboardId is required") unless params.has_key?(:dashboardId)
|
195
|
+
raise ArgumentError.new("reportConfig is required") unless params.has_key?(:reportConfig)
|
196
|
+
|
197
|
+
body = params[:reportConfig] if params.has_key?(:reportConfig)
|
198
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
199
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
200
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
201
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
202
|
+
|
203
|
+
path = "/dashboards/#{params[:dashboardId]}"
|
204
|
+
|
205
|
+
@client.request(
|
206
|
+
method: :post,
|
207
|
+
path: path,
|
208
|
+
query: query_params,
|
209
|
+
headers: headers,
|
210
|
+
body: body)
|
211
|
+
end
|
212
|
+
|
166
213
|
# Validates a context object against the dashboard's context configuration
|
167
214
|
#
|
168
215
|
# Authentication:
|
@@ -178,10 +225,10 @@ module LosantRest
|
|
178
225
|
# * {boolean} _embedded - Return embedded resources in response
|
179
226
|
#
|
180
227
|
# Responses:
|
181
|
-
# * 200 - If context is valid (https://api.losant.com/#/definitions/
|
228
|
+
# * 200 - If context is valid (https://api.losant.com/#/definitions/validateContextSuccess)
|
182
229
|
#
|
183
230
|
# Errors:
|
184
|
-
# * 400 - Error if context is invalid (https://api.losant.com/#/definitions/
|
231
|
+
# * 400 - Error if context is invalid (https://api.losant.com/#/definitions/validateContextError)
|
185
232
|
# * 404 - Error if dashboard or application was not found (https://api.losant.com/#/definitions/error)
|
186
233
|
def validate_context(params = {})
|
187
234
|
params = Utils.symbolize_hash_keys(params)
|
data/lib/losant_rest/me.rb
CHANGED
@@ -387,7 +387,8 @@ module LosantRest
|
|
387
387
|
#
|
388
388
|
# Parameters:
|
389
389
|
# * {undefined} includeRecent - Should the user include recent app/dashboard info
|
390
|
-
# * {string} summaryExclude -
|
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
|
391
392
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
392
393
|
# * {boolean} _actions - Return resource actions in response
|
393
394
|
# * {boolean} _links - Return resource link in response
|
@@ -406,6 +407,7 @@ module LosantRest
|
|
406
407
|
|
407
408
|
query_params[:includeRecent] = params[:includeRecent] if params.has_key?(:includeRecent)
|
408
409
|
query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
|
410
|
+
query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
|
409
411
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
410
412
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
411
413
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/losant_rest/org.rb
CHANGED
@@ -83,7 +83,8 @@ module LosantRest
|
|
83
83
|
#
|
84
84
|
# Parameters:
|
85
85
|
# * {string} orgId - ID associated with the organization
|
86
|
-
# * {string} summaryExclude -
|
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
|
87
88
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
88
89
|
# * {boolean} _actions - Return resource actions in response
|
89
90
|
# * {boolean} _links - Return resource link in response
|
@@ -104,6 +105,7 @@ module LosantRest
|
|
104
105
|
raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
|
105
106
|
|
106
107
|
query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
|
108
|
+
query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
|
107
109
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
108
110
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
109
111
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/losant_rest/orgs.rb
CHANGED
@@ -44,7 +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 -
|
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
|
48
49
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
49
50
|
# * {boolean} _actions - Return resource actions in response
|
50
51
|
# * {boolean} _links - Return resource link in response
|
@@ -69,6 +70,7 @@ module LosantRest
|
|
69
70
|
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
70
71
|
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
71
72
|
query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
|
73
|
+
query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
|
72
74
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
73
75
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
74
76
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/losant_rest/version.rb
CHANGED
data/schemas/dashboard.json
CHANGED
data/schemas/dashboardPatch.json
CHANGED
data/schemas/dashboardPost.json
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"type": "object",
|
4
|
+
"required": [
|
5
|
+
"toEmail"
|
6
|
+
],
|
7
|
+
"properties": {
|
8
|
+
"toEmail": {
|
9
|
+
"type": "array",
|
10
|
+
"min": 1,
|
11
|
+
"max": 10,
|
12
|
+
"items": {
|
13
|
+
"type": "string",
|
14
|
+
"format": "email",
|
15
|
+
"maxLength": 1024
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"subject": {
|
19
|
+
"type": "string",
|
20
|
+
"max": 255
|
21
|
+
},
|
22
|
+
"message": {
|
23
|
+
"type": "string",
|
24
|
+
"max": 32767
|
25
|
+
},
|
26
|
+
"theme": {
|
27
|
+
"type": "string",
|
28
|
+
"enum": [
|
29
|
+
"dark",
|
30
|
+
"light"
|
31
|
+
]
|
32
|
+
},
|
33
|
+
"time": {
|
34
|
+
"type": "number"
|
35
|
+
}
|
36
|
+
},
|
37
|
+
"additionalProperties": false
|
38
|
+
}
|
data/schemas/dashboards.json
CHANGED
data/schemas/deviceState.json
CHANGED