losant_rest 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -572,5 +572,54 @@ module LosantRest
572
572
  body: body)
573
573
  end
574
574
 
575
+ # Set the current connection status of the device
576
+ #
577
+ # Authentication:
578
+ # The client must be configured with a valid api
579
+ # access token to call this action. The token
580
+ # must include at least one of the following scopes:
581
+ # all.Application, all.Device, all.Organization, all.User, device.*, or device.setConnectionStatus.
582
+ #
583
+ # Parameters:
584
+ # * {string} applicationId - ID associated with the application
585
+ # * {string} deviceId - ID associated with the device
586
+ # * {hash} connectionStatus - The current connection status of the device (https://api.losant.com/#/definitions/deviceConnectionStatus)
587
+ # * {string} losantdomain - Domain scope of request (rarely needed)
588
+ # * {boolean} _actions - Return resource actions in response
589
+ # * {boolean} _links - Return resource link in response
590
+ # * {boolean} _embedded - Return embedded resources in response
591
+ #
592
+ # Responses:
593
+ # * 200 - If connection status was successfully applied (https://api.losant.com/#/definitions/success)
594
+ #
595
+ # Errors:
596
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
597
+ # * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
598
+ def set_connection_status(params = {})
599
+ params = Utils.symbolize_hash_keys(params)
600
+ query_params = { _actions: false, _links: true, _embedded: true }
601
+ headers = {}
602
+ body = nil
603
+
604
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
605
+ raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
606
+ raise ArgumentError.new("connectionStatus is required") unless params.has_key?(:connectionStatus)
607
+
608
+ body = params[:connectionStatus] if params.has_key?(:connectionStatus)
609
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
610
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
611
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
612
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
613
+
614
+ path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/setConnectionStatus"
615
+
616
+ @client.request(
617
+ method: :post,
618
+ path: path,
619
+ query: query_params,
620
+ headers: headers,
621
+ body: body)
622
+ end
623
+
575
624
  end
576
625
  end
