losant_rest 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.rbenv-version +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.md +237 -0
- data/Rakefile +12 -0
- data/docs/_schemas.md +6348 -0
- data/docs/accessToken.md +107 -0
- data/docs/accessTokens.md +68 -0
- data/docs/application.md +107 -0
- data/docs/applicationKey.md +115 -0
- data/docs/applicationKeys.md +81 -0
- data/docs/applications.md +76 -0
- data/docs/auth.md +104 -0
- data/docs/dashboard.md +107 -0
- data/docs/dashboards.md +76 -0
- data/docs/data.md +78 -0
- data/docs/device.md +300 -0
- data/docs/deviceRecipe.md +152 -0
- data/docs/deviceRecipes.md +81 -0
- data/docs/devices.md +117 -0
- data/docs/event.md +115 -0
- data/docs/events.md +153 -0
- data/docs/flow.md +261 -0
- data/docs/flows.md +81 -0
- data/docs/me.md +312 -0
- data/docs/org.md +279 -0
- data/docs/orgs.md +75 -0
- data/docs/webhook.md +115 -0
- data/docs/webhooks.md +81 -0
- data/examples/auth.rb +32 -0
- data/examples/list_devices.rb +45 -0
- data/lib/losant_rest/access_token.rb +122 -0
- data/lib/losant_rest/access_tokens.rb +80 -0
- data/lib/losant_rest/application.rb +122 -0
- data/lib/losant_rest/application_key.rb +128 -0
- data/lib/losant_rest/application_keys.rb +98 -0
- data/lib/losant_rest/applications.rb +94 -0
- data/lib/losant_rest/auth.rb +122 -0
- data/lib/losant_rest/client.rb +132 -0
- data/lib/losant_rest/dashboard.rb +122 -0
- data/lib/losant_rest/dashboards.rb +94 -0
- data/lib/losant_rest/data.rb +89 -0
- data/lib/losant_rest/device.rb +336 -0
- data/lib/losant_rest/device_recipe.rb +169 -0
- data/lib/losant_rest/device_recipes.rb +98 -0
- data/lib/losant_rest/devices.rb +139 -0
- data/lib/losant_rest/error.rb +12 -0
- data/lib/losant_rest/event.rb +128 -0
- data/lib/losant_rest/events.rb +183 -0
- data/lib/losant_rest/flow.rb +290 -0
- data/lib/losant_rest/flows.rb +98 -0
- data/lib/losant_rest/me.rb +362 -0
- data/lib/losant_rest/org.rb +314 -0
- data/lib/losant_rest/orgs.rb +92 -0
- data/lib/losant_rest/utils.rb +22 -0
- data/lib/losant_rest/version.rb +3 -0
- data/lib/losant_rest/webhook.rb +128 -0
- data/lib/losant_rest/webhooks.rb +98 -0
- data/lib/losant_rest.rb +43 -0
- data/losant_rest.gemspec +25 -0
- data/schemas/accessToken.json +52 -0
- data/schemas/accessTokenPatch.json +19 -0
- data/schemas/accessTokenPost.json +32 -0
- data/schemas/accessTokens.json +65 -0
- data/schemas/application.json +65 -0
- data/schemas/applicationKey.json +68 -0
- data/schemas/applicationKeyPatch.json +18 -0
- data/schemas/applicationKeyPost.json +36 -0
- data/schemas/applicationKeys.json +110 -0
- data/schemas/applicationPatch.json +16 -0
- data/schemas/applicationPost.json +23 -0
- data/schemas/applications.json +103 -0
- data/schemas/authedDevice.json +34 -0
- data/schemas/authedUser.json +18 -0
- data/schemas/dashboard.json +95 -0
- data/schemas/dashboardPatch.json +69 -0
- data/schemas/dashboardPost.json +76 -0
- data/schemas/dashboards.json +133 -0
- data/schemas/device.json +113 -0
- data/schemas/deviceCommand.json +20 -0
- data/schemas/deviceCommands.json +25 -0
- data/schemas/deviceCredentials.json +22 -0
- data/schemas/deviceLog.json +28 -0
- data/schemas/devicePatch.json +78 -0
- data/schemas/devicePost.json +81 -0
- data/schemas/deviceRecipe.json +106 -0
- data/schemas/deviceRecipeBulkCreate.json +15 -0
- data/schemas/deviceRecipeBulkCreatePost.json +19 -0
- data/schemas/deviceRecipePatch.json +87 -0
- data/schemas/deviceRecipePost.json +90 -0
- data/schemas/deviceRecipes.json +148 -0
- data/schemas/deviceState.json +30 -0
- data/schemas/deviceStates.json +35 -0
- data/schemas/deviceTagFilter.json +19 -0
- data/schemas/devices.json +155 -0
- data/schemas/disableTwoFactorAuth.json +20 -0
- data/schemas/enableTwoFactorAuth.json +21 -0
- data/schemas/error.json +12 -0
- data/schemas/event.json +115 -0
- data/schemas/eventPatch.json +20 -0
- data/schemas/eventPost.json +39 -0
- data/schemas/events.json +165 -0
- data/schemas/flow.json +137 -0
- data/schemas/flowLog.json +46 -0
- data/schemas/flowPatch.json +107 -0
- data/schemas/flowPost.json +110 -0
- data/schemas/flowStorageEntries.json +7 -0
- data/schemas/flowStorageEntry.json +16 -0
- data/schemas/flows.json +179 -0
- data/schemas/githubLogin.json +14 -0
- data/schemas/lastValueData.json +34 -0
- data/schemas/lastValueQuery.json +36 -0
- data/schemas/me.json +173 -0
- data/schemas/mePatch.json +43 -0
- data/schemas/multiDeviceCommand.json +45 -0
- data/schemas/org.json +81 -0
- data/schemas/orgInvitePost.json +24 -0
- data/schemas/orgInvites.json +36 -0
- data/schemas/orgMemberPatch.json +23 -0
- data/schemas/orgPatch.json +16 -0
- data/schemas/orgPost.json +19 -0
- data/schemas/orgs.json +119 -0
- data/schemas/recentItem.json +27 -0
- data/schemas/recentItemList.json +36 -0
- data/schemas/success.json +12 -0
- data/schemas/timeSeriesData.json +89 -0
- data/schemas/timeSeriesQuery.json +64 -0
- data/schemas/userCredentials.json +25 -0
- data/schemas/virtualButtonPress.json +14 -0
- data/schemas/webhook.json +52 -0
- data/schemas/webhookPatch.json +29 -0
- data/schemas/webhookPost.json +32 -0
- data/schemas/webhooks.json +94 -0
- data/test/basic_test.rb +67 -0
- data/test/test_helper.rb +14 -0
- metadata +239 -0
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
module LosantRest
|
|
2
|
+
|
|
3
|
+
# Class containing all the actions for the Me Resource
|
|
4
|
+
class Me
|
|
5
|
+
|
|
6
|
+
def initialize(client)
|
|
7
|
+
@client = client
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Adds an item to a recent item list
|
|
11
|
+
#
|
|
12
|
+
# Parameters:
|
|
13
|
+
# * {hash} data - Object containing recent item info (https://api.losant.com/#/definitions/recentItem)
|
|
14
|
+
# * {boolean} _actions - Return resource actions in response
|
|
15
|
+
# * {boolean} _links - Return resource link in response
|
|
16
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
17
|
+
#
|
|
18
|
+
# Responses:
|
|
19
|
+
# * 200 - Updated recent item list (https://api.losant.com/#/definitions/recentItemList)
|
|
20
|
+
#
|
|
21
|
+
# Errors:
|
|
22
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
23
|
+
def add_recent_item(params = {})
|
|
24
|
+
params = Utils.symbolize_hash_keys(params)
|
|
25
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
26
|
+
headers = {}
|
|
27
|
+
body = nil
|
|
28
|
+
|
|
29
|
+
raise ArgumentError.new("data is required") unless params.has_key?(:data)
|
|
30
|
+
|
|
31
|
+
body = params[:data] if params.has_key?(:data)
|
|
32
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
33
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
34
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
35
|
+
|
|
36
|
+
path = "/me/recentItems"
|
|
37
|
+
|
|
38
|
+
@client.request(
|
|
39
|
+
method: :post,
|
|
40
|
+
path: path,
|
|
41
|
+
query: query_params,
|
|
42
|
+
headers: headers,
|
|
43
|
+
body: body)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Deletes the current user
|
|
47
|
+
#
|
|
48
|
+
# Parameters:
|
|
49
|
+
# * {hash} credentials - User authentication credentials (https://api.losant.com/#/definitions/userCredentials)
|
|
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 - If the user was successfully deleted (https://api.losant.com/#/definitions/success)
|
|
56
|
+
#
|
|
57
|
+
# Errors:
|
|
58
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
59
|
+
def delete(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("credentials is required") unless params.has_key?(:credentials)
|
|
66
|
+
|
|
67
|
+
body = params[:credentials] if params.has_key?(:credentials)
|
|
68
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
69
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
70
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
71
|
+
|
|
72
|
+
path = "/me/delete"
|
|
73
|
+
|
|
74
|
+
@client.request(
|
|
75
|
+
method: :post,
|
|
76
|
+
path: path,
|
|
77
|
+
query: query_params,
|
|
78
|
+
headers: headers,
|
|
79
|
+
body: body)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Disables two factor auth for the current user
|
|
83
|
+
#
|
|
84
|
+
# Parameters:
|
|
85
|
+
# * {hash} data - Object containing two factor auth properties (https://api.losant.com/#/definitions/disableTwoFactorAuth)
|
|
86
|
+
# * {boolean} _actions - Return resource actions in response
|
|
87
|
+
# * {boolean} _links - Return resource link in response
|
|
88
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
89
|
+
#
|
|
90
|
+
# Responses:
|
|
91
|
+
# * 200 - Updated user information (https://api.losant.com/#/definitions/me)
|
|
92
|
+
#
|
|
93
|
+
# Errors:
|
|
94
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
95
|
+
def disable_two_factor_auth(params = {})
|
|
96
|
+
params = Utils.symbolize_hash_keys(params)
|
|
97
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
98
|
+
headers = {}
|
|
99
|
+
body = nil
|
|
100
|
+
|
|
101
|
+
raise ArgumentError.new("data is required") unless params.has_key?(:data)
|
|
102
|
+
|
|
103
|
+
body = params[:data] if params.has_key?(:data)
|
|
104
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
105
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
106
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
107
|
+
|
|
108
|
+
path = "/me/disableTwoFactorAuth"
|
|
109
|
+
|
|
110
|
+
@client.request(
|
|
111
|
+
method: :patch,
|
|
112
|
+
path: path,
|
|
113
|
+
query: query_params,
|
|
114
|
+
headers: headers,
|
|
115
|
+
body: body)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Disconnects the user from Github
|
|
119
|
+
#
|
|
120
|
+
# Parameters:
|
|
121
|
+
# * {boolean} _actions - Return resource actions in response
|
|
122
|
+
# * {boolean} _links - Return resource link in response
|
|
123
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
124
|
+
#
|
|
125
|
+
# Responses:
|
|
126
|
+
# * 200 - Updated user information (https://api.losant.com/#/definitions/me)
|
|
127
|
+
#
|
|
128
|
+
# Errors:
|
|
129
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
130
|
+
def disconnect_github(params = {})
|
|
131
|
+
params = Utils.symbolize_hash_keys(params)
|
|
132
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
133
|
+
headers = {}
|
|
134
|
+
body = nil
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
138
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
139
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
140
|
+
|
|
141
|
+
path = "/me/disconnectGithub"
|
|
142
|
+
|
|
143
|
+
@client.request(
|
|
144
|
+
method: :patch,
|
|
145
|
+
path: path,
|
|
146
|
+
query: query_params,
|
|
147
|
+
headers: headers,
|
|
148
|
+
body: body)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Disconnects the user from Twitter
|
|
152
|
+
#
|
|
153
|
+
# Parameters:
|
|
154
|
+
# * {boolean} _actions - Return resource actions in response
|
|
155
|
+
# * {boolean} _links - Return resource link in response
|
|
156
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
157
|
+
#
|
|
158
|
+
# Responses:
|
|
159
|
+
# * 200 - Updated user information (https://api.losant.com/#/definitions/me)
|
|
160
|
+
#
|
|
161
|
+
# Errors:
|
|
162
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
163
|
+
def disconnect_twitter(params = {})
|
|
164
|
+
params = Utils.symbolize_hash_keys(params)
|
|
165
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
166
|
+
headers = {}
|
|
167
|
+
body = nil
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
171
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
172
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
173
|
+
|
|
174
|
+
path = "/me/disconnectTwitter"
|
|
175
|
+
|
|
176
|
+
@client.request(
|
|
177
|
+
method: :patch,
|
|
178
|
+
path: path,
|
|
179
|
+
query: query_params,
|
|
180
|
+
headers: headers,
|
|
181
|
+
body: body)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Enables two factor auth for the current user
|
|
185
|
+
#
|
|
186
|
+
# Parameters:
|
|
187
|
+
# * {hash} data - Object containing two factor auth properties (https://api.losant.com/#/definitions/enableTwoFactorAuth)
|
|
188
|
+
# * {boolean} _actions - Return resource actions in response
|
|
189
|
+
# * {boolean} _links - Return resource link in response
|
|
190
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
191
|
+
#
|
|
192
|
+
# Responses:
|
|
193
|
+
# * 200 - Updated user information (https://api.losant.com/#/definitions/me)
|
|
194
|
+
#
|
|
195
|
+
# Errors:
|
|
196
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
197
|
+
def enable_two_factor_auth(params = {})
|
|
198
|
+
params = Utils.symbolize_hash_keys(params)
|
|
199
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
200
|
+
headers = {}
|
|
201
|
+
body = nil
|
|
202
|
+
|
|
203
|
+
raise ArgumentError.new("data is required") unless params.has_key?(:data)
|
|
204
|
+
|
|
205
|
+
body = params[:data] if params.has_key?(:data)
|
|
206
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
207
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
208
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
209
|
+
|
|
210
|
+
path = "/me/enableTwoFactorAuth"
|
|
211
|
+
|
|
212
|
+
@client.request(
|
|
213
|
+
method: :patch,
|
|
214
|
+
path: path,
|
|
215
|
+
query: query_params,
|
|
216
|
+
headers: headers,
|
|
217
|
+
body: body)
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Gets a recent item list
|
|
221
|
+
#
|
|
222
|
+
# Parameters:
|
|
223
|
+
# * {string} parentId - Parent id of the recent list
|
|
224
|
+
# * {undefined} itemType - Item type to get the recent list of. Accepted values are: application, device, flow, dashboard
|
|
225
|
+
# * {boolean} _actions - Return resource actions in response
|
|
226
|
+
# * {boolean} _links - Return resource link in response
|
|
227
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
228
|
+
#
|
|
229
|
+
# Responses:
|
|
230
|
+
# * 200 - Recent item list (https://api.losant.com/#/definitions/recentItemList)
|
|
231
|
+
#
|
|
232
|
+
# Errors:
|
|
233
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
234
|
+
def fetch_recent_items(params = {})
|
|
235
|
+
params = Utils.symbolize_hash_keys(params)
|
|
236
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
237
|
+
headers = {}
|
|
238
|
+
body = nil
|
|
239
|
+
|
|
240
|
+
raise ArgumentError.new("itemType is required") unless params.has_key?(:itemType)
|
|
241
|
+
|
|
242
|
+
query_params[:parentId] = params[:parentId] if params.has_key?(:parentId)
|
|
243
|
+
query_params[:itemType] = params[:itemType] if params.has_key?(:itemType)
|
|
244
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
245
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
246
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
247
|
+
|
|
248
|
+
path = "/me/recentItems"
|
|
249
|
+
|
|
250
|
+
@client.request(
|
|
251
|
+
method: :get,
|
|
252
|
+
path: path,
|
|
253
|
+
query: query_params,
|
|
254
|
+
headers: headers,
|
|
255
|
+
body: body)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Retrieves information on the current user
|
|
259
|
+
#
|
|
260
|
+
# Parameters:
|
|
261
|
+
# * {undefined} includeRecent - Should the user include recent app/dashboard info
|
|
262
|
+
# * {boolean} _actions - Return resource actions in response
|
|
263
|
+
# * {boolean} _links - Return resource link in response
|
|
264
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
265
|
+
#
|
|
266
|
+
# Responses:
|
|
267
|
+
# * 200 - Current user information (https://api.losant.com/#/definitions/me)
|
|
268
|
+
#
|
|
269
|
+
# Errors:
|
|
270
|
+
def get(params = {})
|
|
271
|
+
params = Utils.symbolize_hash_keys(params)
|
|
272
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
273
|
+
headers = {}
|
|
274
|
+
body = nil
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
query_params[:includeRecent] = params[:includeRecent] if params.has_key?(:includeRecent)
|
|
278
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
279
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
280
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
281
|
+
|
|
282
|
+
path = "/me"
|
|
283
|
+
|
|
284
|
+
@client.request(
|
|
285
|
+
method: :get,
|
|
286
|
+
path: path,
|
|
287
|
+
query: query_params,
|
|
288
|
+
headers: headers,
|
|
289
|
+
body: body)
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
# Updates information about the current user
|
|
293
|
+
#
|
|
294
|
+
# Parameters:
|
|
295
|
+
# * {hash} user - Object containing new user properties (https://api.losant.com/#/definitions/mePatch)
|
|
296
|
+
# * {boolean} _actions - Return resource actions in response
|
|
297
|
+
# * {boolean} _links - Return resource link in response
|
|
298
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
299
|
+
#
|
|
300
|
+
# Responses:
|
|
301
|
+
# * 200 - Updated user information (https://api.losant.com/#/definitions/me)
|
|
302
|
+
#
|
|
303
|
+
# Errors:
|
|
304
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
305
|
+
def patch(params = {})
|
|
306
|
+
params = Utils.symbolize_hash_keys(params)
|
|
307
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
308
|
+
headers = {}
|
|
309
|
+
body = nil
|
|
310
|
+
|
|
311
|
+
raise ArgumentError.new("user is required") unless params.has_key?(:user)
|
|
312
|
+
|
|
313
|
+
body = params[:user] if params.has_key?(:user)
|
|
314
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
315
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
316
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
317
|
+
|
|
318
|
+
path = "/me"
|
|
319
|
+
|
|
320
|
+
@client.request(
|
|
321
|
+
method: :patch,
|
|
322
|
+
path: path,
|
|
323
|
+
query: query_params,
|
|
324
|
+
headers: headers,
|
|
325
|
+
body: body)
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Sends an email verification to the user
|
|
329
|
+
#
|
|
330
|
+
# Parameters:
|
|
331
|
+
# * {boolean} _actions - Return resource actions in response
|
|
332
|
+
# * {boolean} _links - Return resource link in response
|
|
333
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
334
|
+
#
|
|
335
|
+
# Responses:
|
|
336
|
+
# * 200 - If email verification was successfully sent (https://api.losant.com/#/definitions/success)
|
|
337
|
+
#
|
|
338
|
+
# Errors:
|
|
339
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
340
|
+
def verify_email(params = {})
|
|
341
|
+
params = Utils.symbolize_hash_keys(params)
|
|
342
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
343
|
+
headers = {}
|
|
344
|
+
body = nil
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
348
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
349
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
350
|
+
|
|
351
|
+
path = "/me/verify-email"
|
|
352
|
+
|
|
353
|
+
@client.request(
|
|
354
|
+
method: :post,
|
|
355
|
+
path: path,
|
|
356
|
+
query: query_params,
|
|
357
|
+
headers: headers,
|
|
358
|
+
body: body)
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
end
|
|
362
|
+
end
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
module LosantRest
|
|
2
|
+
|
|
3
|
+
# Class containing all the actions for the Org Resource
|
|
4
|
+
class Org
|
|
5
|
+
|
|
6
|
+
def initialize(client)
|
|
7
|
+
@client = client
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Deletes an organization
|
|
11
|
+
#
|
|
12
|
+
# Parameters:
|
|
13
|
+
# * {string} orgId - ID associated with the organization
|
|
14
|
+
# * {boolean} _actions - Return resource actions in response
|
|
15
|
+
# * {boolean} _links - Return resource link in response
|
|
16
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
17
|
+
#
|
|
18
|
+
# Responses:
|
|
19
|
+
# * 200 - If organization was successfully deleted (https://api.losant.com/#/definitions/success)
|
|
20
|
+
#
|
|
21
|
+
# Errors:
|
|
22
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
23
|
+
# * 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
|
|
24
|
+
def delete(params = {})
|
|
25
|
+
params = Utils.symbolize_hash_keys(params)
|
|
26
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
27
|
+
headers = {}
|
|
28
|
+
body = nil
|
|
29
|
+
|
|
30
|
+
raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
|
|
31
|
+
|
|
32
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
33
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
34
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
35
|
+
|
|
36
|
+
path = "/orgs/#{params[:orgId]}"
|
|
37
|
+
|
|
38
|
+
@client.request(
|
|
39
|
+
method: :delete,
|
|
40
|
+
path: path,
|
|
41
|
+
query: query_params,
|
|
42
|
+
headers: headers,
|
|
43
|
+
body: body)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Retrieves information on an organization
|
|
47
|
+
#
|
|
48
|
+
# Parameters:
|
|
49
|
+
# * {string} orgId - ID associated with the organization
|
|
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 - Organization information (https://api.losant.com/#/definitions/org)
|
|
56
|
+
#
|
|
57
|
+
# Errors:
|
|
58
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
59
|
+
# * 404 - Error if organization 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("orgId is required") unless params.has_key?(:orgId)
|
|
67
|
+
|
|
68
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
69
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
70
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
71
|
+
|
|
72
|
+
path = "/orgs/#{params[:orgId]}"
|
|
73
|
+
|
|
74
|
+
@client.request(
|
|
75
|
+
method: :get,
|
|
76
|
+
path: path,
|
|
77
|
+
query: query_params,
|
|
78
|
+
headers: headers,
|
|
79
|
+
body: body)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Invites a person to an organization
|
|
83
|
+
#
|
|
84
|
+
# Parameters:
|
|
85
|
+
# * {string} orgId - ID associated with the organization
|
|
86
|
+
# * {hash} invite - Object containing new invite info (https://api.losant.com/#/definitions/orgInvitePost)
|
|
87
|
+
# * {boolean} _actions - Return resource actions in response
|
|
88
|
+
# * {boolean} _links - Return resource link in response
|
|
89
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
90
|
+
#
|
|
91
|
+
# Responses:
|
|
92
|
+
# * 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
|
|
93
|
+
#
|
|
94
|
+
# Errors:
|
|
95
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
96
|
+
# * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
|
|
97
|
+
def invite_member(params = {})
|
|
98
|
+
params = Utils.symbolize_hash_keys(params)
|
|
99
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
100
|
+
headers = {}
|
|
101
|
+
body = nil
|
|
102
|
+
|
|
103
|
+
raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
|
|
104
|
+
raise ArgumentError.new("invite is required") unless params.has_key?(:invite)
|
|
105
|
+
|
|
106
|
+
body = params[:invite] if params.has_key?(:invite)
|
|
107
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
108
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
109
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
110
|
+
|
|
111
|
+
path = "/orgs/#{params[:orgId]}/invites"
|
|
112
|
+
|
|
113
|
+
@client.request(
|
|
114
|
+
method: :post,
|
|
115
|
+
path: path,
|
|
116
|
+
query: query_params,
|
|
117
|
+
headers: headers,
|
|
118
|
+
body: body)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Modifies a current org member's role
|
|
122
|
+
#
|
|
123
|
+
# Parameters:
|
|
124
|
+
# * {string} orgId - ID associated with the organization
|
|
125
|
+
# * {hash} member - Object containing new member pair (https://api.losant.com/#/definitions/orgMemberPatch)
|
|
126
|
+
# * {boolean} _actions - Return resource actions in response
|
|
127
|
+
# * {boolean} _links - Return resource link in response
|
|
128
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
129
|
+
#
|
|
130
|
+
# Responses:
|
|
131
|
+
# * 200 - Updated organization information (https://api.losant.com/#/definitions/org)
|
|
132
|
+
#
|
|
133
|
+
# Errors:
|
|
134
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
135
|
+
# * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
|
|
136
|
+
def modify_member(params = {})
|
|
137
|
+
params = Utils.symbolize_hash_keys(params)
|
|
138
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
139
|
+
headers = {}
|
|
140
|
+
body = nil
|
|
141
|
+
|
|
142
|
+
raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
|
|
143
|
+
raise ArgumentError.new("member is required") unless params.has_key?(:member)
|
|
144
|
+
|
|
145
|
+
body = params[:member] if params.has_key?(:member)
|
|
146
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
147
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
148
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
149
|
+
|
|
150
|
+
path = "/orgs/#{params[:orgId]}/member"
|
|
151
|
+
|
|
152
|
+
@client.request(
|
|
153
|
+
method: :patch,
|
|
154
|
+
path: path,
|
|
155
|
+
query: query_params,
|
|
156
|
+
headers: headers,
|
|
157
|
+
body: body)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Updates information about an organization
|
|
161
|
+
#
|
|
162
|
+
# Parameters:
|
|
163
|
+
# * {string} orgId - ID associated with the organization
|
|
164
|
+
# * {hash} organization - Object containing new organization properties (https://api.losant.com/#/definitions/orgPatch)
|
|
165
|
+
# * {boolean} _actions - Return resource actions in response
|
|
166
|
+
# * {boolean} _links - Return resource link in response
|
|
167
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
168
|
+
#
|
|
169
|
+
# Responses:
|
|
170
|
+
# * 200 - Updated organization information (https://api.losant.com/#/definitions/org)
|
|
171
|
+
#
|
|
172
|
+
# Errors:
|
|
173
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
174
|
+
# * 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
|
|
175
|
+
def patch(params = {})
|
|
176
|
+
params = Utils.symbolize_hash_keys(params)
|
|
177
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
178
|
+
headers = {}
|
|
179
|
+
body = nil
|
|
180
|
+
|
|
181
|
+
raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
|
|
182
|
+
raise ArgumentError.new("organization is required") unless params.has_key?(:organization)
|
|
183
|
+
|
|
184
|
+
body = params[:organization] if params.has_key?(:organization)
|
|
185
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
186
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
187
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
188
|
+
|
|
189
|
+
path = "/orgs/#{params[:orgId]}"
|
|
190
|
+
|
|
191
|
+
@client.request(
|
|
192
|
+
method: :patch,
|
|
193
|
+
path: path,
|
|
194
|
+
query: query_params,
|
|
195
|
+
headers: headers,
|
|
196
|
+
body: body)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Gets the current pending invites
|
|
200
|
+
#
|
|
201
|
+
# Parameters:
|
|
202
|
+
# * {string} orgId - ID associated with the organization
|
|
203
|
+
# * {boolean} _actions - Return resource actions in response
|
|
204
|
+
# * {boolean} _links - Return resource link in response
|
|
205
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
206
|
+
#
|
|
207
|
+
# Responses:
|
|
208
|
+
# * 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
|
|
209
|
+
#
|
|
210
|
+
# Errors:
|
|
211
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
212
|
+
# * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
|
|
213
|
+
def pending_invites(params = {})
|
|
214
|
+
params = Utils.symbolize_hash_keys(params)
|
|
215
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
216
|
+
headers = {}
|
|
217
|
+
body = nil
|
|
218
|
+
|
|
219
|
+
raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
|
|
220
|
+
|
|
221
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
222
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
223
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
224
|
+
|
|
225
|
+
path = "/orgs/#{params[:orgId]}/invites"
|
|
226
|
+
|
|
227
|
+
@client.request(
|
|
228
|
+
method: :get,
|
|
229
|
+
path: path,
|
|
230
|
+
query: query_params,
|
|
231
|
+
headers: headers,
|
|
232
|
+
body: body)
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Modifies a current org member's role
|
|
236
|
+
#
|
|
237
|
+
# Parameters:
|
|
238
|
+
# * {string} orgId - ID associated with the organization
|
|
239
|
+
# * {string} userId - Id of user to remove
|
|
240
|
+
# * {boolean} _actions - Return resource actions in response
|
|
241
|
+
# * {boolean} _links - Return resource link in response
|
|
242
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
243
|
+
#
|
|
244
|
+
# Responses:
|
|
245
|
+
# * 200 - Updated organization information (https://api.losant.com/#/definitions/org)
|
|
246
|
+
#
|
|
247
|
+
# Errors:
|
|
248
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
249
|
+
# * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
|
|
250
|
+
def remove_member(params = {})
|
|
251
|
+
params = Utils.symbolize_hash_keys(params)
|
|
252
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
253
|
+
headers = {}
|
|
254
|
+
body = nil
|
|
255
|
+
|
|
256
|
+
raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
|
|
257
|
+
raise ArgumentError.new("userId is required") unless params.has_key?(:userId)
|
|
258
|
+
|
|
259
|
+
query_params[:userId] = params[:userId] if params.has_key?(:userId)
|
|
260
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
261
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
262
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
263
|
+
|
|
264
|
+
path = "/orgs/#{params[:orgId]}/member"
|
|
265
|
+
|
|
266
|
+
@client.request(
|
|
267
|
+
method: :delete,
|
|
268
|
+
path: path,
|
|
269
|
+
query: query_params,
|
|
270
|
+
headers: headers,
|
|
271
|
+
body: body)
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# Revokes an existing invite
|
|
275
|
+
#
|
|
276
|
+
# Parameters:
|
|
277
|
+
# * {string} orgId - ID associated with the organization
|
|
278
|
+
# * {string} inviteId - Id of invite to revoke
|
|
279
|
+
# * {boolean} _actions - Return resource actions in response
|
|
280
|
+
# * {boolean} _links - Return resource link in response
|
|
281
|
+
# * {boolean} _embedded - Return embedded resources in response
|
|
282
|
+
#
|
|
283
|
+
# Responses:
|
|
284
|
+
# * 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
|
|
285
|
+
#
|
|
286
|
+
# Errors:
|
|
287
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
|
288
|
+
# * 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
|
|
289
|
+
def revoke_invite(params = {})
|
|
290
|
+
params = Utils.symbolize_hash_keys(params)
|
|
291
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
|
292
|
+
headers = {}
|
|
293
|
+
body = nil
|
|
294
|
+
|
|
295
|
+
raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
|
|
296
|
+
raise ArgumentError.new("inviteId is required") unless params.has_key?(:inviteId)
|
|
297
|
+
|
|
298
|
+
query_params[:inviteId] = params[:inviteId] if params.has_key?(:inviteId)
|
|
299
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
|
300
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
|
301
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
|
302
|
+
|
|
303
|
+
path = "/orgs/#{params[:orgId]}/invites"
|
|
304
|
+
|
|
305
|
+
@client.request(
|
|
306
|
+
method: :delete,
|
|
307
|
+
path: path,
|
|
308
|
+
query: query_params,
|
|
309
|
+
headers: headers,
|
|
310
|
+
body: body)
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
end
|
|
314
|
+
end
|