losant_rest 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/docs/dashboards.md CHANGED
@@ -24,7 +24,7 @@ puts result
24
24
  #### Authentication
25
25
  The client must be configured with a valid api access token to call this
26
26
  action. The token must include at least one of the following scopes:
27
- all.Organization, all.SolutionUser, all.SolutionUser.read, all.User, dashboards.*, or dashboards.get.
27
+ all.Organization, all.Organization.read, all.SolutionUser, all.SolutionUser.read, all.User, all.User.read, dashboards.*, or dashboards.get.
28
28
 
29
29
  #### Available Parameters
30
30
 
@@ -34,7 +34,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
34
34
  | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
35
35
  | sortField | string | N | Field to sort the results by. Accepted values are: order, method, route, id, creationDate, requestCount | order | position |
36
36
  | sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
37
- | filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: method, route | | email |
37
+ | filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: method, route | | method |
38
38
  | filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*route |
39
39
  | experienceGroupId | string | N | Filter endpoints to those only in the specified group | | 575ec8687ae143cd83dc4a97 |
40
40
  | requestCountDuration | string | N | If set, a count of recent requests is included on each endpoint for the duration requested (milliseconds) | | 86400000 |
@@ -0,0 +1,130 @@
1
+ # Experience Template Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Experience Template resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Delete](#delete)
10
+ * [Get](#get)
11
+ * [Patch](#patch)
12
+
13
+ <br/>
14
+
15
+ ## Delete
16
+
17
+ Deletes an experience template
18
+
19
+ ```ruby
20
+ result = client.experience_template.delete(
21
+ applicationId: my_application_id,
22
+ experienceTemplateId: my_experience_template_id)
23
+
24
+ puts result
25
+ ```
26
+
27
+ #### Authentication
28
+ The client must be configured with a valid api access token to call this
29
+ action. The token must include at least one of the following scopes:
30
+ all.Application, all.Organization, all.User, experienceTemplate.*, or experienceTemplate.delete.
31
+
32
+ #### Available Parameters
33
+
34
+ | Name | Type | Required | Description | Default | Example |
35
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
36
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
37
+ | experienceTemplateId | string | Y | ID associated with the experience template | | 575ed78e7ae143cd83dc4aab |
38
+
39
+ #### Successful Responses
40
+
41
+ | Code | Type | Description |
42
+ | ---- | ---- | ----------- |
43
+ | 200 | [Success](_schemas.md#success) | If experience template was successfully deleted |
44
+
45
+ #### Error Responses
46
+
47
+ | Code | Type | Description |
48
+ | ---- | ---- | ----------- |
49
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
50
+ | 404 | [Error](_schemas.md#error) | Error if experience template was not found |
51
+
52
+ <br/>
53
+
54
+ ## Get
55
+
56
+ Retrieves information on an experience template
57
+
58
+ ```ruby
59
+ result = client.experience_template.get(
60
+ applicationId: my_application_id,
61
+ experienceTemplateId: my_experience_template_id)
62
+
63
+ puts result
64
+ ```
65
+
66
+ #### Authentication
67
+ The client must be configured with a valid api access token to call this
68
+ action. The token must include at least one of the following scopes:
69
+ all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceTemplate.*, or experienceTemplate.get.
70
+
71
+ #### Available Parameters
72
+
73
+ | Name | Type | Required | Description | Default | Example |
74
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
75
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
76
+ | experienceTemplateId | string | Y | ID associated with the experience template | | 575ed78e7ae143cd83dc4aab |
77
+
78
+ #### Successful Responses
79
+
80
+ | Code | Type | Description |
81
+ | ---- | ---- | ----------- |
82
+ | 200 | [Experience Template](_schemas.md#experience-template) | Experience template information |
83
+
84
+ #### Error Responses
85
+
86
+ | Code | Type | Description |
87
+ | ---- | ---- | ----------- |
88
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
89
+ | 404 | [Error](_schemas.md#error) | Error if experience template was not found |
90
+
91
+ <br/>
92
+
93
+ ## Patch
94
+
95
+ Updates information about an experience template
96
+
97
+ ```ruby
98
+ result = client.experience_template.patch(
99
+ applicationId: my_application_id,
100
+ experienceTemplateId: my_experience_template_id,
101
+ experienceTemplate: my_experience_template)
102
+
103
+ puts result
104
+ ```
105
+
106
+ #### Authentication
107
+ The client must be configured with a valid api access token to call this
108
+ action. The token must include at least one of the following scopes:
109
+ all.Application, all.Organization, all.User, experienceTemplate.*, or experienceTemplate.patch.
110
+
111
+ #### Available Parameters
112
+
113
+ | Name | Type | Required | Description | Default | Example |
114
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
115
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
116
+ | experienceTemplateId | string | Y | ID associated with the experience template | | 575ed78e7ae143cd83dc4aab |
117
+ | experienceTemplate | [Experience Template Patch](_schemas.md#experience-template-patch) | Y | Object containing new properties of the experience template | | [Experience Template Patch Example](_schemas.md#experience-template-patch-example) |
118
+
119
+ #### Successful Responses
120
+
121
+ | Code | Type | Description |
122
+ | ---- | ---- | ----------- |
123
+ | 200 | [Experience Template](_schemas.md#experience-template) | Updated experience template information |
124
+
125
+ #### Error Responses
126
+
127
+ | Code | Type | Description |
128
+ | ---- | ---- | ----------- |
129
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
130
+ | 404 | [Error](_schemas.md#error) | Error if experience template was not found |
@@ -0,0 +1,92 @@
1
+ # Experience Templates Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Experience Templates resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Get](#get)
10
+ * [Post](#post)
11
+
12
+ <br/>
13
+
14
+ ## Get
15
+
16
+ Returns the experience templates for an application
17
+
18
+ ```ruby
19
+ result = client.experience_templates.get(applicationId: my_application_id)
20
+
21
+ puts result
22
+ ```
23
+
24
+ #### Authentication
25
+ The client must be configured with a valid api access token to call this
26
+ action. The token must include at least one of the following scopes:
27
+ all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceTemplates.*, or experienceTemplates.get.
28
+
29
+ #### Available Parameters
30
+
31
+ | Name | Type | Required | Description | Default | Example |
32
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
33
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
34
+ | sortField | string | N | Field to sort the results by. Accepted values are: id, creationDate, name | name | name |
35
+ | sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
36
+ | page | string | N | Which page of results to return | 0 | 0 |
37
+ | perPage | string | N | How many items to return per page | 1000 | 10 |
38
+ | filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | name |
39
+ | filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*template |
40
+ | templateType | string | N | Filter templates to those only of the given type. Accepted values are: page, layout, component | | page |
41
+
42
+ #### Successful Responses
43
+
44
+ | Code | Type | Description |
45
+ | ---- | ---- | ----------- |
46
+ | 200 | [Experience Templates](_schemas.md#experience-templates) | Collection of experience templates |
47
+
48
+ #### Error Responses
49
+
50
+ | Code | Type | Description |
51
+ | ---- | ---- | ----------- |
52
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
53
+ | 404 | [Error](_schemas.md#error) | Error if application was not found |
54
+
55
+ <br/>
56
+
57
+ ## Post
58
+
59
+ Create a new experience template for an application
60
+
61
+ ```ruby
62
+ result = client.experience_templates.post(
63
+ applicationId: my_application_id,
64
+ experienceTemplate: my_experience_template)
65
+
66
+ puts result
67
+ ```
68
+
69
+ #### Authentication
70
+ The client must be configured with a valid api access token to call this
71
+ action. The token must include at least one of the following scopes:
72
+ all.Application, all.Organization, all.User, experienceTemplates.*, or experienceTemplates.post.
73
+
74
+ #### Available Parameters
75
+
76
+ | Name | Type | Required | Description | Default | Example |
77
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
78
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
79
+ | experienceTemplate | [Experience Template Post](_schemas.md#experience-template-post) | Y | New experience template information | | [Experience Template Post Example](_schemas.md#experience-template-post-example) |
80
+
81
+ #### Successful Responses
82
+
83
+ | Code | Type | Description |
84
+ | ---- | ---- | ----------- |
85
+ | 201 | [Experience Template](_schemas.md#experience-template) | Successfully created experience template |
86
+
87
+ #### Error Responses
88
+
89
+ | Code | Type | Description |
90
+ | ---- | ---- | ----------- |
91
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
92
+ | 404 | [Error](_schemas.md#error) | Error if application was not found |
data/docs/integration.md CHANGED
@@ -79,7 +79,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
79
79
 
80
80
  | Code | Type | Description |
81
81
  | ---- | ---- | ----------- |
82
- | 200 | [Integrations](_schemas.md#integrations) | integration information |
82
+ | 200 | [Integration](_schemas.md#integration) | integration information |
83
83
 
84
84
  #### Error Responses
85
85
 
@@ -114,13 +114,13 @@ all.Application, all.Organization, all.User, integration.*, or integration.patch
114
114
  | ---- | ---- | -------- | ----------- | ------- | ------- |
115
115
  | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
116
116
  | integrationId | string | Y | ID associated with the integration | | 575ed78e7ae143cd83dc4aab |
117
- | integration | [Integrations Patch](_schemas.md#integrations-patch) | Y | Object containing new properties of the integration | | [Integrations Patch Example](_schemas.md#integrations-patch-example) |
117
+ | integration | [Integration Patch](_schemas.md#integration-patch) | Y | Object containing new properties of the integration | | [Integration Patch Example](_schemas.md#integration-patch-example) |
118
118
 
119
119
  #### Successful Responses
120
120
 
121
121
  | Code | Type | Description |
122
122
  | ---- | ---- | ----------- |
123
- | 200 | [Integrations](_schemas.md#integrations) | Updated integration information |
123
+ | 200 | [Integration](_schemas.md#integration) | Updated integration information |
124
124
 
125
125
  #### Error Responses
126
126
 
data/docs/integrations.md CHANGED
@@ -75,13 +75,13 @@ all.Application, all.Organization, all.User, integrations.*, or integrations.pos
75
75
  | Name | Type | Required | Description | Default | Example |
76
76
  | ---- | ---- | -------- | ----------- | ------- | ------- |
77
77
  | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
78
- | integration | [Integrations Post](_schemas.md#integrations-post) | Y | New integration information | | [Integrations Post Example](_schemas.md#integrations-post-example) |
78
+ | integration | [Integration Post](_schemas.md#integration-post) | Y | New integration information | | [Integration Post Example](_schemas.md#integration-post-example) |
79
79
 
80
80
  #### Successful Responses
81
81
 
82
82
  | Code | Type | Description |
83
83
  | ---- | ---- | ----------- |
84
- | 201 | [Integrations](_schemas.md#integrations) | Successfully created integration |
84
+ | 201 | [Integration](_schemas.md#integration) | Successfully created integration |
85
85
 
86
86
  #### Error Responses
87
87
 
@@ -27,7 +27,7 @@ module LosantRest
27
27
  #
28
28
  # User API for accessing Losant data
29
29
  #
30
- # Built For Version 1.7.2
30
+ # Built For Version 1.8.0
31
31
  class Client
32
32
  attr_accessor :auth_token, :url
33
33
 
@@ -140,6 +140,14 @@ module LosantRest
140
140
  @experience_groups ||= ExperienceGroups.new(self)
141
141
  end
142
142
 
143
+ def experience_template
144
+ @experience_template ||= ExperienceTemplate.new(self)
145
+ end
146
+
147
+ def experience_templates
148
+ @experience_templates ||= ExperienceTemplates.new(self)
149
+ end
150
+
143
151
  def experience_user
144
152
  @experience_user ||= ExperienceUser.new(self)
145
153
  end
@@ -218,7 +226,7 @@ module LosantRest
218
226
 
219
227
  headers["Accept"] = "application/json"
220
228
  headers["Content-Type"] = "application/json"
221
- headers["Accept-Version"] = "^1.7.2"
229
+ headers["Accept-Version"] = "^1.8.0"
222
230
  headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
223
231
  path = self.url + options.fetch(:path, "")
224
232
 
@@ -35,7 +35,7 @@ module LosantRest
35
35
  # The client must be configured with a valid api
36
36
  # access token to call this action. The token
37
37
  # must include at least one of the following scopes:
38
- # all.Organization, all.SolutionUser, all.SolutionUser.read, all.User, dashboards.*, or dashboards.get.
38
+ # all.Organization, all.Organization.read, all.SolutionUser, all.SolutionUser.read, all.User, all.User.read, dashboards.*, or dashboards.get.
39
39
  #
40
40
  # Parameters:
41
41
  # * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, ownerId
@@ -0,0 +1,174 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2017 Losant IoT, Inc.
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ module LosantRest
24
+
25
+ # Class containing all the actions for the Experience Template Resource
26
+ class ExperienceTemplate
27
+
28
+ def initialize(client)
29
+ @client = client
30
+ end
31
+
32
+ # Deletes an experience template
33
+ #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Application, all.Organization, all.User, experienceTemplate.*, or experienceTemplate.delete.
39
+ #
40
+ # Parameters:
41
+ # * {string} applicationId - ID associated with the application
42
+ # * {string} experienceTemplateId - ID associated with the experience template
43
+ # * {string} losantdomain - Domain scope of request (rarely needed)
44
+ # * {boolean} _actions - Return resource actions in response
45
+ # * {boolean} _links - Return resource link in response
46
+ # * {boolean} _embedded - Return embedded resources in response
47
+ #
48
+ # Responses:
49
+ # * 200 - If experience template was successfully deleted (https://api.losant.com/#/definitions/success)
50
+ #
51
+ # Errors:
52
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
53
+ # * 404 - Error if experience template was not found (https://api.losant.com/#/definitions/error)
54
+ def delete(params = {})
55
+ params = Utils.symbolize_hash_keys(params)
56
+ query_params = { _actions: false, _links: true, _embedded: true }
57
+ headers = {}
58
+ body = nil
59
+
60
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
61
+ raise ArgumentError.new("experienceTemplateId is required") unless params.has_key?(:experienceTemplateId)
62
+
63
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
64
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
65
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
66
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
67
+
68
+ path = "/applications/#{params[:applicationId]}/experience/templates/#{params[:experienceTemplateId]}"
69
+
70
+ @client.request(
71
+ method: :delete,
72
+ path: path,
73
+ query: query_params,
74
+ headers: headers,
75
+ body: body)
76
+ end
77
+
78
+ # Retrieves information on an experience template
79
+ #
80
+ # Authentication:
81
+ # The client must be configured with a valid api
82
+ # access token to call this action. The token
83
+ # must include at least one of the following scopes:
84
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceTemplate.*, or experienceTemplate.get.
85
+ #
86
+ # Parameters:
87
+ # * {string} applicationId - ID associated with the application
88
+ # * {string} experienceTemplateId - ID associated with the experience template
89
+ # * {string} losantdomain - Domain scope of request (rarely needed)
90
+ # * {boolean} _actions - Return resource actions in response
91
+ # * {boolean} _links - Return resource link in response
92
+ # * {boolean} _embedded - Return embedded resources in response
93
+ #
94
+ # Responses:
95
+ # * 200 - Experience template information (https://api.losant.com/#/definitions/experienceTemplate)
96
+ #
97
+ # Errors:
98
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
99
+ # * 404 - Error if experience template was not found (https://api.losant.com/#/definitions/error)
100
+ def get(params = {})
101
+ params = Utils.symbolize_hash_keys(params)
102
+ query_params = { _actions: false, _links: true, _embedded: true }
103
+ headers = {}
104
+ body = nil
105
+
106
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
107
+ raise ArgumentError.new("experienceTemplateId is required") unless params.has_key?(:experienceTemplateId)
108
+
109
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
110
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
111
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
112
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
113
+
114
+ path = "/applications/#{params[:applicationId]}/experience/templates/#{params[:experienceTemplateId]}"
115
+
116
+ @client.request(
117
+ method: :get,
118
+ path: path,
119
+ query: query_params,
120
+ headers: headers,
121
+ body: body)
122
+ end
123
+
124
+ # Updates information about an experience template
125
+ #
126
+ # Authentication:
127
+ # The client must be configured with a valid api
128
+ # access token to call this action. The token
129
+ # must include at least one of the following scopes:
130
+ # all.Application, all.Organization, all.User, experienceTemplate.*, or experienceTemplate.patch.
131
+ #
132
+ # Parameters:
133
+ # * {string} applicationId - ID associated with the application
134
+ # * {string} experienceTemplateId - ID associated with the experience template
135
+ # * {hash} experienceTemplate - Object containing new properties of the experience template (https://api.losant.com/#/definitions/experienceTemplatePatch)
136
+ # * {string} losantdomain - Domain scope of request (rarely needed)
137
+ # * {boolean} _actions - Return resource actions in response
138
+ # * {boolean} _links - Return resource link in response
139
+ # * {boolean} _embedded - Return embedded resources in response
140
+ #
141
+ # Responses:
142
+ # * 200 - Updated experience template information (https://api.losant.com/#/definitions/experienceTemplate)
143
+ #
144
+ # Errors:
145
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
146
+ # * 404 - Error if experience template was not found (https://api.losant.com/#/definitions/error)
147
+ def patch(params = {})
148
+ params = Utils.symbolize_hash_keys(params)
149
+ query_params = { _actions: false, _links: true, _embedded: true }
150
+ headers = {}
151
+ body = nil
152
+
153
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
154
+ raise ArgumentError.new("experienceTemplateId is required") unless params.has_key?(:experienceTemplateId)
155
+ raise ArgumentError.new("experienceTemplate is required") unless params.has_key?(:experienceTemplate)
156
+
157
+ body = params[:experienceTemplate] if params.has_key?(:experienceTemplate)
158
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
159
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
160
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
161
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
162
+
163
+ path = "/applications/#{params[:applicationId]}/experience/templates/#{params[:experienceTemplateId]}"
164
+
165
+ @client.request(
166
+ method: :patch,
167
+ path: path,
168
+ query: query_params,
169
+ headers: headers,
170
+ body: body)
171
+ end
172
+
173
+ end
174
+ end