@@ -0,0 +1,89 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2018 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 Resource
26
+ class Experience
27
+
28
+ def initialize(client)
29
+ @client = client
30
+ end
31
+
32
+ # Deletes multiple parts of an experience including users, domains, endpoints, groups, views, and workflows
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, experience.*, or experience.delete.
39
+ #
40
+ # Parameters:
41
+ # * {string} applicationId - ID associated with the application
42
+ # * {string} keepUser - Experience Users will automatically be deleted unless this is set.
43
+ # * {string} keepDomains - Experience Domains will automatically be deleted unless this is set.
44
+ # * {string} keepEndpoints - Experience Endpoints will automatically be deleted unless this is set.
45
+ # * {string} keepGroups - Experience Groups will automatically be deleted unless this is set.
46
+ # * {string} keepViews - Experience Views will automatically be deleted unless this is set.
47
+ # * {string} removeWorkflows - If set will delete any workflows under this application with an Endpoint Trigger Node.
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 - If everything marked as true was successfully deleted (https://api.losant.com/#/definitions/success)
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 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("applicationId is required") unless params.has_key?(:applicationId)
66
+
67
+ query_params[:keepUser] = params[:keepUser] if params.has_key?(:keepUser)
68
+ query_params[:keepDomains] = params[:keepDomains] if params.has_key?(:keepDomains)
69
+ query_params[:keepEndpoints] = params[:keepEndpoints] if params.has_key?(:keepEndpoints)
70
+ query_params[:keepGroups] = params[:keepGroups] if params.has_key?(:keepGroups)
71
+ query_params[:keepViews] = params[:keepViews] if params.has_key?(:keepViews)
72
+ query_params[:removeWorkflows] = params[:removeWorkflows] if params.has_key?(:removeWorkflows)
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"
79
+
80
+ @client.request(
81
+ method: :delete,
82
+ path: path,
83
+ query: query_params,
84
+ headers: headers,
85
+ body: body)
86
+ end
87
+
88
+ end
89
+ end
@@ -21,5 +21,5 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  module LosantRest
24
- VERSION = "1.7.0"
24
+ VERSION = "1.7.1"
25
25
  end
data/lib/losant_rest.rb CHANGED
@@ -46,6 +46,7 @@ require_relative "losant_rest/devices"
46
46
  require_relative "losant_rest/edge_deployments"
47
47
  require_relative "losant_rest/event"
48
48
  require_relative "losant_rest/events"
49
+ require_relative "losant_rest/experience"
49
50
  require_relative "losant_rest/experience_domain"
50
51
  require_relative "losant_rest/experience_domains"
51
52
  require_relative "losant_rest/experience_endpoint"
@@ -39,6 +39,7 @@
39
39
  "edgeDeployments.*",
40
40
  "event.*",
41
41
  "events.*",
42
+ "experience.*",
42
43
  "experienceDomain.*",
43
44
  "experienceDomains.*",
44
45
  "experienceEndpoint.*",
@@ -105,6 +106,7 @@
105
106
  "device.removeData",
106
107
  "device.sendCommand",
107
108
  "device.sendState",
109
+ "device.setConnectionStatus",
108
110
  "device.stateStream",
109
111
  "deviceRecipe.bulkCreate",
110
112
  "deviceRecipe.delete",
@@ -127,6 +129,7 @@
127
129
  "events.mostRecentBySeverity",
128
130
  "events.patch",
129
131
  "events.post",
132
+ "experience.delete",
130
133
  "experienceDomain.delete",
131
134
  "experienceDomain.get",
132
135
  "experienceDomain.patch",
@@ -0,0 +1,115 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "oneOf": [
4
+ {
5
+ "title": "Device Connected",
6
+ "description": "Schema for marking a device as connected",
7
+ "type": "object",
8
+ "properties": {
9
+ "status": {
10
+ "type": "string",
11
+ "enum": [
12
+ "connected"
13
+ ]
14
+ },
15
+ "connectedAt": {
16
+ "oneOf": [
17
+ {
18
+ "type": "string"
19
+ },
20
+ {
21
+ "type": "number"
22
+ },
23
+ {
24
+ "type": "object",
25
+ "properties": {
26
+ "$date": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "additionalProperties": false,
31
+ "required": [
32
+ "$date"
33
+ ]
34
+ }
35
+ ]
36
+ }
37
+ },
38
+ "required": [
39
+ "status"
40
+ ],
41
+ "additionalProperties": false
42
+ },
43
+ {
44
+ "title": "Device Disconnected",
45
+ "description": "Schema for marking a device as disconnected",
46
+ "type": "object",
47
+ "properties": {
48
+ "status": {
49
+ "type": "string",
50
+ "enum": [
51
+ "disconnected"
52
+ ]
53
+ },
54
+ "connectedAt": {
55
+ "oneOf": [
56
+ {
57
+ "type": "string"
58
+ },
59
+ {
60
+ "type": "number"
61
+ },
62
+ {
63
+ "type": "object",
64
+ "properties": {
65
+ "$date": {
66
+ "type": "string"
67
+ }
68
+ },
69
+ "additionalProperties": false,
70
+ "required": [
71
+ "$date"
72
+ ]
73
+ }
74
+ ]
75
+ },
76
+ "disconnectedAt": {
77
+ "oneOf": [
78
+ {
79
+ "type": "string"
80
+ },
81
+ {
82
+ "type": "number"
83
+ },
84
+ {
85
+ "type": "object",
86
+ "properties": {
87
+ "$date": {
88
+ "type": "string"
89
+ }
90
+ },
91
+ "additionalProperties": false,
92
+ "required": [
93
+ "$date"
94
+ ]
95
+ }
96
+ ]
97
+ },
98
+ "disconnectReason": {
99
+ "type": "string",
100
+ "maxLength": 1024
101
+ },
102
+ "messagesFromClient": {
103
+ "type": "number"
104
+ },
105
+ "messagesToClient": {
106
+ "type": "number"
107
+ }
108
+ },
109
+ "required": [
110
+ "status"
111
+ ],
112
+ "additionalProperties": false
113
+ }
114
+ ]
115
+ }
@@ -64,6 +64,72 @@
64
64
  },
65
65
  "additionalProperties": false
66
66
  },
