losant_rest 1.0.6 → 1.0.7
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 +3 -3
- data/docs/dashboards.md +1 -1
- data/docs/deviceRecipe.md +1 -1
- data/docs/devices.md +34 -0
- data/lib/losant_rest/client.rb +2 -2
- data/lib/losant_rest/dashboards.rb +1 -1
- data/lib/losant_rest/device_recipe.rb +1 -1
- data/lib/losant_rest/devices.rb +42 -0
- data/lib/losant_rest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bfc15783106347d0e9336d77f09fbe18c3f7296
|
4
|
+
data.tar.gz: 303070ad864a6e82c37df14a54536327c008ec39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6bfed1c415e2bdc7b7d3142360dce177635213bd3bf682c0df3cf16d55085252cae0b3a5bfe20c815a842aa70ee71442b8ca91d4a8a4e01c64480485338e622
|
7
|
+
data.tar.gz: edd540c833947b9db7fc9a7979340d0cb2ec961316ecb3a5f2fffe6a7da405e4b4c48bc6391614719757c0965bcfc7a08f44084a213216a8033758f81b02ef0a
|
data/docs/_schemas.md
CHANGED
@@ -1016,7 +1016,7 @@ Schema for a collection of Applications
|
|
1016
1016
|
|
1017
1017
|
## Authenticated Device
|
1018
1018
|
|
1019
|
-
Schema for the
|
1019
|
+
Schema for the successful response when authenticating a Device
|
1020
1020
|
|
1021
1021
|
### <a name="authenticated-device-schema"></a> Schema
|
1022
1022
|
|
@@ -1071,7 +1071,7 @@ Schema for the sucessful response when authenticating a Device
|
|
1071
1071
|
|
1072
1072
|
## Authenticated Solution User
|
1073
1073
|
|
1074
|
-
Schema for the
|
1074
|
+
Schema for the successful response when authenticating a Solution User
|
1075
1075
|
|
1076
1076
|
### <a name="authenticated-solution-user-schema"></a> Schema
|
1077
1077
|
|
@@ -1108,7 +1108,7 @@ Schema for the sucessful response when authenticating a Solution User
|
|
1108
1108
|
|
1109
1109
|
## Authenticated User
|
1110
1110
|
|
1111
|
-
Schema for the
|
1111
|
+
Schema for the successful response when authenticating a User
|
1112
1112
|
|
1113
1113
|
### <a name="authenticated-user-schema"></a> Schema
|
1114
1114
|
|
data/docs/dashboards.md
CHANGED
data/docs/deviceRecipe.md
CHANGED
@@ -38,7 +38,7 @@ puts result
|
|
38
38
|
|
39
39
|
| Code | Type | Description |
|
40
40
|
| ---- | ---- | ----------- |
|
41
|
-
| 201 | [Device Recipe Bulk Create](_schemas.md#device-recipe-bulk-create) | If devices were
|
41
|
+
| 201 | [Device Recipe Bulk Create](_schemas.md#device-recipe-bulk-create) | If devices were successfully created |
|
42
42
|
|
43
43
|
#### Error Responses
|
44
44
|
|
data/docs/devices.md
CHANGED
@@ -6,12 +6,46 @@ parameters and the potential responses.
|
|
6
6
|
|
7
7
|
##### Contents
|
8
8
|
|
9
|
+
* [Export](#export)
|
9
10
|
* [Get](#get)
|
10
11
|
* [Post](#post)
|
11
12
|
* [Send Command](#send-command)
|
12
13
|
|
13
14
|
<br/>
|
14
15
|
|
16
|
+
## Export
|
17
|
+
|
18
|
+
Creates an export of all device metadata.
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
result = client.devices.export(applicationId: my_application_id)
|
22
|
+
|
23
|
+
puts result
|
24
|
+
```
|
25
|
+
|
26
|
+
#### Available Parameters
|
27
|
+
|
28
|
+
| Name | Type | Required | Description | Default | Example |
|
29
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
30
|
+
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
31
|
+
| email | string | N | Email address to send export to. Defaults to current user's email. | | email@example.com |
|
32
|
+
| callbackUrl | string | N | Callback URL to call with export result. | | https://example.com/cburl |
|
33
|
+
|
34
|
+
#### Successful Responses
|
35
|
+
|
36
|
+
| Code | Type | Description |
|
37
|
+
| ---- | ---- | ----------- |
|
38
|
+
| 200 | [Success](_schemas.md#success) | If generation of export was successfully started |
|
39
|
+
|
40
|
+
#### Error Responses
|
41
|
+
|
42
|
+
| Code | Type | Description |
|
43
|
+
| ---- | ---- | ----------- |
|
44
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
45
|
+
| 404 | [Error](_schemas.md#error) | Error if application was not found |
|
46
|
+
|
47
|
+
<br/>
|
48
|
+
|
15
49
|
## Get
|
16
50
|
|
17
51
|
Returns the devices for an application
|
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.5.
|
8
|
+
# Built For Version 1.5.1
|
9
9
|
class Client
|
10
10
|
attr_accessor :auth_token, :url
|
11
11
|
|
@@ -128,7 +128,7 @@ module LosantRest
|
|
128
128
|
|
129
129
|
headers["Accept"] = "application/json"
|
130
130
|
headers["Content-Type"] = "application/json"
|
131
|
-
headers["Accept-Version"] = "^1.5.
|
131
|
+
headers["Accept-Version"] = "^1.5.1"
|
132
132
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
133
133
|
path = self.url + options.fetch(:path, "")
|
134
134
|
|
@@ -19,7 +19,7 @@ module LosantRest
|
|
19
19
|
# * {boolean} _embedded - Return embedded resources in response
|
20
20
|
#
|
21
21
|
# Responses:
|
22
|
-
# * 201 - If devices were
|
22
|
+
# * 201 - If devices were successfully created (https://api.losant.com/#/definitions/deviceRecipeBulkCreate)
|
23
23
|
#
|
24
24
|
# Errors:
|
25
25
|
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
data/lib/losant_rest/devices.rb
CHANGED
@@ -7,6 +7,48 @@ module LosantRest
|
|
7
7
|
@client = client
|
8
8
|
end
|
9
9
|
|
10
|
+
# Creates an export of all device metadata.
|
11
|
+
#
|
12
|
+
# Parameters:
|
13
|
+
# * {string} applicationId - ID associated with the application
|
14
|
+
# * {string} email - Email address to send export to. Defaults to current user's email.
|
15
|
+
# * {string} callbackUrl - Callback URL to call with export result.
|
16
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
17
|
+
# * {boolean} _actions - Return resource actions in response
|
18
|
+
# * {boolean} _links - Return resource link in response
|
19
|
+
# * {boolean} _embedded - Return embedded resources in response
|
20
|
+
#
|
21
|
+
# Responses:
|
22
|
+
# * 200 - If generation of export was successfully started (https://api.losant.com/#/definitions/success)
|
23
|
+
#
|
24
|
+
# Errors:
|
25
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
26
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
27
|
+
def export(params = {})
|
28
|
+
params = Utils.symbolize_hash_keys(params)
|
29
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
30
|
+
headers = {}
|
31
|
+
body = nil
|
32
|
+
|
33
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
34
|
+
|
35
|
+
query_params[:email] = params[:email] if params.has_key?(:email)
|
36
|
+
query_params[:callbackUrl] = params[:callbackUrl] if params.has_key?(:callbackUrl)
|
37
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
38
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
39
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
40
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
41
|
+
|
42
|
+
path = "/applications/#{params[:applicationId]}/devices/export"
|
43
|
+
|
44
|
+
@client.request(
|
45
|
+
method: :post,
|
46
|
+
path: path,
|
47
|
+
query: query_params,
|
48
|
+
headers: headers,
|
49
|
+
body: body)
|
50
|
+
end
|
51
|
+
|
10
52
|
# Returns the devices for an application
|
11
53
|
#
|
12
54
|
# Parameters:
|
data/lib/losant_rest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: losant_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Kuehl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|