losant_rest 1.21.2 → 1.22.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.
@@ -0,0 +1,139 @@
1
+ # Device Attribute Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Device Attribute resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Delete](#delete)
10
+ * [Get](#get)
11
+ * [Patch](#patch)
12
+
13
+ <br/>
14
+
15
+ ## Delete
16
+
17
+ Removes an attribute from a device
18
+
19
+ ```ruby
20
+ result = client.device_attribute.delete(
21
+ applicationId: my_application_id,
22
+ deviceId: my_device_id,
23
+ name: my_name)
24
+
25
+ puts result
26
+ ```
27
+
28
+ #### Authentication
29
+ The client must be configured with a valid api access token to call this
30
+ action. The token must include at least one of the following scopes:
31
+ all.Application, all.Organization, all.User, deviceAttribute.*, or deviceAttribute.delete.
32
+
33
+ #### Available Parameters
34
+
35
+ | Name | Type | Required | Description | Default | Example |
36
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
37
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
38
+ | deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
39
+ | name | string | Y | Name of the attribute | | voltage |
40
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
41
+
42
+ #### Successful Responses
43
+
44
+ | Code | Type | Description |
45
+ | ---- | ---- | ----------- |
46
+ | 200 | [Success](_schemas.md#success) | If device attribute was successfully deleted |
47
+
48
+ #### Error Responses
49
+
50
+ | Code | Type | Description |
51
+ | ---- | ---- | ----------- |
52
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
53
+ | 404 | [Error](_schemas.md#error) | Error if device attribute was not found |
54
+
55
+ <br/>
56
+
57
+ ## Get
58
+
59
+ Retrieves information on a device attribute
60
+
61
+ ```ruby
62
+ result = client.device_attribute.get(
63
+ applicationId: my_application_id,
64
+ deviceId: my_device_id,
65
+ name: my_name)
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.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, deviceAttribute.*, or deviceAttribute.get.
74
+
75
+ #### Available Parameters
76
+
77
+ | Name | Type | Required | Description | Default | Example |
78
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
79
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
80
+ | deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
81
+ | name | string | Y | Name of the attribute | | voltage |
82
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
83
+
84
+ #### Successful Responses
85
+
86
+ | Code | Type | Description |
87
+ | ---- | ---- | ----------- |
88
+ | 200 | [Device Attribute](_schemas.md#device-attribute) | Device attribute information |
89
+
90
+ #### Error Responses
91
+
92
+ | Code | Type | Description |
93
+ | ---- | ---- | ----------- |
94
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
95
+ | 404 | [Error](_schemas.md#error) | Error if device attribute was not found |
96
+
97
+ <br/>
98
+
99
+ ## Patch
100
+
101
+ Updates an attribute on a device
102
+
103
+ ```ruby
104
+ result = client.device_attribute.patch(
105
+ applicationId: my_application_id,
106
+ deviceId: my_device_id,
107
+ name: my_name,
108
+ deviceAttribute: my_device_attribute)
109
+
110
+ puts result
111
+ ```
112
+
113
+ #### Authentication
114
+ The client must be configured with a valid api access token to call this
115
+ action. The token must include at least one of the following scopes:
116
+ all.Application, all.Organization, all.User, deviceAttribute.*, or deviceAttribute.patch.
117
+
118
+ #### Available Parameters
119
+
120
+ | Name | Type | Required | Description | Default | Example |
121
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
122
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
123
+ | deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
124
+ | name | string | Y | Name of the attribute | | voltage |
125
+ | deviceAttribute | [Device Attribute Patch](_schemas.md#device-attribute-patch) | Y | Object containing new properties of the device attribute | | [Device Attribute Patch Example](_schemas.md#device-attribute-patch-example) |
126
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
127
+
128
+ #### Successful Responses
129
+
130
+ | Code | Type | Description |
131
+ | ---- | ---- | ----------- |
132
+ | 200 | [Device Attribute](_schemas.md#device-attribute) | Updated device attribute information |
133
+
134
+ #### Error Responses
135
+
136
+ | Code | Type | Description |
137
+ | ---- | ---- | ----------- |
138
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
139
+ | 404 | [Error](_schemas.md#error) | Error if device attribute was not found |
@@ -0,0 +1,96 @@
1
+ # Device Attributes Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Device Attributes resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Get](#get)
10
+ * [Post](#post)
11
+
12
+ <br/>
13
+
14
+ ## Get
15
+
16
+ Returns the attributes for a device
17
+
18
+ ```ruby
19
+ result = client.device_attributes.get(
20
+ applicationId: my_application_id,
21
+ deviceId: my_device_id)
22
+
23
+ puts result
24
+ ```
25
+
26
+ #### Authentication
27
+ The client must be configured with a valid api access token to call this
28
+ action. The token must include at least one of the following scopes:
29
+ all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, deviceAttributes.*, or deviceAttributes.get.
30
+
31
+ #### Available Parameters
32
+
33
+ | Name | Type | Required | Description | Default | Example |
34
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
35
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
36
+ | deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
37
+ | sortField | string | N | Field to sort the results by. Accepted values are: name, dataType | name | status |
38
+ | sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
39
+ | filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, dataType | | status |
40
+ | filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | number |
41
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
42
+
43
+ #### Successful Responses
44
+
45
+ | Code | Type | Description |
46
+ | ---- | ---- | ----------- |
47
+ | 200 | [Device Attributes](_schemas.md#device-attributes) | Collection of device attributes |
48
+
49
+ #### Error Responses
50
+
51
+ | Code | Type | Description |
52
+ | ---- | ---- | ----------- |
53
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
54
+ | 404 | [Error](_schemas.md#error) | Error if device was not found |
55
+
56
+ <br/>
57
+
58
+ ## Post
59
+
60
+ Adds a new attribute to a device
61
+
62
+ ```ruby
63
+ result = client.device_attributes.post(
64
+ applicationId: my_application_id,
65
+ deviceId: my_device_id,
66
+ deviceAttribute: my_device_attribute)
67
+
68
+ puts result
69
+ ```
70
+
71
+ #### Authentication
72
+ The client must be configured with a valid api access token to call this
73
+ action. The token must include at least one of the following scopes:
74
+ all.Application, all.Organization, all.User, deviceAttributes.*, or deviceAttributes.post.
75
+
76
+ #### Available Parameters
77
+
78
+ | Name | Type | Required | Description | Default | Example |
79
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
80
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
81
+ | deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
82
+ | deviceAttribute | [Device Attribute Post](_schemas.md#device-attribute-post) | Y | Device attribute information | | [Device Attribute Post Example](_schemas.md#device-attribute-post-example) |
83
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
84
+
85
+ #### Successful Responses
86
+
87
+ | Code | Type | Description |
88
+ | ---- | ---- | ----------- |
89
+ | 201 | [Device Attribute](_schemas.md#device-attribute) | Successfully created device attribute |
90
+
91
+ #### Error Responses
92
+
93
+ | Code | Type | Description |
94
+ | ---- | ---- | ----------- |
95
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
96
+ | 404 | [Error](_schemas.md#error) | Error if device was not found |
@@ -76,7 +76,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
76
76
  | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
77
77
  | experienceGroupId | string | Y | ID associated with the experience group | | 575ed78e7ae143cd83dc4aab |
78
78
  | includeDirectDeviceCount | string | N | Whether or not to return count of devices associated directly with this group | false | true |
79
- | includeTotalDeviceCount | string | N | Whether or not to return count of devices associated with this group or any of its descendents | false | true |
79
+ | includeTotalDeviceCount | string | N | Whether or not to return count of devices associated with this group or any of its descendants | false | true |
80
80
  | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
81
81
 
82
82
  #### Successful Responses
@@ -27,7 +27,7 @@ module PlatformRest
27
27
  #
28
28
  # User API for accessing platform data
29
29
  #
30
- # Built For Version 1.27.2
30
+ # Built For Version 1.28.0
31
31
  class Client
32
32
  attr_accessor :auth_token, :url
33
33
 
@@ -144,6 +144,14 @@ module PlatformRest
144
144
  @device ||= Device.new(self)
145
145
  end
146
146
 
147
+ def device_attribute
148
+ @device_attribute ||= DeviceAttribute.new(self)
149
+ end
150
+
151
+ def device_attributes
152
+ @device_attributes ||= DeviceAttributes.new(self)
153
+ end
154
+
147
155
  def device_recipe
148
156
  @device_recipe ||= DeviceRecipe.new(self)
149
157
  end
@@ -406,7 +414,7 @@ module PlatformRest
406
414
 
407
415
  headers["Accept"] = "application/json"
408
416
  headers["Content-Type"] = "application/json"
409
- headers["Accept-Version"] = "^1.27.2"
417
+ headers["Accept-Version"] = "^1.28.0"
410
418
  headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
411
419
  path = self.url + options.fetch(:path, "")
412
420
 
@@ -0,0 +1,182 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2024 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
+ require "json"
24
+
25
+ module PlatformRest
26
+
27
+ # Class containing all the actions for the Device Attribute Resource
28
+ class DeviceAttribute
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Removes an attribute from a device
35
+ #
36
+ # Authentication:
37
+ # The client must be configured with a valid api
38
+ # access token to call this action. The token
39
+ # must include at least one of the following scopes:
40
+ # all.Application, all.Organization, all.User, deviceAttribute.*, or deviceAttribute.delete.
41
+ #
42
+ # Parameters:
43
+ # * {string} applicationId - ID associated with the application
44
+ # * {string} deviceId - ID associated with the device
45
+ # * {string} name - Name of the attribute
46
+ # * {string} losantdomain - Domain scope of request (rarely needed)
47
+ # * {boolean} _actions - Return resource actions in response
48
+ # * {boolean} _links - Return resource link in response
49
+ # * {boolean} _embedded - Return embedded resources in response
50
+ #
51
+ # Responses:
52
+ # * 200 - If device attribute was successfully deleted (https://api.losant.com/#/definitions/success)
53
+ #
54
+ # Errors:
55
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
56
+ # * 404 - Error if device attribute was not found (https://api.losant.com/#/definitions/error)
57
+ def delete(params = {})
58
+ params = Utils.symbolize_hash_keys(params)
59
+ query_params = { _actions: false, _links: true, _embedded: true }
60
+ headers = {}
61
+ body = nil
62
+
63
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
64
+ raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
65
+ raise ArgumentError.new("name is required") unless params.has_key?(:name)
66
+
67
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
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 = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/attributes/#{params[:name]}"
73
+
74
+ @client.request(
75
+ method: :delete,
76
+ path: path,
77
+ query: query_params,
78
+ headers: headers,
79
+ body: body)
80
+ end
81
+
82
+ # Retrieves information on a device attribute
83
+ #
84
+ # Authentication:
85
+ # The client must be configured with a valid api
86
+ # access token to call this action. The token
87
+ # must include at least one of the following scopes:
88
+ # all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, deviceAttribute.*, or deviceAttribute.get.
89
+ #
90
+ # Parameters:
91
+ # * {string} applicationId - ID associated with the application
92
+ # * {string} deviceId - ID associated with the device
93
+ # * {string} name - Name of the attribute
94
+ # * {string} losantdomain - Domain scope of request (rarely needed)
95
+ # * {boolean} _actions - Return resource actions in response
96
+ # * {boolean} _links - Return resource link in response
97
+ # * {boolean} _embedded - Return embedded resources in response
98
+ #
99
+ # Responses:
100
+ # * 200 - Device attribute information (https://api.losant.com/#/definitions/deviceAttribute)
101
+ #
102
+ # Errors:
103
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
104
+ # * 404 - Error if device attribute was not found (https://api.losant.com/#/definitions/error)
105
+ def get(params = {})
106
+ params = Utils.symbolize_hash_keys(params)
107
+ query_params = { _actions: false, _links: true, _embedded: true }
108
+ headers = {}
109
+ body = nil
110
+
111
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
112
+ raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
113
+ raise ArgumentError.new("name is required") unless params.has_key?(:name)
114
+
115
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
116
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
117
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
118
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
119
+
120
+ path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/attributes/#{params[:name]}"
121
+
122
+ @client.request(
123
+ method: :get,
124
+ path: path,
125
+ query: query_params,
126
+ headers: headers,
127
+ body: body)
128
+ end
129
+
130
+ # Updates an attribute on a device
131
+ #
132
+ # Authentication:
133
+ # The client must be configured with a valid api
134
+ # access token to call this action. The token
135
+ # must include at least one of the following scopes:
136
+ # all.Application, all.Organization, all.User, deviceAttribute.*, or deviceAttribute.patch.
137
+ #
138
+ # Parameters:
139
+ # * {string} applicationId - ID associated with the application
140
+ # * {string} deviceId - ID associated with the device
141
+ # * {string} name - Name of the attribute
142
+ # * {hash} deviceAttribute - Object containing new properties of the device attribute (https://api.losant.com/#/definitions/deviceAttributePatch)
143
+ # * {string} losantdomain - Domain scope of request (rarely needed)
144
+ # * {boolean} _actions - Return resource actions in response
145
+ # * {boolean} _links - Return resource link in response
146
+ # * {boolean} _embedded - Return embedded resources in response
147
+ #
148
+ # Responses:
149
+ # * 200 - Updated device attribute information (https://api.losant.com/#/definitions/deviceAttribute)
150
+ #
151
+ # Errors:
152
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
153
+ # * 404 - Error if device attribute was not found (https://api.losant.com/#/definitions/error)
154
+ def patch(params = {})
155
+ params = Utils.symbolize_hash_keys(params)
156
+ query_params = { _actions: false, _links: true, _embedded: true }
157
+ headers = {}
158
+ body = nil
159
+
160
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
161
+ raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
162
+ raise ArgumentError.new("name is required") unless params.has_key?(:name)
163
+ raise ArgumentError.new("deviceAttribute is required") unless params.has_key?(:deviceAttribute)
164
+
165
+ body = params[:deviceAttribute] if params.has_key?(:deviceAttribute)
166
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
167
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
168
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
169
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
170
+
171
+ path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/attributes/#{params[:name]}"
172
+
173
+ @client.request(
174
+ method: :patch,
175
+ path: path,
176
+ query: query_params,
177
+ headers: headers,
178
+ body: body)
179
+ end
180
+
181
+ end
182
+ end
@@ -0,0 +1,138 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2024 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
+ require "json"
24
+
25
+ module PlatformRest
26
+
27
+ # Class containing all the actions for the Device Attributes Resource
28
+ class DeviceAttributes
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Returns the attributes for a device
35
+ #
36
+ # Authentication:
37
+ # The client must be configured with a valid api
38
+ # access token to call this action. The token
39
+ # must include at least one of the following scopes:
40
+ # all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, deviceAttributes.*, or deviceAttributes.get.
41
+ #
42
+ # Parameters:
43
+ # * {string} applicationId - ID associated with the application
44
+ # * {string} deviceId - ID associated with the device
45
+ # * {string} sortField - Field to sort the results by. Accepted values are: name, dataType
46
+ # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
47
+ # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, dataType
48
+ # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
49
+ # * {string} losantdomain - Domain scope of request (rarely needed)
50
+ # * {boolean} _actions - Return resource actions in response
51
+ # * {boolean} _links - Return resource link in response
52
+ # * {boolean} _embedded - Return embedded resources in response
53
+ #
54
+ # Responses:
55
+ # * 200 - Collection of device attributes (https://api.losant.com/#/definitions/deviceAttributes)
56
+ #
57
+ # Errors:
58
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
59
+ # * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
60
+ def get(params = {})
61
+ params = Utils.symbolize_hash_keys(params)
62
+ query_params = { _actions: false, _links: true, _embedded: true }
63
+ headers = {}
64
+ body = nil
65
+
66
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
67
+ raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
68
+
69
+ query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
70
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
71
+ query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
72
+ query_params[:filter] = params[:filter] if params.has_key?(:filter)
73
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
74
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
75
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
76
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
77
+
78
+ path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/attributes"
79
+
80
+ @client.request(
81
+ method: :get,
82
+ path: path,
83
+ query: query_params,
84
+ headers: headers,
85
+ body: body)
86
+ end
87
+
88
+ # Adds a new attribute to a device
89
+ #
90
+ # Authentication:
91
+ # The client must be configured with a valid api
92
+ # access token to call this action. The token
93
+ # must include at least one of the following scopes:
94
+ # all.Application, all.Organization, all.User, deviceAttributes.*, or deviceAttributes.post.
95
+ #
96
+ # Parameters:
97
+ # * {string} applicationId - ID associated with the application
98
+ # * {string} deviceId - ID associated with the device
99
+ # * {hash} deviceAttribute - Device attribute information (https://api.losant.com/#/definitions/deviceAttributePost)
100
+ # * {string} losantdomain - Domain scope of request (rarely needed)
101
+ # * {boolean} _actions - Return resource actions in response
102
+ # * {boolean} _links - Return resource link in response
103
+ # * {boolean} _embedded - Return embedded resources in response
104
+ #
105
+ # Responses:
106
+ # * 201 - Successfully created device attribute (https://api.losant.com/#/definitions/deviceAttribute)
107
+ #
108
+ # Errors:
109
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
110
+ # * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
111
+ def post(params = {})
112
+ params = Utils.symbolize_hash_keys(params)
113
+ query_params = { _actions: false, _links: true, _embedded: true }
114
+ headers = {}
115
+ body = nil
116
+
117
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
118
+ raise ArgumentError.new("deviceId is required") unless params.has_key?(:deviceId)
119
+ raise ArgumentError.new("deviceAttribute is required") unless params.has_key?(:deviceAttribute)
120
+
121
+ body = params[:deviceAttribute] if params.has_key?(:deviceAttribute)
122
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
123
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
124
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
125
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
126
+
127
+ path = "/applications/#{params[:applicationId]}/devices/#{params[:deviceId]}/attributes"
128
+
129
+ @client.request(
130
+ method: :post,
131
+ path: path,
132
+ query: query_params,
133
+ headers: headers,
134
+ body: body)
135
+ end
136
+
137
+ end
138
+ end
@@ -89,7 +89,7 @@ module PlatformRest
89
89
  # * {string} applicationId - ID associated with the application
90
90
  # * {string} experienceGroupId - ID associated with the experience group
91
91
  # * {string} includeDirectDeviceCount - Whether or not to return count of devices associated directly with this group
92
- # * {string} includeTotalDeviceCount - Whether or not to return count of devices associated with this group or any of its descendents
92
+ # * {string} includeTotalDeviceCount - Whether or not to return count of devices associated with this group or any of its descendants
93
93
  # * {string} losantdomain - Domain scope of request (rarely needed)
94
94
  # * {boolean} _actions - Return resource actions in response
95
95
  # * {boolean} _links - Return resource link in response
@@ -21,5 +21,5 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  module PlatformRest
24
- VERSION = "1.21.2"
24
+ VERSION = "1.22.0"
25
25
  end
data/lib/platform_rest.rb CHANGED
@@ -50,6 +50,8 @@ require_relative "platform_rest/data_table_row"
50
50
  require_relative "platform_rest/data_table_rows"
51
51
  require_relative "platform_rest/data_tables"
52
52
  require_relative "platform_rest/device"
53
+ require_relative "platform_rest/device_attribute"
54
+ require_relative "platform_rest/device_attributes"
53
55
  require_relative "platform_rest/device_recipe"
54
56
  require_relative "platform_rest/device_recipes"
55
57
  require_relative "platform_rest/devices"
@@ -52,6 +52,8 @@
52
52
  "deviceRecipe.*",
53
53
  "deviceRecipes.*",
54
54
  "devices.*",
55
+ "deviceAttribute.*",
56
+ "deviceAttributes.*",
55
57
  "edgeDeployment.*",
56
58
  "edgeDeployments.*",
57
59
  "embeddedDeployment.*",
@@ -198,6 +200,11 @@
198
200
  "devices.sendCommand",
199
201
  "devices.tagKeys",
200
202
  "devices.tagValues",
203
+ "deviceAttribute.get",
204
+ "deviceAttribute.patch",
205
+ "deviceAttribute.delete",
206
+ "deviceAttributes.get",
207
+ "deviceAttributes.post",
201
208
  "edgeDeployment.get",
202
209
  "edgeDeployments.get",
203
210
  "edgeDeployments.release",
@@ -27,6 +27,35 @@
27
27
  "forceJob": {
28
28
  "type": "boolean",
29
29
  "default": false
30
+ },
31
+ "exportType": {
32
+ "type": "string",
33
+ "enum": [
34
+ "zip",
35
+ "repo"
36
+ ],
37
+ "default": "zip"
38
+ },
39
+ "credentialName": {
40
+ "type": "string",
41
+ "maxLength": 255
42
+ },
43
+ "repo": {
44
+ "type": "object",
45
+ "properties": {
46
+ "branch": {
47
+ "type": "string",
48
+ "maxLength": 255
49
+ },
50
+ "directory": {
51
+ "type": "string",
52
+ "maxLength": 1024
53
+ },
54
+ "commitMessage": {
55
+ "type": "string",
56
+ "maxLength": 1024
57
+ }
58
+ }
30
59
  }
31
60
  },
32
61
  "additionalProperties": false