67
+ "staticReply": {
68
+ "oneOf": [
69
+ {
70
+ "type": "object",
71
+ "properties": {
72
+ "value": {
73
+ "type": "string"
74
+ },
75
+ "statusCode": {
76
+ "type": "number",
77
+ "min": 100,
78
+ "max": 599,
79
+ "integer": true
80
+ },
81
+ "type": {
82
+ "type": "string",
83
+ "enum": [
84
+ "page",
85
+ "redirect"
86
+ ]
87
+ }
88
+ },
89
+ "required": [
90
+ "value",
91
+ "type"
92
+ ],
93
+ "additionalProperties": false
94
+ },
95
+ {
96
+ "type": "null"
97
+ }
98
+ ]
99
+ },
100
+ "unauthorizedReply": {
101
+ "oneOf": [
102
+ {
103
+ "type": "object",
104
+ "properties": {
105
+ "value": {
106
+ "type": "string"
107
+ },
108
+ "statusCode": {
109
+ "type": "number",
110
+ "min": 100,
111
+ "max": 599,
112
+ "integer": true
113
+ },
114
+ "type": {
115
+ "type": "string",
116
+ "enum": [
117
+ "page",
118
+ "redirect"
119
+ ]
120
+ }
121
+ },
122
+ "required": [
123
+ "value",
124
+ "type"
125
+ ],
126
+ "additionalProperties": false
127
+ },
128
+ {
129
+ "type": "null"
130
+ }
131
+ ]
132
+ },
67
133
  "experienceGroups": {
68
134
  "type": "array",
69
135
  "items": {
@@ -51,6 +51,72 @@
51
51
  "pattern": "^[A-Fa-f\\d]{24}$"
52
52
  },
53
53
  "maxItems": 1000
54
+ },
55
+ "staticReply": {
56
+ "oneOf": [
57
+ {
58
+ "type": "object",
59
+ "properties": {
60
+ "value": {
61
+ "type": "string"
62
+ },
63
+ "statusCode": {
64
+ "type": "number",
65
+ "min": 100,
66
+ "max": 599,
67
+ "integer": true
68
+ },
69
+ "type": {
70
+ "type": "string",
71
+ "enum": [
72
+ "page",
73
+ "redirect"
74
+ ]
75
+ }
76
+ },
77
+ "required": [
78
+ "value",
79
+ "type"
80
+ ],
81
+ "additionalProperties": false
82
+ },
83
+ {
84
+ "type": "null"
85
+ }
86
+ ]
87
+ },
88
+ "unauthorizedReply": {
89
+ "oneOf": [
90
+ {
91
+ "type": "object",
92
+ "properties": {
93
+ "value": {
94
+ "type": "string"
95
+ },
96
+ "statusCode": {
97
+ "type": "number",
98
+ "min": 100,
99
+ "max": 599,
100
+ "integer": true
101
+ },
102
+ "type": {
103
+ "type": "string",
104
+ "enum": [
105
+ "page",
106
+ "redirect"
107
+ ]
108
+ }
109
+ },
110
+ "required": [
111
+ "value",
112
+ "type"
113
+ ],
114
+ "additionalProperties": false
115
+ },
116
+ {
117
+ "type": "null"
118
+ }
119
+ ]
54
120
  }
55
121
  },
56
122
  "additionalProperties": false
@@ -51,6 +51,72 @@
51
51
  "pattern": "^[A-Fa-f\\d]{24}$"
52
52
  },
53
53
  "maxItems": 1000
54
+ },
55
+ "staticReply": {
56
+ "oneOf": [
57
+ {
58
+ "type": "object",
59
+ "properties": {
60
+ "value": {
61
+ "type": "string"
62
+ },
63
+ "statusCode": {
64
+ "type": "number",
65
+ "min": 100,
66
+ "max": 599,
67
+ "integer": true
68
+ },
69
+ "type": {
70
+ "type": "string",
71
+ "enum": [
72
+ "page",
73
+ "redirect"
74
+ ]
75
+ }
76
+ },
77
+ "required": [
78
+ "value",
79
+ "type"
80
+ ],
81
+ "additionalProperties": false
82
+ },
83
+ {
84
+ "type": "null"
85
+ }
86
+ ]
87
+ },
88
+ "unauthorizedReply": {
89
+ "oneOf": [
90
+ {
91
+ "type": "object",
92
+ "properties": {
93
+ "value": {
94
+ "type": "string"
95
+ },
96
+ "statusCode": {
97
+ "type": "number",
98
+ "min": 100,
99
+ "max": 599,
100
+ "integer": true
101
+ },
102
+ "type": {
103
+ "type": "string",
104
+ "enum": [
105
+ "page",
106
+ "redirect"
107
+ ]
108
+ }
109
+ },
110
+ "required": [
111
+ "value",
112
+ "type"
113
+ ],
114
+ "additionalProperties": false
115
+ },
116
+ {
117
+ "type": "null"
118
+ }
119
+ ]
54
120
  }
