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,136 @@
|
|
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 Groups Resource
|
26
|
+
class ExperienceGroups
|
27
|
+
|
28
|
+
def initialize(client)
|
29
|
+
@client = client
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the experience groups 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, experienceGroups.*, or experienceGroups.get.
|
39
|
+
#
|
40
|
+
# Parameters:
|
41
|
+
# * {string} applicationId - ID associated with the application
|
42
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate
|
43
|
+
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
44
|
+
# * {string} page - Which page of results to return
|
45
|
+
# * {string} perPage - How many items to return per page
|
46
|
+
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
47
|
+
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
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 groups (https://api.losant.com/#/definitions/experienceGroups)
|
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[:page] = params[:page] if params.has_key?(:page)
|
70
|
+
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
71
|
+
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
72
|
+
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
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/groups"
|
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 group 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, experienceGroups.*, or experienceGroups.post.
|
95
|
+
#
|
96
|
+
# Parameters:
|
97
|
+
# * {string} applicationId - ID associated with the application
|
98
|
+
# * {hash} experienceGroup - New experience group information (https://api.losant.com/#/definitions/experienceGroupPost)
|
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 group (https://api.losant.com/#/definitions/experienceGroup)
|
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("experienceGroup is required") unless params.has_key?(:experienceGroup)
|
118
|
+
|
119
|
+
body = params[:experienceGroup] if params.has_key?(:experienceGroup)
|
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/groups"
|
126
|
+
|
127
|
+
@client.request(
|
128
|
+
method: :post,
|
129
|
+
path: path,
|
130
|
+
query: query_params,
|
131
|
+
headers: headers,
|
132
|
+
body: body)
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
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 User Resource
|
26
|
+
class ExperienceUser
|
27
|
+
|
28
|
+
def initialize(client)
|
29
|
+
@client = client
|
30
|
+
end
|
31
|
+
|
32
|
+
# Deletes an experience user
|
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, experienceUser.*, or experienceUser.delete.
|
39
|
+
#
|
40
|
+
# Parameters:
|
41
|
+
# * {string} applicationId - ID associated with the application
|
42
|
+
# * {string} experienceUserId - ID associated with the experience user
|
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 user 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 user 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("experienceUserId is required") unless params.has_key?(:experienceUserId)
|
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/users/#{params[:experienceUserId]}"
|
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 user
|
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, experienceUser.*, or experienceUser.get.
|
85
|
+
#
|
86
|
+
# Parameters:
|
87
|
+
# * {string} applicationId - ID associated with the application
|
88
|
+
# * {string} experienceUserId - ID associated with the experience user
|
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 user information (https://api.losant.com/#/definitions/experienceUser)
|
96
|
+
#
|
97
|
+
# Errors:
|
98
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
99
|
+
# * 404 - Error if experience user 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("experienceUserId is required") unless params.has_key?(:experienceUserId)
|
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/users/#{params[:experienceUserId]}"
|
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 user
|
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, experienceUser.*, or experienceUser.patch.
|
131
|
+
#
|
132
|
+
# Parameters:
|
133
|
+
# * {string} applicationId - ID associated with the application
|
134
|
+
# * {string} experienceUserId - ID associated with the experience user
|
135
|
+
# * {hash} experienceUser - Object containing new properties of the experience user (https://api.losant.com/#/definitions/experienceUserPatch)
|
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 user information (https://api.losant.com/#/definitions/experienceUser)
|
143
|
+
#
|
144
|
+
# Errors:
|
145
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
146
|
+
# * 404 - Error if experience user 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("experienceUserId is required") unless params.has_key?(:experienceUserId)
|
155
|
+
raise ArgumentError.new("experienceUser is required") unless params.has_key?(:experienceUser)
|
156
|
+
|
157
|
+
body = params[:experienceUser] if params.has_key?(:experienceUser)
|
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/users/#{params[:experienceUserId]}"
|
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,138 @@
|
|
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 Users Resource
|
26
|
+
class ExperienceUsers
|
27
|
+
|
28
|
+
def initialize(client)
|
29
|
+
@client = client
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the experience users 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, experienceUsers.*, or experienceUsers.get.
|
39
|
+
#
|
40
|
+
# Parameters:
|
41
|
+
# * {string} applicationId - ID associated with the application
|
42
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: firstName, lastName, email, id, creationDate, lastLogin
|
43
|
+
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
44
|
+
# * {string} page - Which page of results to return
|
45
|
+
# * {string} perPage - How many items to return per page
|
46
|
+
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: firstName, lastName, email
|
47
|
+
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
48
|
+
# * {string} experienceGroupId - Filter users to those only in the specified group
|
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 experience users (https://api.losant.com/#/definitions/experienceUsers)
|
56
|
+
#
|
57
|
+
# Errors:
|
58
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
59
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
60
|
+
def get(params = {})
|
61
|
+
params = Utils.symbolize_hash_keys(params)
|
62
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
63
|
+
headers = {}
|
64
|
+
body = nil
|
65
|
+
|
66
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
67
|
+
|
68
|
+
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
69
|
+
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
70
|
+
query_params[:page] = params[:page] if params.has_key?(:page)
|
71
|
+
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
72
|
+
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
73
|
+
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
74
|
+
query_params[:experienceGroupId] = params[:experienceGroupId] if params.has_key?(:experienceGroupId)
|
75
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
76
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
77
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
78
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
79
|
+
|
80
|
+
path = "/applications/#{params[:applicationId]}/experience/users"
|
81
|
+
|
82
|
+
@client.request(
|
83
|
+
method: :get,
|
84
|
+
path: path,
|
85
|
+
query: query_params,
|
86
|
+
headers: headers,
|
87
|
+
body: body)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Create a new experience user for an application
|
91
|
+
#
|
92
|
+
# Authentication:
|
93
|
+
# The client must be configured with a valid api
|
94
|
+
# access token to call this action. The token
|
95
|
+
# must include at least one of the following scopes:
|
96
|
+
# all.Application, all.Organization, all.User, experienceUsers.*, or experienceUsers.post.
|
97
|
+
#
|
98
|
+
# Parameters:
|
99
|
+
# * {string} applicationId - ID associated with the application
|
100
|
+
# * {hash} experienceUser - New experience user information (https://api.losant.com/#/definitions/experienceUserPost)
|
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
|
+
# * 201 - Successfully created experience user (https://api.losant.com/#/definitions/experienceUser)
|
108
|
+
#
|
109
|
+
# Errors:
|
110
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
111
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
112
|
+
def post(params = {})
|
113
|
+
params = Utils.symbolize_hash_keys(params)
|
114
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
115
|
+
headers = {}
|
116
|
+
body = nil
|
117
|
+
|
118
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
119
|
+
raise ArgumentError.new("experienceUser is required") unless params.has_key?(:experienceUser)
|
120
|
+
|
121
|
+
body = params[:experienceUser] if params.has_key?(:experienceUser)
|
122
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
123
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
124
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
125
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
126
|
+
|
127
|
+
path = "/applications/#{params[:applicationId]}/experience/users"
|
128
|
+
|
129
|
+
@client.request(
|
130
|
+
method: :post,
|
131
|
+
path: path,
|
132
|
+
query: query_params,
|
133
|
+
headers: headers,
|
134
|
+
body: body)
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
data/lib/losant_rest/flows.rb
CHANGED
@@ -45,6 +45,7 @@ module LosantRest
|
|
45
45
|
# * {string} perPage - How many items to return per page
|
46
46
|
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
47
47
|
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
48
|
+
# * {hash} triggerFilter - Array of triggers to filter by. (https://api.losant.com/#/definitions/flowTriggerFilter)
|
48
49
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
49
50
|
# * {boolean} _actions - Return resource actions in response
|
50
51
|
# * {boolean} _links - Return resource link in response
|
@@ -70,6 +71,7 @@ module LosantRest
|
|
70
71
|
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
71
72
|
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
72
73
|
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
74
|
+
query_params[:triggerFilter] = params[:triggerFilter] if params.has_key?(:triggerFilter)
|
73
75
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
74
76
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
75
77
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/losant_rest/version.rb
CHANGED
data/lib/losant_rest.rb
CHANGED
@@ -41,6 +41,12 @@ require_relative "losant_rest/device_recipes"
|
|
41
41
|
require_relative "losant_rest/devices"
|
42
42
|
require_relative "losant_rest/event"
|
43
43
|
require_relative "losant_rest/events"
|
44
|
+
require_relative "losant_rest/experience_endpoint"
|
45
|
+
require_relative "losant_rest/experience_endpoints"
|
46
|
+
require_relative "losant_rest/experience_group"
|
47
|
+
require_relative "losant_rest/experience_groups"
|
48
|
+
require_relative "losant_rest/experience_user"
|
49
|
+
require_relative "losant_rest/experience_users"
|
44
50
|
require_relative "losant_rest/flow"
|
45
51
|
require_relative "losant_rest/flows"
|
46
52
|
require_relative "losant_rest/me"
|
data/schemas/application.json
CHANGED
@@ -38,25 +38,50 @@
|
|
38
38
|
"type": "string",
|
39
39
|
"maxLength": 32767
|
40
40
|
},
|
41
|
+
"endpointSlug": {
|
42
|
+
"type": "string",
|
43
|
+
"minLength": 4,
|
44
|
+
"maxLength": 255,
|
45
|
+
"pattern": "^[0-9a-z_-]*$"
|
46
|
+
},
|
47
|
+
"expUserTokenCutoff": {
|
48
|
+
"type": "string",
|
49
|
+
"format": "date-time"
|
50
|
+
},
|
51
|
+
"endpointDefaultCors": {
|
52
|
+
"type": "boolean"
|
53
|
+
},
|
41
54
|
"summary": {
|
42
55
|
"type": "object",
|
43
56
|
"properties": {
|
44
|
-
"
|
57
|
+
"apiTokenCount": {
|
45
58
|
"type": "number"
|
46
59
|
},
|
47
|
-
"
|
60
|
+
"keyCount": {
|
48
61
|
"type": "number"
|
49
62
|
},
|
50
|
-
"
|
63
|
+
"deviceCount": {
|
64
|
+
"type": "number"
|
65
|
+
},
|
66
|
+
"deviceRecipeCount": {
|
51
67
|
"type": "number"
|
52
68
|
},
|
53
69
|
"eventCount": {
|
54
70
|
"type": "number"
|
55
71
|
},
|
56
|
-
"
|
72
|
+
"experienceEndpointCount": {
|
57
73
|
"type": "number"
|
58
74
|
},
|
59
|
-
"
|
75
|
+
"experienceGroupCount": {
|
76
|
+
"type": "number"
|
77
|
+
},
|
78
|
+
"experienceUserCount": {
|
79
|
+
"type": "number"
|
80
|
+
},
|
81
|
+
"flowCount": {
|
82
|
+
"type": "number"
|
83
|
+
},
|
84
|
+
"webhookCount": {
|
60
85
|
"type": "number"
|
61
86
|
}
|
62
87
|
}
|
@@ -36,6 +36,12 @@
|
|
36
36
|
"devices.*",
|
37
37
|
"event.*",
|
38
38
|
"events.*",
|
39
|
+
"experienceEndpoint.*",
|
40
|
+
"experienceEndpoints.*",
|
41
|
+
"experienceGroup.*",
|
42
|
+
"experienceGroups.*",
|
43
|
+
"experienceUser.*",
|
44
|
+
"experienceUsers.*",
|
39
45
|
"flow.*",
|
40
46
|
"flows.*",
|
41
47
|
"webhook.*",
|
@@ -84,6 +90,22 @@
|
|
84
90
|
"events.mostRecentBySeverity",
|
85
91
|
"events.patch",
|
86
92
|
"events.post",
|
93
|
+
"experienceEndpoint.delete",
|
94
|
+
"experienceEndpoint.get",
|
95
|
+
"experienceEndpoint.patch",
|
96
|
+
"experienceEndpoints.get",
|
97
|
+
"experienceEndpoints.post",
|
98
|
+
"experienceEndpoints.stats",
|
99
|
+
"experienceGroup.delete",
|
100
|
+
"experienceGroup.get",
|
101
|
+
"experienceGroup.patch",
|
102
|
+
"experienceGroups.get",
|
103
|
+
"experienceGroups.post",
|
104
|
+
"experienceUser.delete",
|
105
|
+
"experienceUser.get",
|
106
|
+
"experienceUser.patch",
|
107
|
+
"experienceUsers.get",
|
108
|
+
"experienceUsers.post",
|
87
109
|
"flow.delete",
|
88
110
|
"flow.get",
|
89
111
|
"flow.getStorageEntries",
|
data/schemas/applicationKey.json
CHANGED
@@ -40,7 +40,8 @@
|
|
40
40
|
"items": {
|
41
41
|
"type": "string",
|
42
42
|
"pattern": "^[A-Fa-f\\d]{24}$"
|
43
|
-
}
|
43
|
+
},
|
44
|
+
"maxItems": 1000
|
44
45
|
},
|
45
46
|
"deviceTags": {
|
46
47
|
"type": "array",
|
@@ -58,7 +59,8 @@
|
|
58
59
|
}
|
59
60
|
},
|
60
61
|
"additionalProperties": false
|
61
|
-
}
|
62
|
+
},
|
63
|
+
"maxItems": 100
|
62
64
|
},
|
63
65
|
"description": {
|
64
66
|
"type": "string",
|
@@ -7,7 +7,8 @@
|
|
7
7
|
"items": {
|
8
8
|
"type": "string",
|
9
9
|
"pattern": "^[A-Fa-f\\d]{24}$"
|
10
|
-
}
|
10
|
+
},
|
11
|
+
"maxItems": 1000
|
11
12
|
},
|
12
13
|
"deviceTags": {
|
13
14
|
"type": "array",
|
@@ -25,7 +26,8 @@
|
|
25
26
|
}
|
26
27
|
},
|
27
28
|
"additionalProperties": false
|
28
|
-
}
|
29
|
+
},
|
30
|
+
"maxItems": 100
|
29
31
|
},
|
30
32
|
"description": {
|
31
33
|
"type": "string",
|
@@ -47,7 +47,8 @@
|
|
47
47
|
"items": {
|
48
48
|
"type": "string",
|
49
49
|
"pattern": "^[A-Fa-f\\d]{24}$"
|
50
|
-
}
|
50
|
+
},
|
51
|
+
"maxItems": 1000
|
51
52
|
},
|
52
53
|
"deviceTags": {
|
53
54
|
"type": "array",
|
@@ -65,7 +66,8 @@
|
|
65
66
|
}
|
66
67
|
},
|
67
68
|
"additionalProperties": false
|
68
|
-
}
|
69
|
+
},
|
70
|
+
"maxItems": 100
|
69
71
|
},
|
70
72
|
"description": {
|
71
73
|
"type": "string",
|
@@ -10,6 +10,19 @@
|
|
10
10
|
"description": {
|
11
11
|
"type": "string",
|
12
12
|
"maxLength": 32767
|
13
|
+
},
|
14
|
+
"endpointSlug": {
|
15
|
+
"type": "string",
|
16
|
+
"minLength": 4,
|
17
|
+
"maxLength": 255,
|
18
|
+
"pattern": "^[0-9a-z_-]*$"
|
19
|
+
},
|
20
|
+
"expUserTokenCutoff": {
|
21
|
+
"type": "string",
|
22
|
+
"format": "date-time"
|
23
|
+
},
|
24
|
+
"endpointDefaultCors": {
|
25
|
+
"type": "boolean"
|
13
26
|
}
|
14
27
|
},
|
15
28
|
"additionalProperties": false
|