losant_rest 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -0
- data/docs/_schemas.md +1805 -267
- data/docs/auth.md +1 -1
- data/docs/experienceEndpoint.md +130 -0
- data/docs/experienceEndpoints.md +131 -0
- data/docs/experienceGroup.md +130 -0
- data/docs/experienceGroups.md +91 -0
- data/docs/experienceUser.md +130 -0
- data/docs/experienceUsers.md +92 -0
- data/docs/flows.md +1 -0
- data/lib/losant_rest/client.rb +26 -2
- data/lib/losant_rest/experience_endpoint.rb +174 -0
- data/lib/losant_rest/experience_endpoints.rb +186 -0
- data/lib/losant_rest/experience_group.rb +174 -0
- data/lib/losant_rest/experience_groups.rb +136 -0
- data/lib/losant_rest/experience_user.rb +174 -0
- data/lib/losant_rest/experience_users.rb +138 -0
- data/lib/losant_rest/flows.rb +2 -0
- data/lib/losant_rest/version.rb +1 -1
- data/lib/losant_rest.rb +6 -0
- data/schemas/application.json +30 -5
- data/schemas/applicationApiTokenPost.json +22 -0
- data/schemas/applicationKey.json +4 -2
- data/schemas/applicationKeyPost.json +4 -2
- data/schemas/applicationKeys.json +4 -2
- data/schemas/applicationPatch.json +13 -0
- data/schemas/applicationPost.json +13 -0
- data/schemas/applications.json +30 -5
- data/schemas/auditLog.json +3 -0
- data/schemas/auditLogFilter.json +3 -0
- data/schemas/auditLogs.json +3 -0
- data/schemas/authedDevice.json +1 -2
- data/schemas/dashboard.json +4 -2
- data/schemas/dashboardPatch.json +4 -2
- data/schemas/dashboardPost.json +4 -2
- data/schemas/dashboards.json +4 -2
- data/schemas/device.json +5 -4
- data/schemas/devicePatch.json +5 -4
- data/schemas/devicePost.json +5 -4
- data/schemas/deviceRecipe.json +5 -4
- data/schemas/deviceRecipePatch.json +5 -4
- data/schemas/deviceRecipePost.json +5 -4
- data/schemas/deviceRecipes.json +5 -4
- data/schemas/deviceTagFilter.json +2 -1
- data/schemas/devices.json +5 -4
- data/schemas/experienceEndpoint.json +74 -0
- data/schemas/experienceEndpointPatch.json +46 -0
- data/schemas/experienceEndpointPost.json +50 -0
- data/schemas/experienceEndpointStats.json +21 -0
- data/schemas/experienceEndpoints.json +45 -0
- data/schemas/experienceGroup.json +51 -0
- data/schemas/experienceGroupPatch.json +32 -0
- data/schemas/experienceGroupPost.json +35 -0
- data/schemas/experienceGroups.json +93 -0
- data/schemas/experienceUser.json +83 -0
- data/schemas/experienceUserPatch.json +48 -0
- data/schemas/experienceUserPost.json +52 -0
- data/schemas/experienceUsers.json +129 -0
- data/schemas/flow.json +34 -10
- data/schemas/flowLog.json +2 -19
- data/schemas/flowPatch.json +34 -10
- data/schemas/flowPost.json +34 -10
- data/schemas/flowTriggerFilter.json +19 -0
- data/schemas/flows.json +34 -10
- data/schemas/lastValueQuery.json +4 -2
- data/schemas/me.json +39 -7
- data/schemas/multiDeviceCommand.json +4 -2
- data/schemas/org.json +41 -9
- data/schemas/orgs.json +41 -9
- data/schemas/payloadCounts.json +8 -0
- data/schemas/resourceTransfer.json +6 -3
- data/schemas/solution.json +3 -1
- data/schemas/solutionUser.json +2 -1
- data/schemas/solutionUserPatch.json +2 -1
- data/schemas/solutionUserPost.json +2 -1
- data/schemas/solutionUsers.json +2 -1
- data/schemas/solutions.json +3 -1
- data/schemas/timeSeriesQuery.json +4 -2
- metadata +28 -2
@@ -0,0 +1,92 @@
|
|
1
|
+
# Experience Users Actions
|
2
|
+
|
3
|
+
Details on the various actions that can be performed on the
|
4
|
+
Experience Users 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 users for an application
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
result = client.experience_users.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, experienceUsers.*, or experienceUsers.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: firstName, lastName, email, id, creationDate, lastLogin | email | email |
|
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: firstName, lastName, email | | email |
|
39
|
+
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*user |
|
40
|
+
| experienceGroupId | string | N | Filter users to those only in the specified group | | 575ec8687ae143cd83dc4a97 |
|
41
|
+
|
42
|
+
#### Successful Responses
|
43
|
+
|
44
|
+
| Code | Type | Description |
|
45
|
+
| ---- | ---- | ----------- |
|
46
|
+
| 200 | [Experience Users](_schemas.md#experience-users) | Collection of experience users |
|
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 user for an application
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
result = client.experience_users.post(
|
63
|
+
applicationId: my_application_id,
|
64
|
+
experienceUser: my_experience_user)
|
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, experienceUsers.*, or experienceUsers.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
|
+
| experienceUser | [Experience User Post](_schemas.md#experience-user-post) | Y | New experience user information | | [Experience User Post Example](_schemas.md#experience-user-post-example) |
|
80
|
+
|
81
|
+
#### Successful Responses
|
82
|
+
|
83
|
+
| Code | Type | Description |
|
84
|
+
| ---- | ---- | ----------- |
|
85
|
+
| 201 | [Experience User](_schemas.md#experience-user) | Successfully created experience user |
|
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/flows.md
CHANGED
@@ -37,6 +37,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
37
37
|
| perPage | string | N | How many items to return per page | 1000 | 10 |
|
38
38
|
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | name |
|
39
39
|
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*flow |
|
40
|
+
| triggerFilter | [Workflow Trigger Filter](_schemas.md#workflow-trigger-filter) | N | Array of triggers to filter by. | | [Workflow Trigger Filter Example](_schemas.md#workflow-trigger-filter-example) |
|
40
41
|
|
41
42
|
#### Successful Responses
|
42
43
|
|
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.5.
|
30
|
+
# Built For Version 1.5.7
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -108,6 +108,30 @@ module LosantRest
|
|
108
108
|
@events ||= Events.new(self)
|
109
109
|
end
|
110
110
|
|
111
|
+
def experience_endpoint
|
112
|
+
@experience_endpoint ||= ExperienceEndpoint.new(self)
|
113
|
+
end
|
114
|
+
|
115
|
+
def experience_endpoints
|
116
|
+
@experience_endpoints ||= ExperienceEndpoints.new(self)
|
117
|
+
end
|
118
|
+
|
119
|
+
def experience_group
|
120
|
+
@experience_group ||= ExperienceGroup.new(self)
|
121
|
+
end
|
122
|
+
|
123
|
+
def experience_groups
|
124
|
+
@experience_groups ||= ExperienceGroups.new(self)
|
125
|
+
end
|
126
|
+
|
127
|
+
def experience_user
|
128
|
+
@experience_user ||= ExperienceUser.new(self)
|
129
|
+
end
|
130
|
+
|
131
|
+
def experience_users
|
132
|
+
@experience_users ||= ExperienceUsers.new(self)
|
133
|
+
end
|
134
|
+
|
111
135
|
def flow
|
112
136
|
@flow ||= Flow.new(self)
|
113
137
|
end
|
@@ -162,7 +186,7 @@ module LosantRest
|
|
162
186
|
|
163
187
|
headers["Accept"] = "application/json"
|
164
188
|
headers["Content-Type"] = "application/json"
|
165
|
-
headers["Accept-Version"] = "^1.5.
|
189
|
+
headers["Accept-Version"] = "^1.5.7"
|
166
190
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
167
191
|
path = self.url + options.fetch(:path, "")
|
168
192
|
|
@@ -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 Endpoint Resource
|
26
|
+
class ExperienceEndpoint
|
27
|
+
|
28
|
+
def initialize(client)
|
29
|
+
@client = client
|
30
|
+
end
|
31
|
+
|
32
|
+
# Deletes an experience endpoint
|
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, experienceEndpoint.*, or experienceEndpoint.delete.
|
39
|
+
#
|
40
|
+
# Parameters:
|
41
|
+
# * {string} applicationId - ID associated with the application
|
42
|
+
# * {string} experienceEndpointId - ID associated with the experience endpoint
|
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 endpoint 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 endpoint 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("experienceEndpointId is required") unless params.has_key?(:experienceEndpointId)
|
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/endpoints/#{params[:experienceEndpointId]}"
|
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 endpoint
|
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, experienceEndpoint.*, or experienceEndpoint.get.
|
85
|
+
#
|
86
|
+
# Parameters:
|
87
|
+
# * {string} applicationId - ID associated with the application
|
88
|
+
# * {string} experienceEndpointId - ID associated with the experience endpoint
|
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 endpoint information (https://api.losant.com/#/definitions/experienceEndpoint)
|
96
|
+
#
|
97
|
+
# Errors:
|
98
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
99
|
+
# * 404 - Error if experience endpoint 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("experienceEndpointId is required") unless params.has_key?(:experienceEndpointId)
|
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/endpoints/#{params[:experienceEndpointId]}"
|
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 endpoint
|
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, experienceEndpoint.*, or experienceEndpoint.patch.
|
131
|
+
#
|
132
|
+
# Parameters:
|
133
|
+
# * {string} applicationId - ID associated with the application
|
134
|
+
# * {string} experienceEndpointId - ID associated with the experience endpoint
|
135
|
+
# * {hash} experienceEndpoint - Object containing new properties of the experience endpoint (https://api.losant.com/#/definitions/experienceEndpointPatch)
|
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 endpoint information (https://api.losant.com/#/definitions/experienceEndpoint)
|
143
|
+
#
|
144
|
+
# Errors:
|
145
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
146
|
+
# * 404 - Error if experience endpoint 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("experienceEndpointId is required") unless params.has_key?(:experienceEndpointId)
|
155
|
+
raise ArgumentError.new("experienceEndpoint is required") unless params.has_key?(:experienceEndpoint)
|
156
|
+
|
157
|
+
body = params[:experienceEndpoint] if params.has_key?(:experienceEndpoint)
|
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/endpoints/#{params[:experienceEndpointId]}"
|
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
|
@@ -0,0 +1,186 @@
|
|
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 Endpoints Resource
|
26
|
+
class ExperienceEndpoints
|
27
|
+
|
28
|
+
def initialize(client)
|
29
|
+
@client = client
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the experience endpoints for an application
|
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.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoints.*, or experienceEndpoints.get.
|
39
|
+
#
|
40
|
+
# Parameters:
|
41
|
+
# * {string} applicationId - ID associated with the application
|
42
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: order, method, route, id, creationDate, requestCount
|
43
|
+
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
44
|
+
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: method, route
|
45
|
+
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
46
|
+
# * {string} experienceGroupId - Filter endpoints to those only in the specified group
|
47
|
+
# * {string} requestCountDuration - If set, a count of recent requests is included on each endpoint for the duration requested (milliseconds)
|
48
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
49
|
+
# * {boolean} _actions - Return resource actions in response
|
50
|
+
# * {boolean} _links - Return resource link in response
|
51
|
+
# * {boolean} _embedded - Return embedded resources in response
|
52
|
+
#
|
53
|
+
# Responses:
|
54
|
+
# * 200 - Collection of experience endpoints (https://api.losant.com/#/definitions/experienceEndpoints)
|
55
|
+
#
|
56
|
+
# Errors:
|
57
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
58
|
+
# * 404 - Error if application was not found (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
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
66
|
+
|
67
|
+
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
68
|
+
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
69
|
+
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
70
|
+
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
71
|
+
query_params[:experienceGroupId] = params[:experienceGroupId] if params.has_key?(:experienceGroupId)
|
72
|
+
query_params[:requestCountDuration] = params[:requestCountDuration] if params.has_key?(:requestCountDuration)
|
73
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
74
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
75
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
76
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
77
|
+
|
78
|
+
path = "/applications/#{params[:applicationId]}/experience/endpoints"
|
79
|
+
|
80
|
+
@client.request(
|
81
|
+
method: :get,
|
82
|
+
path: path,
|
83
|
+
query: query_params,
|
84
|
+
headers: headers,
|
85
|
+
body: body)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Create a new experience endpoint for an application
|
89
|
+
#
|
90
|
+
# Authentication:
|
91
|
+
# The client must be configured with a valid api
|
92
|
+
# access token to call this action. The token
|
93
|
+
# must include at least one of the following scopes:
|
94
|
+
# all.Application, all.Organization, all.User, experienceEndpoints.*, or experienceEndpoints.post.
|
95
|
+
#
|
96
|
+
# Parameters:
|
97
|
+
# * {string} applicationId - ID associated with the application
|
98
|
+
# * {hash} experienceEndpoint - New experience endpoint information (https://api.losant.com/#/definitions/experienceEndpointPost)
|
99
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
100
|
+
# * {boolean} _actions - Return resource actions in response
|
101
|
+
# * {boolean} _links - Return resource link in response
|
102
|
+
# * {boolean} _embedded - Return embedded resources in response
|
103
|
+
#
|
104
|
+
# Responses:
|
105
|
+
# * 201 - Successfully created experience endpoint (https://api.losant.com/#/definitions/experienceEndpoint)
|
106
|
+
#
|
107
|
+
# Errors:
|
108
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
109
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
110
|
+
def post(params = {})
|
111
|
+
params = Utils.symbolize_hash_keys(params)
|
112
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
113
|
+
headers = {}
|
114
|
+
body = nil
|
115
|
+
|
116
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
117
|
+
raise ArgumentError.new("experienceEndpoint is required") unless params.has_key?(:experienceEndpoint)
|
118
|
+
|
119
|
+
body = params[:experienceEndpoint] if params.has_key?(:experienceEndpoint)
|
120
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
121
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
122
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
123
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
124
|
+
|
125
|
+
path = "/applications/#{params[:applicationId]}/experience/endpoints"
|
126
|
+
|
127
|
+
@client.request(
|
128
|
+
method: :post,
|
129
|
+
path: path,
|
130
|
+
query: query_params,
|
131
|
+
headers: headers,
|
132
|
+
body: body)
|
133
|
+
end
|
134
|
+
|
135
|
+
# Get statistics about endpoint requests
|
136
|
+
#
|
137
|
+
# Authentication:
|
138
|
+
# The client must be configured with a valid api
|
139
|
+
# access token to call this action. The token
|
140
|
+
# must include at least one of the following scopes:
|
141
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoints.*, or experienceEndpoints.stats.
|
142
|
+
#
|
143
|
+
# Parameters:
|
144
|
+
# * {string} applicationId - ID associated with the application
|
145
|
+
# * {string} statGrouping - Field to group the statistics by. Accepted values are: statusCode, endpointId
|
146
|
+
# * {string} duration - Duration in milliseconds
|
147
|
+
# * {string} resolution - Resolution in milliseconds
|
148
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
149
|
+
# * {boolean} _actions - Return resource actions in response
|
150
|
+
# * {boolean} _links - Return resource link in response
|
151
|
+
# * {boolean} _embedded - Return embedded resources in response
|
152
|
+
#
|
153
|
+
# Responses:
|
154
|
+
# * 200 - Statistics for endpoint requests (https://api.losant.com/#/definitions/experienceEndpointStats)
|
155
|
+
#
|
156
|
+
# Errors:
|
157
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
158
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
159
|
+
def stats(params = {})
|
160
|
+
params = Utils.symbolize_hash_keys(params)
|
161
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
162
|
+
headers = {}
|
163
|
+
body = nil
|
164
|
+
|
165
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
166
|
+
|
167
|
+
query_params[:statGrouping] = params[:statGrouping] if params.has_key?(:statGrouping)
|
168
|
+
query_params[:duration] = params[:duration] if params.has_key?(:duration)
|
169
|
+
query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
|
170
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
171
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
172
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
173
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
174
|
+
|
175
|
+
path = "/applications/#{params[:applicationId]}/experience/endpoints/stats"
|
176
|
+
|
177
|
+
@client.request(
|
178
|
+
method: :get,
|
179
|
+
path: path,
|
180
|
+
query: query_params,
|
181
|
+
headers: headers,
|
182
|
+
body: body)
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
end
|
@@ -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 Group Resource
|
26
|
+
class ExperienceGroup
|
27
|
+
|
28
|
+
def initialize(client)
|
29
|
+
@client = client
|
30
|
+
end
|
31
|
+
|
32
|
+
# Deletes an experience group
|
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, experienceGroup.*, or experienceGroup.delete.
|
39
|
+
#
|
40
|
+
# Parameters:
|
41
|
+
# * {string} applicationId - ID associated with the application
|
42
|
+
# * {string} experienceGroupId - ID associated with the experience group
|
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 group 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 group 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("experienceGroupId is required") unless params.has_key?(:experienceGroupId)
|
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/groups/#{params[:experienceGroupId]}"
|
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 group
|
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, experienceGroup.*, or experienceGroup.get.
|
85
|
+
#
|
86
|
+
# Parameters:
|
87
|
+
# * {string} applicationId - ID associated with the application
|
88
|
+
# * {string} experienceGroupId - ID associated with the experience group
|
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 group information (https://api.losant.com/#/definitions/experienceGroup)
|
96
|
+
#
|
97
|
+
# Errors:
|
98
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
99
|
+
# * 404 - Error if experience group 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("experienceGroupId is required") unless params.has_key?(:experienceGroupId)
|
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/groups/#{params[:experienceGroupId]}"
|
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 group
|
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, experienceGroup.*, or experienceGroup.patch.
|
131
|
+
#
|
132
|
+
# Parameters:
|
133
|
+
# * {string} applicationId - ID associated with the application
|
134
|
+
# * {string} experienceGroupId - ID associated with the experience group
|
135
|
+
# * {hash} experienceGroup - Object containing new properties of the experience group (https://api.losant.com/#/definitions/experienceGroupPatch)
|
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 group information (https://api.losant.com/#/definitions/experienceGroup)
|
143
|
+
#
|
144
|
+
# Errors:
|
145
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
146
|
+
# * 404 - Error if experience group 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("experienceGroupId is required") unless params.has_key?(:experienceGroupId)
|
155
|
+
raise ArgumentError.new("experienceGroup is required") unless params.has_key?(:experienceGroup)
|
156
|
+
|
157
|
+
body = params[:experienceGroup] if params.has_key?(:experienceGroup)
|
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/groups/#{params[:experienceGroupId]}"
|
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
|