55
121
  },
56
122
  "additionalProperties": false,
@@ -71,6 +71,72 @@
71
71
  },
72
72
  "additionalProperties": false
73
73
  },
74
+ "staticReply": {
75
+ "oneOf": [
76
+ {
77
+ "type": "object",
78
+ "properties": {
79
+ "value": {
80
+ "type": "string"
81
+ },
82
+ "statusCode": {
83
+ "type": "number",
84
+ "min": 100,
85
+ "max": 599,
86
+ "integer": true
87
+ },
88
+ "type": {
89
+ "type": "string",
90
+ "enum": [
91
+ "page",
92
+ "redirect"
93
+ ]
94
+ }
95
+ },
96
+ "required": [
97
+ "value",
98
+ "type"
99
+ ],
100
+ "additionalProperties": false
101
+ },
102
+ {
103
+ "type": "null"
104
+ }
105
+ ]
106
+ },
107
+ "unauthorizedReply": {
108
+ "oneOf": [
109
+ {
110
+ "type": "object",
111
+ "properties": {
112
+ "value": {
113
+ "type": "string"
114
+ },
115
+ "statusCode": {
116
+ "type": "number",
117
+ "min": 100,
118
+ "max": 599,
119
+ "integer": true
120
+ },
121
+ "type": {
122
+ "type": "string",
123
+ "enum": [
124
+ "page",
125
+ "redirect"
126
+ ]
127
+ }
128
+ },
129
+ "required": [
130
+ "value",
131
+ "type"
132
+ ],
133
+ "additionalProperties": false
134
+ },
135
+ {
136
+ "type": "null"
137
+ }
138
+ ]
139
+ },
74
140
  "experienceGroups": {
75
141
  "type": "array",
76
142
  "items": {
data/schemas/org.json CHANGED
@@ -80,8 +80,6 @@
80
80
  "role": {
81
81
  "type": "string",
82
82
  "enum": [
83
- "admin",
84
- "edit",
85
83
  "collaborate",
86
84
  "view",
87
85
  "none"
@@ -108,8 +106,6 @@
108
106
  "role": {
109
107
  "type": "string",
110
108
  "enum": [
111
- "admin",
112
- "edit",
113
109
  "collaborate",
114
110
  "view",
115
111
  "none"
@@ -29,8 +29,6 @@
29
29
  "role": {
30
30
  "type": "string",
31
31
  "enum": [
32
- "admin",
33
- "edit",
34
32
  "collaborate",
35
33
  "view",
36
34
  "none"
@@ -57,8 +55,6 @@
57
55
  "role": {
58
56
  "type": "string",
59
57
  "enum": [
60
- "admin",
61
- "edit",
62
58
  "collaborate",
63
59
  "view",
64
60
  "none"
@@ -35,8 +35,6 @@
35
35
  "role": {
36
36
  "type": "string",
37
37
  "enum": [
38
- "admin",
39
- "edit",
40
38
  "collaborate",
41
39
  "view",
42
40
  "none"
@@ -63,8 +61,6 @@
63
61
  "role": {
64
62
  "type": "string",
65
63
  "enum": [
66
- "admin",
67
- "edit",
68
64
  "collaborate",
69
65
  "view",
70
66
  "none"
@@ -28,8 +28,6 @@
28
28
  "role": {
29
29
  "type": "string",
30
30
  "enum": [
31
- "admin",
32
- "edit",
33
31
  "collaborate",
34
32
  "view",
35
33
  "none"
@@ -56,8 +54,6 @@
56
54
  "role": {
57
55
  "type": "string",
58
56
  "enum": [
59
- "admin",
60
- "edit",
61
57
  "collaborate",
62
58
  "view",
63
59
  "none"
data/schemas/orgs.json CHANGED
@@ -87,8 +87,6 @@
87
87
  "role": {
88
88
  "type": "string",
89
89
  "enum": [
90
- "admin",
91
- "edit",
92
90
  "collaborate",
93
91
  "view",
94
92
  "none"
@@ -115,8 +113,6 @@
115
113
  "role": {
116
114
  "type": "string",
117
115
  "enum": [
118
- "admin",
119
- "edit",
120
116
  "collaborate",
121
117
  "view",
122
118
  "none"