losant_rest 1.10.3 → 1.10.4
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 +1375 -139
- data/docs/application.md +42 -0
- data/docs/applicationApiTokens.md +1 -1
- data/docs/applicationTemplate.md +46 -0
- data/docs/applicationTemplates.md +76 -1
- data/docs/device.md +6 -3
- data/docs/me.md +0 -36
- data/lib/losant_rest.rb +1 -0
- data/lib/losant_rest/application.rb +48 -0
- data/lib/losant_rest/application_api_tokens.rb +1 -1
- data/lib/losant_rest/application_template.rb +79 -0
- data/lib/losant_rest/application_templates.rb +89 -1
- data/lib/losant_rest/client.rb +6 -2
- data/lib/losant_rest/device.rb +9 -3
- data/lib/losant_rest/me.rb +0 -41
- data/lib/losant_rest/version.rb +1 -1
- data/schemas/application.json +8 -0
- data/schemas/applicationApiTokenPost.json +1 -0
- data/schemas/applicationApplyTemplatePatch.json +19 -0
- data/schemas/applicationCreationByTemplateResult.json +8 -0
- data/schemas/applicationPost.json +8 -0
- data/schemas/applicationTemplate.json +20 -0
- data/schemas/applicationTemplateCategories.json +43 -0
- data/schemas/applicationTemplateCategory.json +23 -0
- data/schemas/applicationTemplates.json +32 -0
- data/schemas/applications.json +8 -0
- data/schemas/changePassword.json +2 -2
- data/schemas/dashboard.json +145 -25
- data/schemas/dashboardPatch.json +145 -25
- data/schemas/dashboardPost.json +145 -25
- data/schemas/dashboards.json +145 -25
- data/schemas/dataExport.json +132 -1
- data/schemas/experienceLinkedResources.json +39 -0
- data/schemas/flow.json +13 -0
- data/schemas/flowPatch.json +13 -0
- data/schemas/flowPost.json +13 -0
- data/schemas/flowVersion.json +26 -0
- data/schemas/flowVersionPost.json +13 -0
- data/schemas/flowVersions.json +26 -0
- data/schemas/flows.json +13 -0
- data/schemas/flowsImportPost.json +26 -0
- data/schemas/flowsImportResult.json +39 -0
- data/schemas/githubLogin.json +7 -3
- data/schemas/me.json +0 -3
- data/schemas/mePatch.json +2 -2
- data/schemas/orgInviteInfo.json +3 -0
- data/schemas/orgInvitePost.json +3 -0
- data/schemas/orgInvites.json +3 -0
- data/schemas/passwordResetFinish.json +2 -2
- data/schemas/templateKeywords.json +14 -0
- data/schemas/timeSeriesData.json +12 -2
- data/schemas/timeSeriesQuery.json +94 -14
- data/schemas/userCredentials.json +5 -2
- data/schemas/userPost.json +13 -6
- metadata +11 -5
data/docs/application.md
CHANGED
@@ -6,6 +6,7 @@ parameters and the potential responses.
|
|
6
6
|
|
7
7
|
##### Contents
|
8
8
|
|
9
|
+
* [Apply Template](#apply-template)
|
9
10
|
* [Archive Data](#archive-data)
|
10
11
|
* [Backfill Archive Data](#backfill-archive-data)
|
11
12
|
* [Clone](#clone)
|
@@ -24,6 +25,47 @@ parameters and the potential responses.
|
|
24
25
|
|
25
26
|
<br/>
|
26
27
|
|
28
|
+
## Apply Template
|
29
|
+
|
30
|
+
Add resources to an application via an application template
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
result = client.application.apply_template(
|
34
|
+
applicationId: my_application_id,
|
35
|
+
options: my_options)
|
36
|
+
|
37
|
+
puts result
|
38
|
+
```
|
39
|
+
|
40
|
+
#### Authentication
|
41
|
+
The client must be configured with a valid api access token to call this
|
42
|
+
action. The token must include at least one of the following scopes:
|
43
|
+
all.Application, all.Organization, all.User, application.*, or application.applyTemplate.
|
44
|
+
|
45
|
+
#### Available Parameters
|
46
|
+
|
47
|
+
| Name | Type | Required | Description | Default | Example |
|
48
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
49
|
+
| applicationId | string | Y | ID of the associated application | | 575ec8687ae143cd83dc4a97 |
|
50
|
+
| options | [Application Apply Template Patch Schema](_schemas.md#application-apply-template-patch-schema) | Y | Object containing template import options | | [Application Apply Template Patch Schema Example](_schemas.md#application-apply-template-patch-schema-example) |
|
51
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
52
|
+
|
53
|
+
#### Successful Responses
|
54
|
+
|
55
|
+
| Code | Type | Description |
|
56
|
+
| ---- | ---- | ----------- |
|
57
|
+
| 200 | [Application](_schemas.md#application) | Updated application information |
|
58
|
+
| 202 | [Job Enqueued API Result](_schemas.md#job-enqueued-api-result) | If a job was enqueued for the resources to be imported into the application |
|
59
|
+
|
60
|
+
#### Error Responses
|
61
|
+
|
62
|
+
| Code | Type | Description |
|
63
|
+
| ---- | ---- | ----------- |
|
64
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
65
|
+
| 404 | [Error](_schemas.md#error) | Error if application is not found |
|
66
|
+
|
67
|
+
<br/>
|
68
|
+
|
27
69
|
## Archive Data
|
28
70
|
|
29
71
|
Returns success when a job has been enqueued to archive this application's device data for a given day
|
@@ -31,7 +31,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
31
31
|
| Name | Type | Required | Description | Default | Example |
|
32
32
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
33
33
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
34
|
-
| sortField | string | N | Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated | name | name |
|
34
|
+
| sortField | string | N | Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated, expirationDate | name | name |
|
35
35
|
| sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
|
36
36
|
| page | string | N | Which page of results to return | 0 | 0 |
|
37
37
|
| perPage | string | N | How many items to return per page | 1000 | 10 |
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Application Template Actions
|
2
|
+
|
3
|
+
Details on the various actions that can be performed on the
|
4
|
+
Application Template 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
|
+
Retrieves information on an application template
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
result = client.application_template.get(templateId: my_template_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.User, all.User.read, applicationTemplate.*, or applicationTemplate.get.
|
27
|
+
|
28
|
+
#### Available Parameters
|
29
|
+
|
30
|
+
| Name | Type | Required | Description | Default | Example |
|
31
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
32
|
+
| templateId | string | Y | ID associated with the template | | 575ed0de7ae143cd83dc4aa5 |
|
33
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
34
|
+
|
35
|
+
#### Successful Responses
|
36
|
+
|
37
|
+
| Code | Type | Description |
|
38
|
+
| ---- | ---- | ----------- |
|
39
|
+
| 200 | [Application Template](_schemas.md#application-template) | Application template information |
|
40
|
+
|
41
|
+
#### Error Responses
|
42
|
+
|
43
|
+
| Code | Type | Description |
|
44
|
+
| ---- | ---- | ----------- |
|
45
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
46
|
+
| 404 | [Error](_schemas.md#error) | Error if template was not found |
|
@@ -7,6 +7,8 @@ parameters and the potential responses.
|
|
7
7
|
##### Contents
|
8
8
|
|
9
9
|
* [Get](#get)
|
10
|
+
* [Get Categories](#get-categories)
|
11
|
+
* [Get Unique Keywords](#get-unique-keywords)
|
10
12
|
|
11
13
|
<br/>
|
12
14
|
|
@@ -33,8 +35,10 @@ all.User, all.User.read, applicationTemplates.*, or applicationTemplates.get.
|
|
33
35
|
| sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
|
34
36
|
| page | string | N | Which page of results to return | 0 | 0 |
|
35
37
|
| 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 |
|
38
|
+
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, authorName | | name |
|
37
39
|
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my * app |
|
40
|
+
| keywords | array | N | List of keywords to filter by. Matches all provided keywords. | | [ 'gps', 'aws' ] |
|
41
|
+
| categoryId | string | N | ID of a category to filter by. | | 575ec76c7ae143cd83dc4a96 |
|
38
42
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
39
43
|
|
40
44
|
#### Successful Responses
|
@@ -48,3 +52,74 @@ all.User, all.User.read, applicationTemplates.*, or applicationTemplates.get.
|
|
48
52
|
| Code | Type | Description |
|
49
53
|
| ---- | ---- | ----------- |
|
50
54
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
55
|
+
|
56
|
+
<br/>
|
57
|
+
|
58
|
+
## Get Categories
|
59
|
+
|
60
|
+
Returns a category list, beginning at the specified category
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
result = client.application_templates.get_categories(optional_params)
|
64
|
+
|
65
|
+
puts result
|
66
|
+
```
|
67
|
+
|
68
|
+
#### Authentication
|
69
|
+
The client must be configured with a valid api access token to call this
|
70
|
+
action. The token must include at least one of the following scopes:
|
71
|
+
all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getCategories.
|
72
|
+
|
73
|
+
#### Available Parameters
|
74
|
+
|
75
|
+
| Name | Type | Required | Description | Default | Example |
|
76
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
77
|
+
| baseId | string | N | ID of the category to begin from | | 575ed6e87ae143cd83dc4aa8 |
|
78
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
79
|
+
|
80
|
+
#### Successful Responses
|
81
|
+
|
82
|
+
| Code | Type | Description |
|
83
|
+
| ---- | ---- | ----------- |
|
84
|
+
| 200 | [Application Template Categories](_schemas.md#application-template-categories) | Collection of application categories |
|
85
|
+
|
86
|
+
#### Error Responses
|
87
|
+
|
88
|
+
| Code | Type | Description |
|
89
|
+
| ---- | ---- | ----------- |
|
90
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
91
|
+
|
92
|
+
<br/>
|
93
|
+
|
94
|
+
## Get Unique Keywords
|
95
|
+
|
96
|
+
Returns an array of all unique keywords currently in use by templates
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
result = client.application_templates.get_unique_keywords(optional_params)
|
100
|
+
|
101
|
+
puts result
|
102
|
+
```
|
103
|
+
|
104
|
+
#### Authentication
|
105
|
+
The client must be configured with a valid api access token to call this
|
106
|
+
action. The token must include at least one of the following scopes:
|
107
|
+
all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getUniqueKeywords.
|
108
|
+
|
109
|
+
#### Available Parameters
|
110
|
+
|
111
|
+
| Name | Type | Required | Description | Default | Example |
|
112
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
113
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
114
|
+
|
115
|
+
#### Successful Responses
|
116
|
+
|
117
|
+
| Code | Type | Description |
|
118
|
+
| ---- | ---- | ----------- |
|
119
|
+
| 200 | [Template Keywords](_schemas.md#template-keywords) | Array of all unique template keywords |
|
120
|
+
|
121
|
+
#### Error Responses
|
122
|
+
|
123
|
+
| Code | Type | Description |
|
124
|
+
| ---- | ---- | ----------- |
|
125
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
data/docs/device.md
CHANGED
@@ -170,8 +170,9 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
170
170
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
171
171
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
172
172
|
| deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
|
173
|
-
| limit | string | N |
|
173
|
+
| limit | string | N | Maximum number of command entries to return | 1 | 10 |
|
174
174
|
| since | string | N | Look for command entries since this time (ms since epoch) | | 1465790400000 |
|
175
|
+
| sortDirection | string | N | Direction to sort the command entries (by time). Accepted values are: asc, desc | desc | desc |
|
175
176
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
176
177
|
|
177
178
|
#### Successful Responses
|
@@ -255,8 +256,9 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
255
256
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
256
257
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
257
258
|
| deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
|
258
|
-
| limit | string | N |
|
259
|
+
| limit | string | N | Maximum number of log entries to return | 1 | 10 |
|
259
260
|
| since | string | N | Look for log entries since this time (ms since epoch) | | 1465790400000 |
|
261
|
+
| sortDirection | string | N | Direction to sort the log entries (by time). Accepted values are: asc, desc | desc | desc |
|
260
262
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
261
263
|
|
262
264
|
#### Successful Responses
|
@@ -297,8 +299,9 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
297
299
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
298
300
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
299
301
|
| deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
|
300
|
-
| limit | string | N |
|
302
|
+
| limit | string | N | Maximum number of state entries to return | 1 | 10 |
|
301
303
|
| since | string | N | Look for state entries since this time (ms since epoch) | | 1465790400000 |
|
304
|
+
| sortDirection | string | N | Direction to sort the state entries (by time). Accepted values are: asc, desc | desc | desc |
|
302
305
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
303
306
|
|
304
307
|
#### Successful Responses
|
data/docs/me.md
CHANGED
@@ -11,7 +11,6 @@ parameters and the potential responses.
|
|
11
11
|
* [Delete](#delete)
|
12
12
|
* [Disable Two Factor Auth](#disable-two-factor-auth)
|
13
13
|
* [Disconnect Github](#disconnect-github)
|
14
|
-
* [Disconnect Twitter](#disconnect-twitter)
|
15
14
|
* [Enable Two Factor Auth](#enable-two-factor-auth)
|
16
15
|
* [Fetch Recent Items](#fetch-recent-items)
|
17
16
|
* [Get](#get)
|
@@ -202,41 +201,6 @@ all.User, me.*, or me.disconnectGithub.
|
|
202
201
|
|
203
202
|
<br/>
|
204
203
|
|
205
|
-
## Disconnect Twitter
|
206
|
-
|
207
|
-
Disconnects the user from Twitter
|
208
|
-
|
209
|
-
```ruby
|
210
|
-
result = client.me.disconnect_twitter(optional_params)
|
211
|
-
|
212
|
-
puts result
|
213
|
-
```
|
214
|
-
|
215
|
-
#### Authentication
|
216
|
-
The client must be configured with a valid api access token to call this
|
217
|
-
action. The token must include at least one of the following scopes:
|
218
|
-
all.User, me.*, or me.disconnectTwitter.
|
219
|
-
|
220
|
-
#### Available Parameters
|
221
|
-
|
222
|
-
| Name | Type | Required | Description | Default | Example |
|
223
|
-
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
224
|
-
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
225
|
-
|
226
|
-
#### Successful Responses
|
227
|
-
|
228
|
-
| Code | Type | Description |
|
229
|
-
| ---- | ---- | ----------- |
|
230
|
-
| 200 | [Me](_schemas.md#me) | Updated user information |
|
231
|
-
|
232
|
-
#### Error Responses
|
233
|
-
|
234
|
-
| Code | Type | Description |
|
235
|
-
| ---- | ---- | ----------- |
|
236
|
-
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
237
|
-
|
238
|
-
<br/>
|
239
|
-
|
240
204
|
## Enable Two Factor Auth
|
241
205
|
|
242
206
|
Enables two factor auth for the current user
|
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_template"
|
35
36
|
require_relative "losant_rest/application_templates"
|
36
37
|
require_relative "losant_rest/applications"
|
37
38
|
require_relative "losant_rest/audit_log"
|
@@ -31,6 +31,54 @@ module LosantRest
|
|
31
31
|
@client = client
|
32
32
|
end
|
33
33
|
|
34
|
+
# Add resources to an application via an application template
|
35
|
+
#
|
36
|
+
# Authentication:
|
37
|
+
# The client must be configured with a valid api
|
38
|
+
# access token to call this action. The token
|
39
|
+
# must include at least one of the following scopes:
|
40
|
+
# all.Application, all.Organization, all.User, application.*, or application.applyTemplate.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} applicationId - ID of the associated application
|
44
|
+
# * {hash} options - Object containing template import options (https://api.losant.com/#/definitions/applicationApplyTemplatePatch)
|
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 - Updated application information (https://api.losant.com/#/definitions/application)
|
52
|
+
# * 202 - If a job was enqueued for the resources to be imported into the application (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
53
|
+
#
|
54
|
+
# Errors:
|
55
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
56
|
+
# * 404 - Error if application is not found (https://api.losant.com/#/definitions/error)
|
57
|
+
def apply_template(params = {})
|
58
|
+
params = Utils.symbolize_hash_keys(params)
|
59
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
60
|
+
headers = {}
|
61
|
+
body = nil
|
62
|
+
|
63
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
64
|
+
raise ArgumentError.new("options is required") unless params.has_key?(:options)
|
65
|
+
|
66
|
+
body = params[:options] if params.has_key?(:options)
|
67
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
68
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
69
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
70
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
71
|
+
|
72
|
+
path = "/applications/#{params[:applicationId]}/applyTemplate"
|
73
|
+
|
74
|
+
@client.request(
|
75
|
+
method: :patch,
|
76
|
+
path: path,
|
77
|
+
query: query_params,
|
78
|
+
headers: headers,
|
79
|
+
body: body)
|
80
|
+
end
|
81
|
+
|
34
82
|
# Returns success when a job has been enqueued to archive this application's device data for a given day
|
35
83
|
#
|
36
84
|
# Authentication:
|
@@ -41,7 +41,7 @@ module LosantRest
|
|
41
41
|
#
|
42
42
|
# Parameters:
|
43
43
|
# * {string} applicationId - ID associated with the application
|
44
|
-
# * {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated
|
44
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated, expirationDate
|
45
45
|
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
46
46
|
# * {string} page - Which page of results to return
|
47
47
|
# * {string} perPage - How many items to return per page
|
@@ -0,0 +1,79 @@
|
|
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 Template Resource
|
28
|
+
class ApplicationTemplate
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# Retrieves information on an application template
|
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, applicationTemplate.*, or applicationTemplate.get.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} templateId - ID associated with the template
|
44
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
45
|
+
# * {boolean} _actions - Return resource actions in response
|
46
|
+
# * {boolean} _links - Return resource link in response
|
47
|
+
# * {boolean} _embedded - Return embedded resources in response
|
48
|
+
#
|
49
|
+
# Responses:
|
50
|
+
# * 200 - Application template information (https://api.losant.com/#/definitions/applicationTemplate)
|
51
|
+
#
|
52
|
+
# Errors:
|
53
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
54
|
+
# * 404 - Error if template was not found (https://api.losant.com/#/definitions/error)
|
55
|
+
def get(params = {})
|
56
|
+
params = Utils.symbolize_hash_keys(params)
|
57
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
58
|
+
headers = {}
|
59
|
+
body = nil
|
60
|
+
|
61
|
+
raise ArgumentError.new("templateId is required") unless params.has_key?(:templateId)
|
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 = "/applicationTemplates/#{params[:templateId]}"
|
69
|
+
|
70
|
+
@client.request(
|
71
|
+
method: :get,
|
72
|
+
path: path,
|
73
|
+
query: query_params,
|
74
|
+
headers: headers,
|
75
|
+
body: body)
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -44,8 +44,10 @@ module LosantRest
|
|
44
44
|
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
45
45
|
# * {string} page - Which page of results to return
|
46
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
|
47
|
+
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, authorName
|
48
48
|
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
49
|
+
# * {array} keywords - List of keywords to filter by. Matches all provided keywords.
|
50
|
+
# * {string} categoryId - ID of a category to filter by.
|
49
51
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
50
52
|
# * {boolean} _actions - Return resource actions in response
|
51
53
|
# * {boolean} _links - Return resource link in response
|
@@ -69,6 +71,8 @@ module LosantRest
|
|
69
71
|
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
70
72
|
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
71
73
|
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
74
|
+
query_params[:keywords] = params[:keywords] if params.has_key?(:keywords)
|
75
|
+
query_params[:categoryId] = params[:categoryId] if params.has_key?(:categoryId)
|
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)
|
@@ -84,5 +88,89 @@ module LosantRest
|
|
84
88
|
body: body)
|
85
89
|
end
|
86
90
|
|
91
|
+
# Returns a category list, beginning at the specified category
|
92
|
+
#
|
93
|
+
# Authentication:
|
94
|
+
# The client must be configured with a valid api
|
95
|
+
# access token to call this action. The token
|
96
|
+
# must include at least one of the following scopes:
|
97
|
+
# all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getCategories.
|
98
|
+
#
|
99
|
+
# Parameters:
|
100
|
+
# * {string} baseId - ID of the category to begin from
|
101
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
102
|
+
# * {boolean} _actions - Return resource actions in response
|
103
|
+
# * {boolean} _links - Return resource link in response
|
104
|
+
# * {boolean} _embedded - Return embedded resources in response
|
105
|
+
#
|
106
|
+
# Responses:
|
107
|
+
# * 200 - Collection of application categories (https://api.losant.com/#/definitions/applicationTemplateCategories)
|
108
|
+
#
|
109
|
+
# Errors:
|
110
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
111
|
+
def get_categories(params = {})
|
112
|
+
params = Utils.symbolize_hash_keys(params)
|
113
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
114
|
+
headers = {}
|
115
|
+
body = nil
|
116
|
+
|
117
|
+
|
118
|
+
query_params[:baseId] = params[:baseId] if params.has_key?(:baseId)
|
119
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
120
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
121
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
122
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
123
|
+
|
124
|
+
path = "/applicationTemplates/categories"
|
125
|
+
|
126
|
+
@client.request(
|
127
|
+
method: :get,
|
128
|
+
path: path,
|
129
|
+
query: query_params,
|
130
|
+
headers: headers,
|
131
|
+
body: body)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Returns an array of all unique keywords currently in use by templates
|
135
|
+
#
|
136
|
+
# Authentication:
|
137
|
+
# The client must be configured with a valid api
|
138
|
+
# access token to call this action. The token
|
139
|
+
# must include at least one of the following scopes:
|
140
|
+
# all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getUniqueKeywords.
|
141
|
+
#
|
142
|
+
# Parameters:
|
143
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
144
|
+
# * {boolean} _actions - Return resource actions in response
|
145
|
+
# * {boolean} _links - Return resource link in response
|
146
|
+
# * {boolean} _embedded - Return embedded resources in response
|
147
|
+
#
|
148
|
+
# Responses:
|
149
|
+
# * 200 - Array of all unique template keywords (https://api.losant.com/#/definitions/templateKeywords)
|
150
|
+
#
|
151
|
+
# Errors:
|
152
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
153
|
+
def get_unique_keywords(params = {})
|
154
|
+
params = Utils.symbolize_hash_keys(params)
|
155
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
156
|
+
headers = {}
|
157
|
+
body = nil
|
158
|
+
|
159
|
+
|
160
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
161
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
162
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
163
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
164
|
+
|
165
|
+
path = "/applicationTemplates/keywords"
|
166
|
+
|
167
|
+
@client.request(
|
168
|
+
method: :get,
|
169
|
+
path: path,
|
170
|
+
query: query_params,
|
171
|
+
headers: headers,
|
172
|
+
body: body)
|
173
|
+
end
|
174
|
+
|
87
175
|
end
|
88
176
|
end
|