losant_rest 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/_schemas.md +12 -5
- data/docs/accessTokens.md +1 -1
- data/docs/dashboard.md +1 -1
- data/docs/device.md +74 -0
- data/docs/me.md +3 -3
- data/lib/losant_rest/access_token.rb +6 -0
- data/lib/losant_rest/access_tokens.rb +4 -0
- data/lib/losant_rest/application.rb +6 -0
- data/lib/losant_rest/application_key.rb +6 -0
- data/lib/losant_rest/application_keys.rb +4 -0
- data/lib/losant_rest/applications.rb +4 -0
- data/lib/losant_rest/auth.rb +6 -0
- data/lib/losant_rest/client.rb +2 -2
- data/lib/losant_rest/dashboard.rb +6 -0
- data/lib/losant_rest/dashboards.rb +4 -0
- data/lib/losant_rest/data.rb +4 -0
- data/lib/losant_rest/device.rb +104 -0
- data/lib/losant_rest/device_recipe.rb +8 -0
- data/lib/losant_rest/device_recipes.rb +4 -0
- data/lib/losant_rest/devices.rb +6 -0
- data/lib/losant_rest/event.rb +6 -0
- data/lib/losant_rest/events.rb +8 -0
- data/lib/losant_rest/flow.rb +14 -0
- data/lib/losant_rest/flows.rb +4 -0
- data/lib/losant_rest/me.rb +20 -0
- data/lib/losant_rest/org.rb +16 -0
- data/lib/losant_rest/orgs.rb +4 -0
- data/lib/losant_rest/version.rb +1 -1
- data/lib/losant_rest/webhook.rb +6 -0
- data/lib/losant_rest/webhooks.rb +4 -0
- data/schemas/deviceState.json +1 -0
- data/schemas/deviceStates.json +1 -0
- data/schemas/virtualButtonPress.json +2 -1
- data/schemas/webhook.json +2 -1
- data/schemas/webhookPatch.json +2 -1
- data/schemas/webhookPost.json +2 -1
- data/schemas/webhooks.json +2 -1
- metadata +2 -2
data/lib/losant_rest/auth.rb
CHANGED
@@ -11,6 +11,7 @@ module LosantRest
|
|
11
11
|
#
|
12
12
|
# Parameters:
|
13
13
|
# * {hash} credentials - Device authentication credentials (https://api.losant.com/#/definitions/deviceCredentials)
|
14
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
14
15
|
# * {boolean} _actions - Return resource actions in response
|
15
16
|
# * {boolean} _links - Return resource link in response
|
16
17
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -30,6 +31,7 @@ module LosantRest
|
|
30
31
|
raise ArgumentError.new("credentials is required") unless params.has_key?(:credentials)
|
31
32
|
|
32
33
|
body = params[:credentials] if params.has_key?(:credentials)
|
34
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
33
35
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
34
36
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
35
37
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -48,6 +50,7 @@ module LosantRest
|
|
48
50
|
#
|
49
51
|
# Parameters:
|
50
52
|
# * {hash} credentials - User authentication credentials (https://api.losant.com/#/definitions/userCredentials)
|
53
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
51
54
|
# * {boolean} _actions - Return resource actions in response
|
52
55
|
# * {boolean} _links - Return resource link in response
|
53
56
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -67,6 +70,7 @@ module LosantRest
|
|
67
70
|
raise ArgumentError.new("credentials is required") unless params.has_key?(:credentials)
|
68
71
|
|
69
72
|
body = params[:credentials] if params.has_key?(:credentials)
|
73
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
70
74
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
71
75
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
72
76
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -85,6 +89,7 @@ module LosantRest
|
|
85
89
|
#
|
86
90
|
# Parameters:
|
87
91
|
# * {hash} oauth - User authentication credentials (access token) (https://api.losant.com/#/definitions/githubLogin)
|
92
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
88
93
|
# * {boolean} _actions - Return resource actions in response
|
89
94
|
# * {boolean} _links - Return resource link in response
|
90
95
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -104,6 +109,7 @@ module LosantRest
|
|
104
109
|
raise ArgumentError.new("oauth is required") unless params.has_key?(:oauth)
|
105
110
|
|
106
111
|
body = params[:oauth] if params.has_key?(:oauth)
|
112
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
107
113
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
108
114
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
109
115
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
data/lib/losant_rest/client.rb
CHANGED
@@ -5,7 +5,7 @@ module LosantRest
|
|
5
5
|
#
|
6
6
|
# User API for accessing Losant data
|
7
7
|
#
|
8
|
-
# Built For Version 1.
|
8
|
+
# Built For Version 1.4.0
|
9
9
|
class Client
|
10
10
|
attr_accessor :auth_token, :url
|
11
11
|
|
@@ -112,7 +112,7 @@ module LosantRest
|
|
112
112
|
|
113
113
|
headers["Accept"] = "application/json"
|
114
114
|
headers["Content-Type"] = "application/json"
|
115
|
-
headers["Accept-Version"] = "^1.
|
115
|
+
headers["Accept-Version"] = "^1.4.0"
|
116
116
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
117
117
|
path = self.url + options.fetch(:path, "")
|
118
118
|
|
@@ -11,6 +11,7 @@ module LosantRest
|
|
11
11
|
#
|
12
12
|
# Parameters:
|
13
13
|
# * {string} dashboardId - ID of the associated dashboard
|
14
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
14
15
|
# * {boolean} _actions - Return resource actions in response
|
15
16
|
# * {boolean} _links - Return resource link in response
|
16
17
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -29,6 +30,7 @@ module LosantRest
|
|
29
30
|
|
30
31
|
raise ArgumentError.new("dashboardId is required") unless params.has_key?(:dashboardId)
|
31
32
|
|
33
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
32
34
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
33
35
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
34
36
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -48,6 +50,7 @@ module LosantRest
|
|
48
50
|
# Parameters:
|
49
51
|
# * {string} dashboardId - ID of the associated dashboard
|
50
52
|
# * {string} password - Password for password-protected dashboards
|
53
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
51
54
|
# * {boolean} _actions - Return resource actions in response
|
52
55
|
# * {boolean} _links - Return resource link in response
|
53
56
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -67,6 +70,7 @@ module LosantRest
|
|
67
70
|
raise ArgumentError.new("dashboardId is required") unless params.has_key?(:dashboardId)
|
68
71
|
|
69
72
|
query_params[:password] = params[:password] if params.has_key?(:password)
|
73
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
70
74
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
71
75
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
72
76
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -86,6 +90,7 @@ module LosantRest
|
|
86
90
|
# Parameters:
|
87
91
|
# * {string} dashboardId - ID of the associated dashboard
|
88
92
|
# * {hash} dashboard - Object containing new dashboard properties (https://api.losant.com/#/definitions/dashboardPatch)
|
93
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
89
94
|
# * {boolean} _actions - Return resource actions in response
|
90
95
|
# * {boolean} _links - Return resource link in response
|
91
96
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -106,6 +111,7 @@ module LosantRest
|
|
106
111
|
raise ArgumentError.new("dashboard is required") unless params.has_key?(:dashboard)
|
107
112
|
|
108
113
|
body = params[:dashboard] if params.has_key?(:dashboard)
|
114
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
109
115
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
110
116
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
111
117
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -17,6 +17,7 @@ module LosantRest
|
|
17
17
|
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
18
18
|
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
19
19
|
# * {string} orgId - If not provided, return all dashboards. If provided but blank, only return dashboards belonging to the current user. If provided and an id, only return dashboards belonging to the given organization id.
|
20
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
20
21
|
# * {boolean} _actions - Return resource actions in response
|
21
22
|
# * {boolean} _links - Return resource link in response
|
22
23
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -40,6 +41,7 @@ module LosantRest
|
|
40
41
|
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
41
42
|
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
42
43
|
query_params[:orgId] = params[:orgId] if params.has_key?(:orgId)
|
44
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
43
45
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
44
46
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
45
47
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -58,6 +60,7 @@ module LosantRest
|
|
58
60
|
#
|
59
61
|
# Parameters:
|
60
62
|
# * {hash} dashboard - New dashboard information (https://api.losant.com/#/definitions/dashboardPost)
|
63
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
61
64
|
# * {boolean} _actions - Return resource actions in response
|
62
65
|
# * {boolean} _links - Return resource link in response
|
63
66
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -76,6 +79,7 @@ module LosantRest
|
|
76
79
|
raise ArgumentError.new("dashboard is required") unless params.has_key?(:dashboard)
|
77
80
|
|
78
81
|
body = params[:dashboard] if params.has_key?(:dashboard)
|
82
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
79
83
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
80
84
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
81
85
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
data/lib/losant_rest/data.rb
CHANGED
@@ -12,6 +12,7 @@ module LosantRest
|
|
12
12
|
# Parameters:
|
13
13
|
# * {string} applicationId - ID associated with the application
|
14
14
|
# * {hash} query - The query parameters (https://api.losant.com/#/definitions/lastValueQuery)
|
15
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
15
16
|
# * {boolean} _actions - Return resource actions in response
|
16
17
|
# * {boolean} _links - Return resource link in response
|
17
18
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -32,6 +33,7 @@ module LosantRest
|
|
32
33
|
raise ArgumentError.new("query is required") unless params.has_key?(:query)
|
33
34
|
|
34
35
|
body = params[:query] if params.has_key?(:query)
|
36
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
35
37
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
36
38
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
37
39
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -51,6 +53,7 @@ module LosantRest
|
|
51
53
|
# Parameters:
|
52
54
|
# * {string} applicationId - ID associated with the application
|
53
55
|
# * {hash} query - The query parameters (https://api.losant.com/#/definitions/timeSeriesQuery)
|
56
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
54
57
|
# * {boolean} _actions - Return resource actions in response
|
55
58
|
# * {boolean} _links - Return resource link in response
|
56
59
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -71,6 +74,7 @@ module LosantRest
|
|
71
74
|
raise ArgumentError.new("query is required") unless params.has_key?(:query)
|
72
75
|
|
73
76
|
body = params[:query] if params.has_key?(:query)
|
77
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
74
78
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
75
79
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
76
80
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
data/lib/losant_rest/device.rb
CHANGED
@@ -12,6 +12,7 @@ module LosantRest
|
|
12
12
|
# Parameters:
|
13
13
|
# * {string} applicationId - ID associated with the application
|
14
14
|
# * {string} deviceId - ID associated with the device
|
15
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
15
16
|
# * {boolean} _actions - Return resource actions in response
|
16
17
|
# * {boolean} _links - Return resource link in response
|
17
18
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -31,6 +32,7 @@ module LosantRest
|
|
31
32
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
32
33
|
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
33
34
|
|
35
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
34
36
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
35
37
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
36
38
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -45,11 +47,56 @@ module LosantRest
|
|
45
47
|
body: body)
|
46
48
|
end
|
47
49
|
|
50
|
+
# Creates a device data export (to be emailed to the requestor). Defaults to all data.
|
51
|
+
#
|
52
|
+
# Parameters:
|
53
|
+
# * {string} applicationId - ID associated with the application
|
54
|
+
# * {string} deviceId - ID associated with the device
|
55
|
+
# * {string} start - Start time of export (ms since epoch - 0 means now, negative is relative to now)
|
56
|
+
# * {string} end - End time of export (ms since epoch - 0 means now, negative is relative to now)
|
57
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
58
|
+
# * {boolean} _actions - Return resource actions in response
|
59
|
+
# * {boolean} _links - Return resource link in response
|
60
|
+
# * {boolean} _embedded - Return embedded resources in response
|
61
|
+
#
|
62
|
+
# Responses:
|
63
|
+
# * 200 - If generation of export was successfully started (https://api.losant.com/#/definitions/success)
|
64
|
+
#
|
65
|
+
# Errors:
|
66
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
67
|
+
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
68
|
+
def export(params = {})
|
69
|
+
params = Utils.symbolize_hash_keys(params)
|
70
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
71
|
+
headers = {}
|
72
|
+
body = nil
|
73
|
+
|
74
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
75
|
+
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
76
|
+
|
77
|
+
query_params[:start] = params[:start] if params.has_key?(:start)
|
78
|
+
query_params[:end] = params[:end] if params.has_key?(:end)
|
79
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
80
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
81
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
82
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
83
|
+
|
84
|
+
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/export"
|
85
|
+
|
86
|
+
@client.request(
|
87
|
+
method: :post,
|
88
|
+
path: path,
|
89
|
+
query: query_params,
|
90
|
+
headers: headers,
|
91
|
+
body: body)
|
92
|
+
end
|
93
|
+
|
48
94
|
# Retrieves information on a device
|
49
95
|
#
|
50
96
|
# Parameters:
|
51
97
|
# * {string} applicationId - ID associated with the application
|
52
98
|
# * {string} deviceId - ID associated with the device
|
99
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
53
100
|
# * {boolean} _actions - Return resource actions in response
|
54
101
|
# * {boolean} _links - Return resource link in response
|
55
102
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -69,6 +116,7 @@ module LosantRest
|
|
69
116
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
70
117
|
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
71
118
|
|
119
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
72
120
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
73
121
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
74
122
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -90,6 +138,7 @@ module LosantRest
|
|
90
138
|
# * {string} deviceId - ID associated with the device
|
91
139
|
# * {string} limit - Max command entries to return (ordered by time descending)
|
92
140
|
# * {string} since - Look for command entries since this time (ms since epoch)
|
141
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
93
142
|
# * {boolean} _actions - Return resource actions in response
|
94
143
|
# * {boolean} _links - Return resource link in response
|
95
144
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -111,6 +160,7 @@ module LosantRest
|
|
111
160
|
|
112
161
|
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
113
162
|
query_params[:since] = params[:since] if params.has_key?(:since)
|
163
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
114
164
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
115
165
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
116
166
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -132,6 +182,7 @@ module LosantRest
|
|
132
182
|
# * {string} deviceId - ID associated with the device
|
133
183
|
# * {string} limit - Max log entries to return (ordered by time descending)
|
134
184
|
# * {string} since - Look for log entries since this time (ms since epoch)
|
185
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
135
186
|
# * {boolean} _actions - Return resource actions in response
|
136
187
|
# * {boolean} _links - Return resource link in response
|
137
188
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -153,6 +204,7 @@ module LosantRest
|
|
153
204
|
|
154
205
|
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
155
206
|
query_params[:since] = params[:since] if params.has_key?(:since)
|
207
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
156
208
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
157
209
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
158
210
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -174,6 +226,7 @@ module LosantRest
|
|
174
226
|
# * {string} deviceId - ID associated with the device
|
175
227
|
# * {string} limit - Max state entries to return (ordered by time descending)
|
176
228
|
# * {string} since - Look for state entries since this time (ms since epoch)
|
229
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
177
230
|
# * {boolean} _actions - Return resource actions in response
|
178
231
|
# * {boolean} _links - Return resource link in response
|
179
232
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -195,6 +248,7 @@ module LosantRest
|
|
195
248
|
|
196
249
|
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
197
250
|
query_params[:since] = params[:since] if params.has_key?(:since)
|
251
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
198
252
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
199
253
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
200
254
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -215,6 +269,7 @@ module LosantRest
|
|
215
269
|
# * {string} applicationId - ID associated with the application
|
216
270
|
# * {string} deviceId - ID associated with the device
|
217
271
|
# * {hash} device - Object containing new properties of the device (https://api.losant.com/#/definitions/devicePatch)
|
272
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
218
273
|
# * {boolean} _actions - Return resource actions in response
|
219
274
|
# * {boolean} _links - Return resource link in response
|
220
275
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -236,6 +291,7 @@ module LosantRest
|
|
236
291
|
raise ArgumentError.new("device is required") unless params.has_key?(:device)
|
237
292
|
|
238
293
|
body = params[:device] if params.has_key?(:device)
|
294
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
239
295
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
240
296
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
241
297
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -250,12 +306,57 @@ module LosantRest
|
|
250
306
|
body: body)
|
251
307
|
end
|
252
308
|
|
309
|
+
# Removes all device data for the specified time range. Defaults to all data.
|
310
|
+
#
|
311
|
+
# Parameters:
|
312
|
+
# * {string} applicationId - ID associated with the application
|
313
|
+
# * {string} deviceId - ID associated with the device
|
314
|
+
# * {string} start - Start time of export (ms since epoch - 0 means now, negative is relative to now)
|
315
|
+
# * {string} end - End time of export (ms since epoch - 0 means now, negative is relative to now)
|
316
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
317
|
+
# * {boolean} _actions - Return resource actions in response
|
318
|
+
# * {boolean} _links - Return resource link in response
|
319
|
+
# * {boolean} _embedded - Return embedded resources in response
|
320
|
+
#
|
321
|
+
# Responses:
|
322
|
+
# * 200 - If data removal was successfully started (https://api.losant.com/#/definitions/success)
|
323
|
+
#
|
324
|
+
# Errors:
|
325
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
326
|
+
# * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
|
327
|
+
def remove_data(params = {})
|
328
|
+
params = Utils.symbolize_hash_keys(params)
|
329
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
330
|
+
headers = {}
|
331
|
+
body = nil
|
332
|
+
|
333
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
334
|
+
raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
|
335
|
+
|
336
|
+
query_params[:start] = params[:start] if params.has_key?(:start)
|
337
|
+
query_params[:end] = params[:end] if params.has_key?(:end)
|
338
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
339
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
340
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
341
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
342
|
+
|
343
|
+
path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/data"
|
344
|
+
|
345
|
+
@client.request(
|
346
|
+
method: :delete,
|
347
|
+
path: path,
|
348
|
+
query: query_params,
|
349
|
+
headers: headers,
|
350
|
+
body: body)
|
351
|
+
end
|
352
|
+
|
253
353
|
# Send a command to a device
|
254
354
|
#
|
255
355
|
# Parameters:
|
256
356
|
# * {string} applicationId - ID associated with the application
|
257
357
|
# * {string} deviceId - ID associated with the device
|
258
358
|
# * {hash} deviceCommand - Command to send to the device (https://api.losant.com/#/definitions/deviceCommand)
|
359
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
259
360
|
# * {boolean} _actions - Return resource actions in response
|
260
361
|
# * {boolean} _links - Return resource link in response
|
261
362
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -277,6 +378,7 @@ module LosantRest
|
|
277
378
|
raise ArgumentError.new("deviceCommand is required") unless params.has_key?(:deviceCommand)
|
278
379
|
|
279
380
|
body = params[:deviceCommand] if params.has_key?(:deviceCommand)
|
381
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
280
382
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
281
383
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
282
384
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -297,6 +399,7 @@ module LosantRest
|
|
297
399
|
# * {string} applicationId - ID associated with the application
|
298
400
|
# * {string} deviceId - ID associated with the device
|
299
401
|
# * {hash} deviceState - Object containing the current state of the device (https://api.losant.com/#/definitions/deviceState)
|
402
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
300
403
|
# * {boolean} _actions - Return resource actions in response
|
301
404
|
# * {boolean} _links - Return resource link in response
|
302
405
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -318,6 +421,7 @@ module LosantRest
|
|
318
421
|
raise ArgumentError.new("deviceState is required") unless params.has_key?(:deviceState)
|
319
422
|
|
320
423
|
body = params[:deviceState] if params.has_key?(:deviceState)
|
424
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
321
425
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
322
426
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
323
427
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -13,6 +13,7 @@ module LosantRest
|
|
13
13
|
# * {string} applicationId - ID associated with the application
|
14
14
|
# * {string} deviceRecipeId - ID associated with the device recipe
|
15
15
|
# * {hash} bulkInfo - Object containing bulk creation info (https://api.losant.com/#/definitions/deviceRecipeBulkCreatePost)
|
16
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
16
17
|
# * {boolean} _actions - Return resource actions in response
|
17
18
|
# * {boolean} _links - Return resource link in response
|
18
19
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -34,6 +35,7 @@ module LosantRest
|
|
34
35
|
raise ArgumentError.new("bulkInfo is required") unless params.has_key?(:bulkInfo)
|
35
36
|
|
36
37
|
body = params[:bulkInfo] if params.has_key?(:bulkInfo)
|
38
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
37
39
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
38
40
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
39
41
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -53,6 +55,7 @@ module LosantRest
|
|
53
55
|
# Parameters:
|
54
56
|
# * {string} applicationId - ID associated with the application
|
55
57
|
# * {string} deviceRecipeId - ID associated with the device recipe
|
58
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
56
59
|
# * {boolean} _actions - Return resource actions in response
|
57
60
|
# * {boolean} _links - Return resource link in response
|
58
61
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -72,6 +75,7 @@ module LosantRest
|
|
72
75
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
73
76
|
raise ArgumentError.new("deviceRecipeId is required") unless params.has_key?(:deviceRecipeId)
|
74
77
|
|
78
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
75
79
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
76
80
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
77
81
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -91,6 +95,7 @@ module LosantRest
|
|
91
95
|
# Parameters:
|
92
96
|
# * {string} applicationId - ID associated with the application
|
93
97
|
# * {string} deviceRecipeId - ID associated with the device recipe
|
98
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
94
99
|
# * {boolean} _actions - Return resource actions in response
|
95
100
|
# * {boolean} _links - Return resource link in response
|
96
101
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -110,6 +115,7 @@ module LosantRest
|
|
110
115
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
111
116
|
raise ArgumentError.new("deviceRecipeId is required") unless params.has_key?(:deviceRecipeId)
|
112
117
|
|
118
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
113
119
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
114
120
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
115
121
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
@@ -130,6 +136,7 @@ module LosantRest
|
|
130
136
|
# * {string} applicationId - ID associated with the application
|
131
137
|
# * {string} deviceRecipeId - ID associated with the device recipe
|
132
138
|
# * {hash} deviceRecipe - Object containing new properties of the device recipe (https://api.losant.com/#/definitions/deviceRecipePatch)
|
139
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
133
140
|
# * {boolean} _actions - Return resource actions in response
|
134
141
|
# * {boolean} _links - Return resource link in response
|
135
142
|
# * {boolean} _embedded - Return embedded resources in response
|
@@ -151,6 +158,7 @@ module LosantRest
|
|
151
158
|
raise ArgumentError.new("deviceRecipe is required") unless params.has_key?(:deviceRecipe)
|
152
159
|
|
153
160
|
body = params[:deviceRecipe] if params.has_key?(:deviceRecipe)
|
161
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
154
162
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
155
163
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
156
164
|
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|