losant_rest 1.9.2 → 1.9.3
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 +9757 -8758
- data/docs/application.md +81 -2
- data/docs/applicationTemplates.md +50 -0
- data/docs/auth.md +72 -0
- data/docs/devices.md +1 -0
- data/lib/losant_rest/application.rb +93 -2
- data/lib/losant_rest/application_templates.rb +88 -0
- data/lib/losant_rest/auth.rb +84 -0
- data/lib/losant_rest/client.rb +6 -2
- data/lib/losant_rest/devices.rb +3 -0
- data/lib/losant_rest/version.rb +2 -2
- data/lib/losant_rest.rb +1 -0
- data/schemas/advancedDeviceQuery.json +901 -0
- data/schemas/advancedEventQuery.json +177 -13
- data/schemas/advancedQuery.json +3 -0
- data/schemas/application.json +2 -2
- data/schemas/applicationCreationByTemplateResult.json +2 -2
- data/schemas/applicationPatch.json +2 -2
- data/schemas/applicationPost.json +6 -2
- data/schemas/applicationReadme.json +29 -0
- data/schemas/applicationReadmePatch.json +11 -0
- data/schemas/applicationTemplate.json +87 -0
- data/schemas/applicationTemplates.json +128 -0
- data/schemas/applications.json +2 -2
- data/schemas/dashboard.json +4 -0
- data/schemas/dashboardPatch.json +4 -0
- data/schemas/dashboardPost.json +4 -0
- data/schemas/dashboards.json +4 -0
- data/schemas/dataTableRows.json +3 -0
- data/schemas/dataTableRowsExport.json +3 -0
- data/schemas/devices.json +3 -0
- data/schemas/events.json +1 -816
- data/schemas/eventsExport.json +177 -13
- data/schemas/githubLogin.json +2 -0
- data/schemas/me.json +3 -0
- data/schemas/org.json +8 -0
- data/schemas/orgPatch.json +9 -0
- data/schemas/orgPost.json +9 -0
- data/schemas/orgs.json +8 -0
- data/schemas/samlResponse.json +21 -0
- data/schemas/ssoRequest.json +20 -0
- data/schemas/userCredentials.json +2 -0
- data/schemas/userPost.json +2 -0
- metadata +12 -4
data/docs/application.md
CHANGED
@@ -17,6 +17,8 @@ parameters and the potential responses.
|
|
17
17
|
* [Mqtt Publish Message](#mqtt-publish-message)
|
18
18
|
* [Patch](#patch)
|
19
19
|
* [Payload Counts](#payload-counts)
|
20
|
+
* [Readme](#readme)
|
21
|
+
* [Readme Patch](#readme-patch)
|
20
22
|
* [Search](#search)
|
21
23
|
|
22
24
|
<br/>
|
@@ -63,7 +65,7 @@ all.Application, all.Organization, all.User, application.*, or application.archi
|
|
63
65
|
|
64
66
|
## Backfill Archive Data
|
65
67
|
|
66
|
-
Returns success when a job has been enqueued to backfill all current data to
|
68
|
+
Returns success when a job has been enqueued to backfill all current data to its archive
|
67
69
|
|
68
70
|
```ruby
|
69
71
|
result = client.application.backfill_archive_data(applicationId: my_application_id)
|
@@ -178,7 +180,7 @@ all.Application, all.Organization, all.User, application.*, or application.delet
|
|
178
180
|
|
179
181
|
## Export
|
180
182
|
|
181
|
-
Export an application and all of
|
183
|
+
Export an application and all of its resources
|
182
184
|
|
183
185
|
```ruby
|
184
186
|
result = client.application.export(
|
@@ -451,6 +453,83 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
451
453
|
|
452
454
|
<br/>
|
453
455
|
|
456
|
+
## Readme
|
457
|
+
|
458
|
+
Get the current application readme information
|
459
|
+
|
460
|
+
```ruby
|
461
|
+
result = client.application.readme(applicationId: my_application_id)
|
462
|
+
|
463
|
+
puts result
|
464
|
+
```
|
465
|
+
|
466
|
+
#### Authentication
|
467
|
+
The client must be configured with a valid api access token to call this
|
468
|
+
action. The token must include at least one of the following scopes:
|
469
|
+
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.get.
|
470
|
+
|
471
|
+
#### Available Parameters
|
472
|
+
|
473
|
+
| Name | Type | Required | Description | Default | Example |
|
474
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
475
|
+
| applicationId | string | Y | ID of the associated application | | 575ec8687ae143cd83dc4a97 |
|
476
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
477
|
+
|
478
|
+
#### Successful Responses
|
479
|
+
|
480
|
+
| Code | Type | Description |
|
481
|
+
| ---- | ---- | ----------- |
|
482
|
+
| 200 | [Application Readme](_schemas.md#application-readme) | The application readme information |
|
483
|
+
|
484
|
+
#### Error Responses
|
485
|
+
|
486
|
+
| Code | Type | Description |
|
487
|
+
| ---- | ---- | ----------- |
|
488
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
489
|
+
| 404 | [Error](_schemas.md#error) | Error if application was not found |
|
490
|
+
|
491
|
+
<br/>
|
492
|
+
|
493
|
+
## Readme Patch
|
494
|
+
|
495
|
+
Update the current application readme information
|
496
|
+
|
497
|
+
```ruby
|
498
|
+
result = client.application.readme_patch(
|
499
|
+
applicationId: my_application_id,
|
500
|
+
readme: my_readme)
|
501
|
+
|
502
|
+
puts result
|
503
|
+
```
|
504
|
+
|
505
|
+
#### Authentication
|
506
|
+
The client must be configured with a valid api access token to call this
|
507
|
+
action. The token must include at least one of the following scopes:
|
508
|
+
all.Application, all.Organization, all.User, application.*, or application.patch.
|
509
|
+
|
510
|
+
#### Available Parameters
|
511
|
+
|
512
|
+
| Name | Type | Required | Description | Default | Example |
|
513
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
514
|
+
| applicationId | string | Y | ID of the associated application | | 575ec8687ae143cd83dc4a97 |
|
515
|
+
| readme | [Application Readme Patch](_schemas.md#application-readme-patch) | Y | Object containing new readme information | | [Application Readme Patch Example](_schemas.md#application-readme-patch-example) |
|
516
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
517
|
+
|
518
|
+
#### Successful Responses
|
519
|
+
|
520
|
+
| Code | Type | Description |
|
521
|
+
| ---- | ---- | ----------- |
|
522
|
+
| 200 | [Application Readme](_schemas.md#application-readme) | Updated readme information |
|
523
|
+
|
524
|
+
#### Error Responses
|
525
|
+
|
526
|
+
| Code | Type | Description |
|
527
|
+
| ---- | ---- | ----------- |
|
528
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
529
|
+
| 404 | [Error](_schemas.md#error) | Error if application was not found |
|
530
|
+
|
531
|
+
<br/>
|
532
|
+
|
454
533
|
## Search
|
455
534
|
|
456
535
|
Search across an application's resources by target identifier
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Application Templates Actions
|
2
|
+
|
3
|
+
Details on the various actions that can be performed on the
|
4
|
+
Application Templates 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 application templates the current user has permission to see
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
result = client.application_templates.get(optional_params)
|
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.User, all.User.read, applicationTemplates.*, or applicationTemplates.get.
|
27
|
+
|
28
|
+
#### Available Parameters
|
29
|
+
|
30
|
+
| Name | Type | Required | Description | Default | Example |
|
31
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
32
|
+
| sortField | string | N | Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated | name | name |
|
33
|
+
| sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
|
34
|
+
| page | string | N | Which page of results to return | 0 | 0 |
|
35
|
+
| perPage | string | N | How many items to return per page | 1000 | 10 |
|
36
|
+
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | name |
|
37
|
+
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my * app |
|
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 Templates](_schemas.md#application-templates) | Collection of application templates |
|
45
|
+
|
46
|
+
#### Error Responses
|
47
|
+
|
48
|
+
| Code | Type | Description |
|
49
|
+
| ---- | ---- | ----------- |
|
50
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
data/docs/auth.md
CHANGED
@@ -9,6 +9,8 @@ parameters and the potential responses.
|
|
9
9
|
* [Authenticate Device](#authenticate-device)
|
10
10
|
* [Authenticate User](#authenticate-user)
|
11
11
|
* [Authenticate User Github](#authenticate-user-github)
|
12
|
+
* [Authenticate User Saml](#authenticate-user-saml)
|
13
|
+
* [Sso Domain](#sso-domain)
|
12
14
|
|
13
15
|
<br/>
|
14
16
|
|
@@ -114,3 +116,73 @@ No api access token is required to call this action.
|
|
114
116
|
| ---- | ---- | ----------- |
|
115
117
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
116
118
|
| 401 | [Error](_schemas.md#error) | Unauthorized error if authentication fails |
|
119
|
+
|
120
|
+
<br/>
|
121
|
+
|
122
|
+
## Authenticate User Saml
|
123
|
+
|
124
|
+
Authenticates a user via a SAML response.
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
result = client.auth.authenticate_user_saml(saml: my_saml)
|
128
|
+
|
129
|
+
puts result
|
130
|
+
```
|
131
|
+
|
132
|
+
#### Authentication
|
133
|
+
No api access token is required to call this action.
|
134
|
+
|
135
|
+
#### Available Parameters
|
136
|
+
|
137
|
+
| Name | Type | Required | Description | Default | Example |
|
138
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
139
|
+
| saml | [SAML Response](_schemas.md#saml-response) | Y | Encoded SAML response from an IDP for a user. | | [SAML Response Example](_schemas.md#saml-response-example) |
|
140
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
141
|
+
|
142
|
+
#### Successful Responses
|
143
|
+
|
144
|
+
| Code | Type | Description |
|
145
|
+
| ---- | ---- | ----------- |
|
146
|
+
| 200 | [Authenticated User](_schemas.md#authenticated-user) | Successful authentication. The included api access token has the scope 'all.User'. |
|
147
|
+
|
148
|
+
#### Error Responses
|
149
|
+
|
150
|
+
| Code | Type | Description |
|
151
|
+
| ---- | ---- | ----------- |
|
152
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
153
|
+
| 401 | [Error](_schemas.md#error) | Unauthorized error if authentication fails |
|
154
|
+
|
155
|
+
<br/>
|
156
|
+
|
157
|
+
## Sso Domain
|
158
|
+
|
159
|
+
Checks email domain for SSO configuration.
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
result = client.auth.sso_domain(email: my_email)
|
163
|
+
|
164
|
+
puts result
|
165
|
+
```
|
166
|
+
|
167
|
+
#### Authentication
|
168
|
+
No api access token is required to call this action.
|
169
|
+
|
170
|
+
#### Available Parameters
|
171
|
+
|
172
|
+
| Name | Type | Required | Description | Default | Example |
|
173
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
174
|
+
| email | string | Y | The email address associated with the user login | | example@example.com |
|
175
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
176
|
+
|
177
|
+
#### Successful Responses
|
178
|
+
|
179
|
+
| Code | Type | Description |
|
180
|
+
| ---- | ---- | ----------- |
|
181
|
+
| 200 | [SSO Request](_schemas.md#sso-request) | Successful finding SSO for domain. Returns SSO request URL and type. |
|
182
|
+
| 204 | undefined | No domain associated with an SSO configuration |
|
183
|
+
|
184
|
+
#### Error Responses
|
185
|
+
|
186
|
+
| Code | Type | Description |
|
187
|
+
| ---- | ---- | ----------- |
|
188
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
data/docs/devices.md
CHANGED
@@ -83,6 +83,7 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
83
83
|
| tagFilter | [Device Tag Filter](_schemas.md#device-tag-filter) | N | Array of tag pairs to filter by | | [Device Tag Filter Example](_schemas.md#device-tag-filter-example) |
|
84
84
|
| excludeConnectionInfo | string | N | If set, do not return connection info | | true |
|
85
85
|
| parentId | string | N | Filter devices as children of a given system id | | 575ecf887ae143cd83dc4aa2 |
|
86
|
+
| query | [Advanced Device Query](_schemas.md#advanced-device-query) | N | Device filter JSON object which overides the filterField, filter, deviceClass, tagFilter, and parentId parameters. | | [Advanced Device Query Example](_schemas.md#advanced-device-query-example) |
|
86
87
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
87
88
|
|
88
89
|
#### Successful Responses
|
@@ -78,7 +78,7 @@ module LosantRest
|
|
78
78
|
body: body)
|
79
79
|
end
|
80
80
|
|
81
|
-
# Returns success when a job has been enqueued to backfill all current data to
|
81
|
+
# Returns success when a job has been enqueued to backfill all current data to its archive
|
82
82
|
#
|
83
83
|
# Authentication:
|
84
84
|
# The client must be configured with a valid api
|
@@ -215,7 +215,7 @@ module LosantRest
|
|
215
215
|
body: body)
|
216
216
|
end
|
217
217
|
|
218
|
-
# Export an application and all of
|
218
|
+
# Export an application and all of its resources
|
219
219
|
#
|
220
220
|
# Authentication:
|
221
221
|
# The client must be configured with a valid api
|
@@ -545,6 +545,97 @@ module LosantRest
|
|
545
545
|
body: body)
|
546
546
|
end
|
547
547
|
|
548
|
+
# Get the current application readme information
|
549
|
+
#
|
550
|
+
# Authentication:
|
551
|
+
# The client must be configured with a valid api
|
552
|
+
# access token to call this action. The token
|
553
|
+
# must include at least one of the following scopes:
|
554
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.get.
|
555
|
+
#
|
556
|
+
# Parameters:
|
557
|
+
# * {string} applicationId - ID of the associated application
|
558
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
559
|
+
# * {boolean} _actions - Return resource actions in response
|
560
|
+
# * {boolean} _links - Return resource link in response
|
561
|
+
# * {boolean} _embedded - Return embedded resources in response
|
562
|
+
#
|
563
|
+
# Responses:
|
564
|
+
# * 200 - The application readme information (https://api.losant.com/#/definitions/applicationReadme)
|
565
|
+
#
|
566
|
+
# Errors:
|
567
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
568
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
569
|
+
def readme(params = {})
|
570
|
+
params = Utils.symbolize_hash_keys(params)
|
571
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
572
|
+
headers = {}
|
573
|
+
body = nil
|
574
|
+
|
575
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
576
|
+
|
577
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
578
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
579
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
580
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
581
|
+
|
582
|
+
path = "/applications/#{params[:applicationId]}/readme"
|
583
|
+
|
584
|
+
@client.request(
|
585
|
+
method: :get,
|
586
|
+
path: path,
|
587
|
+
query: query_params,
|
588
|
+
headers: headers,
|
589
|
+
body: body)
|
590
|
+
end
|
591
|
+
|
592
|
+
# Update the current application readme information
|
593
|
+
#
|
594
|
+
# Authentication:
|
595
|
+
# The client must be configured with a valid api
|
596
|
+
# access token to call this action. The token
|
597
|
+
# must include at least one of the following scopes:
|
598
|
+
# all.Application, all.Organization, all.User, application.*, or application.patch.
|
599
|
+
#
|
600
|
+
# Parameters:
|
601
|
+
# * {string} applicationId - ID of the associated application
|
602
|
+
# * {hash} readme - Object containing new readme information (https://api.losant.com/#/definitions/applicationReadmePatch)
|
603
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
604
|
+
# * {boolean} _actions - Return resource actions in response
|
605
|
+
# * {boolean} _links - Return resource link in response
|
606
|
+
# * {boolean} _embedded - Return embedded resources in response
|
607
|
+
#
|
608
|
+
# Responses:
|
609
|
+
# * 200 - Updated readme information (https://api.losant.com/#/definitions/applicationReadme)
|
610
|
+
#
|
611
|
+
# Errors:
|
612
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
613
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
614
|
+
def readme_patch(params = {})
|
615
|
+
params = Utils.symbolize_hash_keys(params)
|
616
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
617
|
+
headers = {}
|
618
|
+
body = nil
|
619
|
+
|
620
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
621
|
+
raise ArgumentError.new("readme is required") unless params.has_key?(:readme)
|
622
|
+
|
623
|
+
body = params[:readme] if params.has_key?(:readme)
|
624
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
625
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
626
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
627
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
628
|
+
|
629
|
+
path = "/applications/#{params[:applicationId]}/readme"
|
630
|
+
|
631
|
+
@client.request(
|
632
|
+
method: :patch,
|
633
|
+
path: path,
|
634
|
+
query: query_params,
|
635
|
+
headers: headers,
|
636
|
+
body: body)
|
637
|
+
end
|
638
|
+
|
548
639
|
# Search across an application's resources by target identifier
|
549
640
|
#
|
550
641
|
# Authentication:
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2020 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 LosantRest
|
26
|
+
|
27
|
+
# Class containing all the actions for the Application Templates Resource
|
28
|
+
class ApplicationTemplates
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the application templates the current user has permission to see
|
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.User, all.User.read, applicationTemplates.*, or applicationTemplates.get.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
|
44
|
+
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
45
|
+
# * {string} page - Which page of results to return
|
46
|
+
# * {string} perPage - How many items to return per page
|
47
|
+
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
48
|
+
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
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 templates (https://api.losant.com/#/definitions/applicationTemplates)
|
56
|
+
#
|
57
|
+
# Errors:
|
58
|
+
# * 400 - Error if malformed request (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
|
+
|
66
|
+
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
67
|
+
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
68
|
+
query_params[:page] = params[:page] if params.has_key?(:page)
|
69
|
+
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
70
|
+
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
71
|
+
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
72
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
73
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
74
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
75
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
76
|
+
|
77
|
+
path = "/applicationTemplates"
|
78
|
+
|
79
|
+
@client.request(
|
80
|
+
method: :get,
|
81
|
+
path: path,
|
82
|
+
query: query_params,
|
83
|
+
headers: headers,
|
84
|
+
body: body)
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
data/lib/losant_rest/auth.rb
CHANGED
@@ -157,5 +157,89 @@ module LosantRest
|
|
157
157
|
body: body)
|
158
158
|
end
|
159
159
|
|
160
|
+
# Authenticates a user via a SAML response.
|
161
|
+
#
|
162
|
+
# Authentication:
|
163
|
+
# No api access token is required to call this action.
|
164
|
+
#
|
165
|
+
# Parameters:
|
166
|
+
# * {hash} saml - Encoded SAML response from an IDP for a user. (https://api.losant.com/#/definitions/samlResponse)
|
167
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
168
|
+
# * {boolean} _actions - Return resource actions in response
|
169
|
+
# * {boolean} _links - Return resource link in response
|
170
|
+
# * {boolean} _embedded - Return embedded resources in response
|
171
|
+
#
|
172
|
+
# Responses:
|
173
|
+
# * 200 - Successful authentication. The included api access token has the scope 'all.User'. (https://api.losant.com/#/definitions/authedUser)
|
174
|
+
#
|
175
|
+
# Errors:
|
176
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
177
|
+
# * 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
|
178
|
+
def authenticate_user_saml(params = {})
|
179
|
+
params = Utils.symbolize_hash_keys(params)
|
180
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
181
|
+
headers = {}
|
182
|
+
body = nil
|
183
|
+
|
184
|
+
raise ArgumentError.new("saml is required") unless params.has_key?(:saml)
|
185
|
+
|
186
|
+
body = params[:saml] if params.has_key?(:saml)
|
187
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
188
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
189
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
190
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
191
|
+
|
192
|
+
path = "/auth/user/saml"
|
193
|
+
|
194
|
+
@client.request(
|
195
|
+
method: :post,
|
196
|
+
path: path,
|
197
|
+
query: query_params,
|
198
|
+
headers: headers,
|
199
|
+
body: body)
|
200
|
+
end
|
201
|
+
|
202
|
+
# Checks email domain for SSO configuration.
|
203
|
+
#
|
204
|
+
# Authentication:
|
205
|
+
# No api access token is required to call this action.
|
206
|
+
#
|
207
|
+
# Parameters:
|
208
|
+
# * {string} email - The email address associated with the user login
|
209
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
210
|
+
# * {boolean} _actions - Return resource actions in response
|
211
|
+
# * {boolean} _links - Return resource link in response
|
212
|
+
# * {boolean} _embedded - Return embedded resources in response
|
213
|
+
#
|
214
|
+
# Responses:
|
215
|
+
# * 200 - Successful finding SSO for domain. Returns SSO request URL and type. (https://api.losant.com/#/definitions/ssoRequest)
|
216
|
+
# * 204 - No domain associated with an SSO configuration
|
217
|
+
#
|
218
|
+
# Errors:
|
219
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
220
|
+
def sso_domain(params = {})
|
221
|
+
params = Utils.symbolize_hash_keys(params)
|
222
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
223
|
+
headers = {}
|
224
|
+
body = nil
|
225
|
+
|
226
|
+
raise ArgumentError.new("email is required") unless params.has_key?(:email)
|
227
|
+
|
228
|
+
query_params[:email] = params[:email] if params.has_key?(:email)
|
229
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
230
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
231
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
232
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
233
|
+
|
234
|
+
path = "/auth/ssoDomain"
|
235
|
+
|
236
|
+
@client.request(
|
237
|
+
method: :get,
|
238
|
+
path: path,
|
239
|
+
query: query_params,
|
240
|
+
headers: headers,
|
241
|
+
body: body)
|
242
|
+
end
|
243
|
+
|
160
244
|
end
|
161
245
|
end
|
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.16.
|
30
|
+
# Built For Version 1.16.4
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -72,6 +72,10 @@ module LosantRest
|
|
72
72
|
@application_keys ||= ApplicationKeys.new(self)
|
73
73
|
end
|
74
74
|
|
75
|
+
def application_templates
|
76
|
+
@application_templates ||= ApplicationTemplates.new(self)
|
77
|
+
end
|
78
|
+
|
75
79
|
def applications
|
76
80
|
@applications ||= Applications.new(self)
|
77
81
|
end
|
@@ -274,7 +278,7 @@ module LosantRest
|
|
274
278
|
|
275
279
|
headers["Accept"] = "application/json"
|
276
280
|
headers["Content-Type"] = "application/json"
|
277
|
-
headers["Accept-Version"] = "^1.16.
|
281
|
+
headers["Accept-Version"] = "^1.16.4"
|
278
282
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
279
283
|
path = self.url + options.fetch(:path, "")
|
280
284
|
|
data/lib/losant_rest/devices.rb
CHANGED
@@ -99,6 +99,7 @@ module LosantRest
|
|
99
99
|
# * {hash} tagFilter - Array of tag pairs to filter by (https://api.losant.com/#/definitions/deviceTagFilter)
|
100
100
|
# * {string} excludeConnectionInfo - If set, do not return connection info
|
101
101
|
# * {string} parentId - Filter devices as children of a given system id
|
102
|
+
# * {hash} query - Device filter JSON object which overides the filterField, filter, deviceClass, tagFilter, and parentId parameters. (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
102
103
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
103
104
|
# * {boolean} _actions - Return resource actions in response
|
104
105
|
# * {boolean} _links - Return resource link in response
|
@@ -128,6 +129,8 @@ module LosantRest
|
|
128
129
|
query_params[:tagFilter] = params[:tagFilter] if params.has_key?(:tagFilter)
|
129
130
|
query_params[:excludeConnectionInfo] = params[:excludeConnectionInfo] if params.has_key?(:excludeConnectionInfo)
|
130
131
|
query_params[:parentId] = params[:parentId] if params.has_key?(:parentId)
|
132
|
+
query_params[:query] = params[:query] if params.has_key?(:query)
|
133
|
+
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
131
134
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
132
135
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
133
136
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/losant_rest/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2020 Losant IoT, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -21,5 +21,5 @@
|
|
21
21
|
# SOFTWARE.
|
22
22
|
|
23
23
|
module LosantRest
|
24
|
-
VERSION = "1.9.
|
24
|
+
VERSION = "1.9.3"
|
25
25
|
end
|
data/lib/losant_rest.rb
CHANGED
@@ -32,6 +32,7 @@ require_relative "losant_rest/application_certificate_authority"
|
|
32
32
|
require_relative "losant_rest/application_certificates"
|
33
33
|
require_relative "losant_rest/application_key"
|
34
34
|
require_relative "losant_rest/application_keys"
|
35
|
+
require_relative "losant_rest/application_templates"
|
35
36
|
require_relative "losant_rest/applications"
|
36
37
|
require_relative "losant_rest/audit_log"
|
37
38
|
require_relative "losant_rest/audit_logs"
|