losant_rest 1.3.3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.markdownlint.json +11 -0
- data/README.md +139 -231
- data/docs/_schemas.md +1036 -393
- data/docs/dataTableRows.md +41 -0
- data/docs/deviceRecipe.md +1 -0
- data/docs/{experienceTemplate.md → experienceDomain.md} +25 -25
- data/docs/experienceDomains.md +85 -0
- data/docs/experienceView.md +130 -0
- data/docs/{experienceTemplates.md → experienceViews.md} +15 -15
- data/docs/me.md +36 -0
- data/lib/losant_rest.rb +4 -2
- data/lib/losant_rest/client.rb +18 -10
- data/lib/losant_rest/data_table_rows.rb +48 -0
- data/lib/losant_rest/device_recipe.rb +1 -0
- data/lib/losant_rest/{experience_template.rb → experience_domain.rb} +26 -26
- data/lib/losant_rest/experience_domains.rb +124 -0
- data/lib/losant_rest/experience_view.rb +174 -0
- data/lib/losant_rest/{experience_templates.rb → experience_views.rb} +16 -16
- data/lib/losant_rest/me.rb +44 -0
- data/lib/losant_rest/version.rb +1 -1
- data/schemas/application.json +34 -2
- data/schemas/applicationApiTokenPost.json +14 -7
- data/schemas/applicationPatch.json +29 -0
- data/schemas/applications.json +34 -2
- data/schemas/auditLog.json +2 -1
- data/schemas/auditLogFilter.json +2 -1
- data/schemas/auditLogs.json +2 -1
- data/schemas/changePassword.json +28 -0
- data/schemas/dataTableRowsExport.json +36 -0
- data/schemas/deviceRecipeBulkCreateEnqueued.json +9 -0
- data/schemas/deviceRecipeBulkCreatePost.json +5 -0
- data/schemas/experienceDomain.json +41 -0
- data/schemas/experienceDomainPatch.json +27 -0
- data/schemas/experienceDomainPost.json +30 -0
- data/schemas/experienceDomains.json +61 -0
- data/schemas/experienceEndpoint.json +11 -0
- data/schemas/experienceEndpointPatch.json +11 -0
- data/schemas/experienceEndpointPost.json +11 -0
- data/schemas/experienceEndpoints.json +11 -0
- data/schemas/experienceGroup.json +11 -0
- data/schemas/experienceGroupPatch.json +11 -0
- data/schemas/experienceGroupPost.json +11 -0
- data/schemas/experienceGroups.json +11 -0
- data/schemas/{experienceTemplate.json → experienceView.json} +8 -3
- data/schemas/{experienceTemplatePatch.json → experienceViewPatch.json} +1 -1
- data/schemas/{experienceTemplatePost.json → experienceViewPost.json} +3 -3
- data/schemas/{experienceTemplates.json → experienceViews.json} +11 -6
- data/schemas/me.json +10 -4
- data/schemas/org.json +10 -4
- data/schemas/orgs.json +10 -4
- data/schemas/solutionUser.json +4 -0
- data/schemas/solutionUserPatch.json +4 -0
- data/schemas/solutionUserPost.json +4 -0
- data/schemas/solutionUsers.json +4 -0
- metadata +22 -10
data/docs/me.md
CHANGED
@@ -7,6 +7,7 @@ parameters and the potential responses.
|
|
7
7
|
##### Contents
|
8
8
|
|
9
9
|
* [Add Recent Item](#add-recent-item)
|
10
|
+
* [Change Password](#change-password)
|
10
11
|
* [Delete](#delete)
|
11
12
|
* [Disable Two Factor Auth](#disable-two-factor-auth)
|
12
13
|
* [Disconnect Github](#disconnect-github)
|
@@ -56,6 +57,41 @@ all.SolutionUser, all.User, me.*, or me.addRecentItem.
|
|
56
57
|
|
57
58
|
<br/>
|
58
59
|
|
60
|
+
## Change Password
|
61
|
+
|
62
|
+
Changes the current user's password and optionally logs out all other sessions
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
result = client.me.change_password(data: my_data)
|
66
|
+
|
67
|
+
puts result
|
68
|
+
```
|
69
|
+
|
70
|
+
#### Authentication
|
71
|
+
The client must be configured with a valid api access token to call this
|
72
|
+
action. The token must include at least one of the following scopes:
|
73
|
+
all.SolutionUser, all.User, me.*, or me.changePassword.
|
74
|
+
|
75
|
+
#### Available Parameters
|
76
|
+
|
77
|
+
| Name | Type | Required | Description | Default | Example |
|
78
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
79
|
+
| data | [Change Password](_schemas.md#change-password) | Y | Object containing the password change info | | [Change Password Example](_schemas.md#change-password-example) |
|
80
|
+
|
81
|
+
#### Successful Responses
|
82
|
+
|
83
|
+
| Code | Type | Description |
|
84
|
+
| ---- | ---- | ----------- |
|
85
|
+
| 200 | [Authenticated User](_schemas.md#authenticated-user) | A new, valid, auth token (potentially all previous tokens are now invalid) |
|
86
|
+
|
87
|
+
#### Error Responses
|
88
|
+
|
89
|
+
| Code | Type | Description |
|
90
|
+
| ---- | ---- | ----------- |
|
91
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
92
|
+
|
93
|
+
<br/>
|
94
|
+
|
59
95
|
## Delete
|
60
96
|
|
61
97
|
Deletes the current user
|
data/lib/losant_rest.rb
CHANGED
@@ -45,14 +45,16 @@ require_relative "losant_rest/device_recipes"
|
|
45
45
|
require_relative "losant_rest/devices"
|
46
46
|
require_relative "losant_rest/event"
|
47
47
|
require_relative "losant_rest/events"
|
48
|
+
require_relative "losant_rest/experience_domain"
|
49
|
+
require_relative "losant_rest/experience_domains"
|
48
50
|
require_relative "losant_rest/experience_endpoint"
|
49
51
|
require_relative "losant_rest/experience_endpoints"
|
50
52
|
require_relative "losant_rest/experience_group"
|
51
53
|
require_relative "losant_rest/experience_groups"
|
52
|
-
require_relative "losant_rest/experience_template"
|
53
|
-
require_relative "losant_rest/experience_templates"
|
54
54
|
require_relative "losant_rest/experience_user"
|
55
55
|
require_relative "losant_rest/experience_users"
|
56
|
+
require_relative "losant_rest/experience_view"
|
57
|
+
require_relative "losant_rest/experience_views"
|
56
58
|
require_relative "losant_rest/flow"
|
57
59
|
require_relative "losant_rest/flow_version"
|
58
60
|
require_relative "losant_rest/flow_versions"
|
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.
|
30
|
+
# Built For Version 1.9.0
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -124,6 +124,14 @@ module LosantRest
|
|
124
124
|
@events ||= Events.new(self)
|
125
125
|
end
|
126
126
|
|
127
|
+
def experience_domain
|
128
|
+
@experience_domain ||= ExperienceDomain.new(self)
|
129
|
+
end
|
130
|
+
|
131
|
+
def experience_domains
|
132
|
+
@experience_domains ||= ExperienceDomains.new(self)
|
133
|
+
end
|
134
|
+
|
127
135
|
def experience_endpoint
|
128
136
|
@experience_endpoint ||= ExperienceEndpoint.new(self)
|
129
137
|
end
|
@@ -140,14 +148,6 @@ module LosantRest
|
|
140
148
|
@experience_groups ||= ExperienceGroups.new(self)
|
141
149
|
end
|
142
150
|
|
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
|
-
|
151
151
|
def experience_user
|
152
152
|
@experience_user ||= ExperienceUser.new(self)
|
153
153
|
end
|
@@ -156,6 +156,14 @@ module LosantRest
|
|
156
156
|
@experience_users ||= ExperienceUsers.new(self)
|
157
157
|
end
|
158
158
|
|
159
|
+
def experience_view
|
160
|
+
@experience_view ||= ExperienceView.new(self)
|
161
|
+
end
|
162
|
+
|
163
|
+
def experience_views
|
164
|
+
@experience_views ||= ExperienceViews.new(self)
|
165
|
+
end
|
166
|
+
|
159
167
|
def flow
|
160
168
|
@flow ||= Flow.new(self)
|
161
169
|
end
|
@@ -226,7 +234,7 @@ module LosantRest
|
|
226
234
|
|
227
235
|
headers["Accept"] = "application/json"
|
228
236
|
headers["Content-Type"] = "application/json"
|
229
|
-
headers["Accept-Version"] = "^1.
|
237
|
+
headers["Accept-Version"] = "^1.9.0"
|
230
238
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
231
239
|
path = self.url + options.fetch(:path, "")
|
232
240
|
|
@@ -29,6 +29,54 @@ module LosantRest
|
|
29
29
|
@client = client
|
30
30
|
end
|
31
31
|
|
32
|
+
# Request an export of the data table's data
|
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, dataTableRows.*, or dataTableRows.export.
|
39
|
+
#
|
40
|
+
# Parameters:
|
41
|
+
# * {string} applicationId - ID associated with the application
|
42
|
+
# * {string} dataTableId - ID associated with the data table
|
43
|
+
# * {hash} exportData - Object containing export specifications (https://api.losant.com/#/definitions/dataTableRowsExport)
|
44
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
45
|
+
# * {boolean} _actions - Return resource actions in response
|
46
|
+
# * {boolean} _links - Return resource link in response
|
47
|
+
# * {boolean} _embedded - Return embedded resources in response
|
48
|
+
#
|
49
|
+
# Responses:
|
50
|
+
# * 200 - If request was successfully queued (https://api.losant.com/#/definitions/success)
|
51
|
+
#
|
52
|
+
# Errors:
|
53
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
54
|
+
# * 404 - Error if data table was not found (https://api.losant.com/#/definitions/error)
|
55
|
+
def export(params = {})
|
56
|
+
params = Utils.symbolize_hash_keys(params)
|
57
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
58
|
+
headers = {}
|
59
|
+
body = nil
|
60
|
+
|
61
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
62
|
+
raise ArgumentError.new("dataTableId is required") unless params.has_key?(:dataTableId)
|
63
|
+
|
64
|
+
body = params[:exportData] if params.has_key?(:exportData)
|
65
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
66
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
67
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
68
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
69
|
+
|
70
|
+
path = "/applications/#{params[:applicationId]}/data-tables/#{params[:dataTableId]}/rows/export"
|
71
|
+
|
72
|
+
@client.request(
|
73
|
+
method: :post,
|
74
|
+
path: path,
|
75
|
+
query: query_params,
|
76
|
+
headers: headers,
|
77
|
+
body: body)
|
78
|
+
end
|
79
|
+
|
32
80
|
# Returns the rows for a data table
|
33
81
|
#
|
34
82
|
# Authentication:
|
@@ -48,6 +48,7 @@ module LosantRest
|
|
48
48
|
#
|
49
49
|
# Responses:
|
50
50
|
# * 201 - If devices were successfully created (https://api.losant.com/#/definitions/deviceRecipeBulkCreate)
|
51
|
+
# * 202 - If devices were enqueued to be created (https://api.losant.com/#/definitions/deviceRecipeBulkCreateEnqueued)
|
51
52
|
#
|
52
53
|
# Errors:
|
53
54
|
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
@@ -22,35 +22,35 @@
|
|
22
22
|
|
23
23
|
module LosantRest
|
24
24
|
|
25
|
-
# Class containing all the actions for the Experience
|
26
|
-
class
|
25
|
+
# Class containing all the actions for the Experience Domain Resource
|
26
|
+
class ExperienceDomain
|
27
27
|
|
28
28
|
def initialize(client)
|
29
29
|
@client = client
|
30
30
|
end
|
31
31
|
|
32
|
-
# Deletes an experience
|
32
|
+
# Deletes an experience domain
|
33
33
|
#
|
34
34
|
# Authentication:
|
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.Application, all.Organization, all.User,
|
38
|
+
# all.Application, all.Organization, all.User, experienceDomain.*, or experienceDomain.delete.
|
39
39
|
#
|
40
40
|
# Parameters:
|
41
41
|
# * {string} applicationId - ID associated with the application
|
42
|
-
# * {string}
|
42
|
+
# * {string} experienceDomainId - ID associated with the experience domain
|
43
43
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
44
44
|
# * {boolean} _actions - Return resource actions in response
|
45
45
|
# * {boolean} _links - Return resource link in response
|
46
46
|
# * {boolean} _embedded - Return embedded resources in response
|
47
47
|
#
|
48
48
|
# Responses:
|
49
|
-
# * 200 - If experience
|
49
|
+
# * 200 - If experience domain was successfully deleted (https://api.losant.com/#/definitions/success)
|
50
50
|
#
|
51
51
|
# Errors:
|
52
52
|
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
53
|
-
# * 404 - Error if experience
|
53
|
+
# * 404 - Error if experience domain was not found (https://api.losant.com/#/definitions/error)
|
54
54
|
def delete(params = {})
|
55
55
|
params = Utils.symbolize_hash_keys(params)
|
56
56
|
query_params = { _actions: false, _links: true, _embedded: true }
|
@@ -58,14 +58,14 @@ module LosantRest
|
|
58
58
|
body = nil
|
59
59
|
|
60
60
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
61
|
-
raise ArgumentError.new("
|
61
|
+
raise ArgumentError.new("experienceDomainId is required") unless params.has_key?(:experienceDomainId)
|
62
62
|
|
63
63
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
64
64
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
65
65
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
66
66
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
67
67
|
|
68
|
-
path = "/applications/#{params[:applicationId]}/experience/
|
68
|
+
path = "/applications/#{params[:applicationId]}/experience/domains/#{params[:experienceDomainId]}"
|
69
69
|
|
70
70
|
@client.request(
|
71
71
|
method: :delete,
|
@@ -75,28 +75,28 @@ module LosantRest
|
|
75
75
|
body: body)
|
76
76
|
end
|
77
77
|
|
78
|
-
# Retrieves information on an experience
|
78
|
+
# Retrieves information on an experience domain
|
79
79
|
#
|
80
80
|
# Authentication:
|
81
81
|
# The client must be configured with a valid api
|
82
82
|
# access token to call this action. The token
|
83
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,
|
84
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceDomain.*, or experienceDomain.get.
|
85
85
|
#
|
86
86
|
# Parameters:
|
87
87
|
# * {string} applicationId - ID associated with the application
|
88
|
-
# * {string}
|
88
|
+
# * {string} experienceDomainId - ID associated with the experience domain
|
89
89
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
90
90
|
# * {boolean} _actions - Return resource actions in response
|
91
91
|
# * {boolean} _links - Return resource link in response
|
92
92
|
# * {boolean} _embedded - Return embedded resources in response
|
93
93
|
#
|
94
94
|
# Responses:
|
95
|
-
# * 200 - Experience
|
95
|
+
# * 200 - Experience domain information (https://api.losant.com/#/definitions/experienceDomain)
|
96
96
|
#
|
97
97
|
# Errors:
|
98
98
|
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
99
|
-
# * 404 - Error if experience
|
99
|
+
# * 404 - Error if experience domain was not found (https://api.losant.com/#/definitions/error)
|
100
100
|
def get(params = {})
|
101
101
|
params = Utils.symbolize_hash_keys(params)
|
102
102
|
query_params = { _actions: false, _links: true, _embedded: true }
|
@@ -104,14 +104,14 @@ module LosantRest
|
|
104
104
|
body = nil
|
105
105
|
|
106
106
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
107
|
-
raise ArgumentError.new("
|
107
|
+
raise ArgumentError.new("experienceDomainId is required") unless params.has_key?(:experienceDomainId)
|
108
108
|
|
109
109
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
110
110
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
111
111
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
112
112
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
113
113
|
|
114
|
-
path = "/applications/#{params[:applicationId]}/experience/
|
114
|
+
path = "/applications/#{params[:applicationId]}/experience/domains/#{params[:experienceDomainId]}"
|
115
115
|
|
116
116
|
@client.request(
|
117
117
|
method: :get,
|
@@ -121,29 +121,29 @@ module LosantRest
|
|
121
121
|
body: body)
|
122
122
|
end
|
123
123
|
|
124
|
-
# Updates information about an experience
|
124
|
+
# Updates information about an experience domain
|
125
125
|
#
|
126
126
|
# Authentication:
|
127
127
|
# The client must be configured with a valid api
|
128
128
|
# access token to call this action. The token
|
129
129
|
# must include at least one of the following scopes:
|
130
|
-
# all.Application, all.Organization, all.User,
|
130
|
+
# all.Application, all.Organization, all.User, experienceDomain.*, or experienceDomain.patch.
|
131
131
|
#
|
132
132
|
# Parameters:
|
133
133
|
# * {string} applicationId - ID associated with the application
|
134
|
-
# * {string}
|
135
|
-
# * {hash}
|
134
|
+
# * {string} experienceDomainId - ID associated with the experience domain
|
135
|
+
# * {hash} experienceDomain - Object containing new properties of the experience domain (https://api.losant.com/#/definitions/experienceDomainPatch)
|
136
136
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
137
137
|
# * {boolean} _actions - Return resource actions in response
|
138
138
|
# * {boolean} _links - Return resource link in response
|
139
139
|
# * {boolean} _embedded - Return embedded resources in response
|
140
140
|
#
|
141
141
|
# Responses:
|
142
|
-
# * 200 - Updated experience
|
142
|
+
# * 200 - Updated experience domain information (https://api.losant.com/#/definitions/experienceDomain)
|
143
143
|
#
|
144
144
|
# Errors:
|
145
145
|
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
146
|
-
# * 404 - Error if experience
|
146
|
+
# * 404 - Error if experience domain was not found (https://api.losant.com/#/definitions/error)
|
147
147
|
def patch(params = {})
|
148
148
|
params = Utils.symbolize_hash_keys(params)
|
149
149
|
query_params = { _actions: false, _links: true, _embedded: true }
|
@@ -151,16 +151,16 @@ module LosantRest
|
|
151
151
|
body = nil
|
152
152
|
|
153
153
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
154
|
-
raise ArgumentError.new("
|
155
|
-
raise ArgumentError.new("
|
154
|
+
raise ArgumentError.new("experienceDomainId is required") unless params.has_key?(:experienceDomainId)
|
155
|
+
raise ArgumentError.new("experienceDomain is required") unless params.has_key?(:experienceDomain)
|
156
156
|
|
157
|
-
body = params[:
|
157
|
+
body = params[:experienceDomain] if params.has_key?(:experienceDomain)
|
158
158
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
159
159
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
160
160
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
161
161
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
162
162
|
|
163
|
-
path = "/applications/#{params[:applicationId]}/experience/
|
163
|
+
path = "/applications/#{params[:applicationId]}/experience/domains/#{params[:experienceDomainId]}"
|
164
164
|
|
165
165
|
@client.request(
|
166
166
|
method: :patch,
|
@@ -0,0 +1,124 @@
|
|
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 Domains Resource
|
26
|
+
class ExperienceDomains
|
27
|
+
|
28
|
+
def initialize(client)
|
29
|
+
@client = client
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the experience domains 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, experienceDomains.*, or experienceDomains.get.
|
39
|
+
#
|
40
|
+
# Parameters:
|
41
|
+
# * {string} applicationId - ID associated with the application
|
42
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
43
|
+
# * {boolean} _actions - Return resource actions in response
|
44
|
+
# * {boolean} _links - Return resource link in response
|
45
|
+
# * {boolean} _embedded - Return embedded resources in response
|
46
|
+
#
|
47
|
+
# Responses:
|
48
|
+
# * 200 - Collection of experience domains (https://api.losant.com/#/definitions/experienceDomains)
|
49
|
+
#
|
50
|
+
# Errors:
|
51
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
52
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
53
|
+
def get(params = {})
|
54
|
+
params = Utils.symbolize_hash_keys(params)
|
55
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
56
|
+
headers = {}
|
57
|
+
body = nil
|
58
|
+
|
59
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
60
|
+
|
61
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
62
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
63
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
64
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
65
|
+
|
66
|
+
path = "/applications/#{params[:applicationId]}/experience/domains"
|
67
|
+
|
68
|
+
@client.request(
|
69
|
+
method: :get,
|
70
|
+
path: path,
|
71
|
+
query: query_params,
|
72
|
+
headers: headers,
|
73
|
+
body: body)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Create a new experience domain for an application
|
77
|
+
#
|
78
|
+
# Authentication:
|
79
|
+
# The client must be configured with a valid api
|
80
|
+
# access token to call this action. The token
|
81
|
+
# must include at least one of the following scopes:
|
82
|
+
# all.Application, all.Organization, all.User, experienceDomains.*, or experienceDomains.post.
|
83
|
+
#
|
84
|
+
# Parameters:
|
85
|
+
# * {string} applicationId - ID associated with the application
|
86
|
+
# * {hash} experienceDomain - New experience domain information (https://api.losant.com/#/definitions/experienceDomainPost)
|
87
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
88
|
+
# * {boolean} _actions - Return resource actions in response
|
89
|
+
# * {boolean} _links - Return resource link in response
|
90
|
+
# * {boolean} _embedded - Return embedded resources in response
|
91
|
+
#
|
92
|
+
# Responses:
|
93
|
+
# * 201 - Successfully created experience domain (https://api.losant.com/#/definitions/experienceDomain)
|
94
|
+
#
|
95
|
+
# Errors:
|
96
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
97
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
98
|
+
def post(params = {})
|
99
|
+
params = Utils.symbolize_hash_keys(params)
|
100
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
101
|
+
headers = {}
|
102
|
+
body = nil
|
103
|
+
|
104
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
105
|
+
raise ArgumentError.new("experienceDomain is required") unless params.has_key?(:experienceDomain)
|
106
|
+
|
107
|
+
body = params[:experienceDomain] if params.has_key?(:experienceDomain)
|
108
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
109
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
110
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
111
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
112
|
+
|
113
|
+
path = "/applications/#{params[:applicationId]}/experience/domains"
|
114
|
+
|
115
|
+
@client.request(
|
116
|
+
method: :post,
|
117
|
+
path: path,
|
118
|
+
query: query_params,
|
119
|
+
headers: headers,
|
120
|
+
body: body)
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
end
|