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.
Files changed (139) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.rbenv-version +1 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +2 -0
  6. data/LICENSE +21 -0
  7. data/README.md +237 -0
  8. data/Rakefile +12 -0
  9. data/docs/_schemas.md +6348 -0
  10. data/docs/accessToken.md +107 -0
  11. data/docs/accessTokens.md +68 -0
  12. data/docs/application.md +107 -0
  13. data/docs/applicationKey.md +115 -0
  14. data/docs/applicationKeys.md +81 -0
  15. data/docs/applications.md +76 -0
  16. data/docs/auth.md +104 -0
  17. data/docs/dashboard.md +107 -0
  18. data/docs/dashboards.md +76 -0
  19. data/docs/data.md +78 -0
  20. data/docs/device.md +300 -0
  21. data/docs/deviceRecipe.md +152 -0
  22. data/docs/deviceRecipes.md +81 -0
  23. data/docs/devices.md +117 -0
  24. data/docs/event.md +115 -0
  25. data/docs/events.md +153 -0
  26. data/docs/flow.md +261 -0
  27. data/docs/flows.md +81 -0
  28. data/docs/me.md +312 -0
  29. data/docs/org.md +279 -0
  30. data/docs/orgs.md +75 -0
  31. data/docs/webhook.md +115 -0
  32. data/docs/webhooks.md +81 -0
  33. data/examples/auth.rb +32 -0
  34. data/examples/list_devices.rb +45 -0
  35. data/lib/losant_rest/access_token.rb +122 -0
  36. data/lib/losant_rest/access_tokens.rb +80 -0
  37. data/lib/losant_rest/application.rb +122 -0
  38. data/lib/losant_rest/application_key.rb +128 -0
  39. data/lib/losant_rest/application_keys.rb +98 -0
  40. data/lib/losant_rest/applications.rb +94 -0
  41. data/lib/losant_rest/auth.rb +122 -0
  42. data/lib/losant_rest/client.rb +132 -0
  43. data/lib/losant_rest/dashboard.rb +122 -0
  44. data/lib/losant_rest/dashboards.rb +94 -0
  45. data/lib/losant_rest/data.rb +89 -0
  46. data/lib/losant_rest/device.rb +336 -0
  47. data/lib/losant_rest/device_recipe.rb +169 -0
  48. data/lib/losant_rest/device_recipes.rb +98 -0
  49. data/lib/losant_rest/devices.rb +139 -0
  50. data/lib/losant_rest/error.rb +12 -0
  51. data/lib/losant_rest/event.rb +128 -0
  52. data/lib/losant_rest/events.rb +183 -0
  53. data/lib/losant_rest/flow.rb +290 -0
  54. data/lib/losant_rest/flows.rb +98 -0
  55. data/lib/losant_rest/me.rb +362 -0
  56. data/lib/losant_rest/org.rb +314 -0
  57. data/lib/losant_rest/orgs.rb +92 -0
  58. data/lib/losant_rest/utils.rb +22 -0
  59. data/lib/losant_rest/version.rb +3 -0
  60. data/lib/losant_rest/webhook.rb +128 -0
  61. data/lib/losant_rest/webhooks.rb +98 -0
  62. data/lib/losant_rest.rb +43 -0
  63. data/losant_rest.gemspec +25 -0
  64. data/schemas/accessToken.json +52 -0
  65. data/schemas/accessTokenPatch.json +19 -0
  66. data/schemas/accessTokenPost.json +32 -0
  67. data/schemas/accessTokens.json +65 -0
  68. data/schemas/application.json +65 -0
  69. data/schemas/applicationKey.json +68 -0
  70. data/schemas/applicationKeyPatch.json +18 -0
  71. data/schemas/applicationKeyPost.json +36 -0
  72. data/schemas/applicationKeys.json +110 -0
  73. data/schemas/applicationPatch.json +16 -0
  74. data/schemas/applicationPost.json +23 -0
  75. data/schemas/applications.json +103 -0
  76. data/schemas/authedDevice.json +34 -0
  77. data/schemas/authedUser.json +18 -0
  78. data/schemas/dashboard.json +95 -0
  79. data/schemas/dashboardPatch.json +69 -0
  80. data/schemas/dashboardPost.json +76 -0
  81. data/schemas/dashboards.json +133 -0
  82. data/schemas/device.json +113 -0
  83. data/schemas/deviceCommand.json +20 -0
  84. data/schemas/deviceCommands.json +25 -0
  85. data/schemas/deviceCredentials.json +22 -0
  86. data/schemas/deviceLog.json +28 -0
  87. data/schemas/devicePatch.json +78 -0
  88. data/schemas/devicePost.json +81 -0
  89. data/schemas/deviceRecipe.json +106 -0
  90. data/schemas/deviceRecipeBulkCreate.json +15 -0
  91. data/schemas/deviceRecipeBulkCreatePost.json +19 -0
  92. data/schemas/deviceRecipePatch.json +87 -0
  93. data/schemas/deviceRecipePost.json +90 -0
  94. data/schemas/deviceRecipes.json +148 -0
  95. data/schemas/deviceState.json +30 -0
  96. data/schemas/deviceStates.json +35 -0
  97. data/schemas/deviceTagFilter.json +19 -0
  98. data/schemas/devices.json +155 -0
  99. data/schemas/disableTwoFactorAuth.json +20 -0
  100. data/schemas/enableTwoFactorAuth.json +21 -0
  101. data/schemas/error.json +12 -0
  102. data/schemas/event.json +115 -0
  103. data/schemas/eventPatch.json +20 -0
  104. data/schemas/eventPost.json +39 -0
  105. data/schemas/events.json +165 -0
  106. data/schemas/flow.json +137 -0
  107. data/schemas/flowLog.json +46 -0
  108. data/schemas/flowPatch.json +107 -0
  109. data/schemas/flowPost.json +110 -0
  110. data/schemas/flowStorageEntries.json +7 -0
  111. data/schemas/flowStorageEntry.json +16 -0
  112. data/schemas/flows.json +179 -0
  113. data/schemas/githubLogin.json +14 -0
  114. data/schemas/lastValueData.json +34 -0
  115. data/schemas/lastValueQuery.json +36 -0
  116. data/schemas/me.json +173 -0
  117. data/schemas/mePatch.json +43 -0
  118. data/schemas/multiDeviceCommand.json +45 -0
  119. data/schemas/org.json +81 -0
  120. data/schemas/orgInvitePost.json +24 -0
  121. data/schemas/orgInvites.json +36 -0
  122. data/schemas/orgMemberPatch.json +23 -0
  123. data/schemas/orgPatch.json +16 -0
  124. data/schemas/orgPost.json +19 -0
  125. data/schemas/orgs.json +119 -0
  126. data/schemas/recentItem.json +27 -0
  127. data/schemas/recentItemList.json +36 -0
  128. data/schemas/success.json +12 -0
  129. data/schemas/timeSeriesData.json +89 -0
  130. data/schemas/timeSeriesQuery.json +64 -0
  131. data/schemas/userCredentials.json +25 -0
  132. data/schemas/virtualButtonPress.json +14 -0
  133. data/schemas/webhook.json +52 -0
  134. data/schemas/webhookPatch.json +29 -0
  135. data/schemas/webhookPost.json +32 -0
  136. data/schemas/webhooks.json +94 -0
  137. data/test/basic_test.rb +67 -0
  138. data/test/test_helper.rb +14 -0
  139. metadata +239 -0
@@ -0,0 +1,133 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "items": {
6
+ "type": "array",
7
+ "items": {
8
+ "title": "Dashboard",
9
+ "description": "Schema for a single Dashboard",
10
+ "type": "object",
11
+ "properties": {
12
+ "id": {
13
+ "type": "string",
14
+ "pattern": "^[A-Fa-f\\d]{24}$"
15
+ },
16
+ "dashboardId": {
17
+ "type": "string",
18
+ "pattern": "^[A-Fa-f\\d]{24}$"
19
+ },
20
+ "creationDate": {
21
+ "type": "string",
22
+ "format": "date-time"
23
+ },
24
+ "lastUpdated": {
25
+ "type": "string",
26
+ "format": "date-time"
27
+ },
28
+ "ownerId": {
29
+ "type": "string",
30
+ "pattern": "^[A-Fa-f\\d]{24}$"
31
+ },
32
+ "ownerType": {
33
+ "type": "string",
34
+ "enum": [
35
+ "user",
36
+ "organization"
37
+ ]
38
+ },
39
+ "name": {
40
+ "type": "string",
41
+ "minLength": 1,
42
+ "maxLength": 255
43
+ },
44
+ "description": {
45
+ "type": "string",
46
+ "maxLength": 32767
47
+ },
48
+ "refreshRate": {
49
+ "type": "number",
50
+ "minimum": 5,
51
+ "maximum": 600
52
+ },
53
+ "public": {
54
+ "type": "boolean"
55
+ },
56
+ "blocks": {
57
+ "type": "array",
58
+ "items": {
59
+ "type": "object",
60
+ "properties": {
61
+ "id": {
62
+ "type": "string"
63
+ },
64
+ "blockType": {
65
+ "type": "string"
66
+ },
67
+ "title": {
68
+ "type": "string",
69
+ "maxLength": 255
70
+ },
71
+ "applicationId": {
72
+ "type": "string",
73
+ "pattern": "^[A-Fa-f\\d]{24}$"
74
+ },
75
+ "startX": {
76
+ "type": "integer"
77
+ },
78
+ "startY": {
79
+ "type": "integer"
80
+ },
81
+ "width": {
82
+ "type": "integer"
83
+ },
84
+ "height": {
85
+ "type": "integer"
86
+ },
87
+ "config": {
88
+ "type": "object"
89
+ }
90
+ },
91
+ "required": [
92
+ "id",
93
+ "blockType",
94
+ "startX",
95
+ "startY",
96
+ "width",
97
+ "height"
98
+ ]
99
+ }
100
+ }
101
+ }
102
+ }
103
+ },
104
+ "count": {
105
+ "type": "integer"
106
+ },
107
+ "totalCount": {
108
+ "type": "integer"
109
+ },
110
+ "perPage": {
111
+ "type": "integer"
112
+ },
113
+ "page": {
114
+ "type": "integer"
115
+ },
116
+ "filter": {
117
+ "type": "string"
118
+ },
119
+ "filterField": {
120
+ "type": "string"
121
+ },
122
+ "sortField": {
123
+ "type": "string"
124
+ },
125
+ "sortDirection": {
126
+ "type": "string",
127
+ "enum": [
128
+ "asc",
129
+ "desc"
130
+ ]
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,113 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "id": {
6
+ "type": "string",
7
+ "pattern": "^[A-Fa-f\\d]{24}$"
8
+ },
9
+ "deviceId": {
10
+ "type": "string",
11
+ "pattern": "^[A-Fa-f\\d]{24}$"
12
+ },
13
+ "applicationId": {
14
+ "type": "string",
15
+ "pattern": "^[A-Fa-f\\d]{24}$"
16
+ },
17
+ "creationDate": {
18
+ "type": "string",
19
+ "format": "date-time"
20
+ },
21
+ "lastUpdated": {
22
+ "type": "string",
23
+ "format": "date-time"
24
+ },
25
+ "name": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "maxLength": 255
29
+ },
30
+ "description": {
31
+ "type": "string",
32
+ "maxLength": 32767
33
+ },
34
+ "tags": {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "object",
38
+ "properties": {
39
+ "key": {
40
+ "type": "string",
41
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
42
+ },
43
+ "value": {
44
+ "type": "string",
45
+ "minLength": 1,
46
+ "maxLength": 255
47
+ }
48
+ },
49
+ "required": [
50
+ "key",
51
+ "value"
52
+ ],
53
+ "additionalProperties": false
54
+ }
55
+ },
56
+ "attributes": {
57
+ "type": "array",
58
+ "items": {
59
+ "type": "object",
60
+ "properties": {
61
+ "name": {
62
+ "type": "string",
63
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
64
+ },
65
+ "dataType": {
66
+ "type": "string",
67
+ "enum": [
68
+ "string",
69
+ "number",
70
+ "gps",
71
+ "boolean"
72
+ ]
73
+ }
74
+ },
75
+ "required": [
76
+ "name",
77
+ "dataType"
78
+ ],
79
+ "additionalProperties": false
80
+ }
81
+ },
82
+ "deviceClass": {
83
+ "type": "string",
84
+ "enum": [
85
+ "standalone",
86
+ "master",
87
+ "owned",
88
+ "floating",
89
+ "virtual"
90
+ ]
91
+ },
92
+ "masterId": {
93
+ "type": "string",
94
+ "pattern": "^[A-Fa-f\\d]{24}$"
95
+ },
96
+ "connectionInfo": {
97
+ "type": "object",
98
+ "properties": {
99
+ "time": {
100
+ "type": "string",
101
+ "format": "date-time"
102
+ },
103
+ "connected": {
104
+ "enum": [
105
+ 1,
106
+ 0,
107
+ null
108
+ ]
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "time": {
6
+ "type": "string",
7
+ "format": "date-time"
8
+ },
9
+ "name": {
10
+ "type": "string",
11
+ "minLength": 1,
12
+ "maxLength": 255
13
+ },
14
+ "payload": {}
15
+ },
16
+ "required": [
17
+ "name"
18
+ ],
19
+ "additionalProperties": false
20
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "array",
4
+ "items": {
5
+ "title": "Device Command",
6
+ "description": "Schema for a command for a single Device",
7
+ "type": "object",
8
+ "properties": {
9
+ "time": {
10
+ "type": "string",
11
+ "format": "date-time"
12
+ },
13
+ "name": {
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "maxLength": 255
17
+ },
18
+ "payload": {}
19
+ },
20
+ "required": [
21
+ "name"
22
+ ],
23
+ "additionalProperties": false
24
+ }
25
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "deviceId": {
6
+ "type": "string",
7
+ "pattern": "^[A-Fa-f\\d]{24}$"
8
+ },
9
+ "key": {
10
+ "type": "string"
11
+ },
12
+ "secret": {
13
+ "type": "string"
14
+ }
15
+ },
16
+ "required": [
17
+ "deviceId",
18
+ "key",
19
+ "secret"
20
+ ],
21
+ "additionalProperties": false
22
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "array",
4
+ "items": {
5
+ "type": "object",
6
+ "properties": {
7
+ "connected": {
8
+ "enum": [
9
+ 1,
10
+ 0
11
+ ]
12
+ },
13
+ "time": {
14
+ "type": "string",
15
+ "format": "date-time"
16
+ },
17
+ "disconnectReason": {
18
+ "type": "string"
19
+ },
20
+ "messagesFromClient": {
21
+ "type": "number"
22
+ },
23
+ "messagesToClient": {
24
+ "type": "number"
25
+ }
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "name": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "maxLength": 255
9
+ },
10
+ "description": {
11
+ "type": "string",
12
+ "maxLength": 32767
13
+ },
14
+ "tags": {
15
+ "type": "array",
16
+ "items": {
17
+ "type": "object",
18
+ "properties": {
19
+ "key": {
20
+ "type": "string",
21
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
22
+ },
23
+ "value": {
24
+ "type": "string",
25
+ "minLength": 1,
26
+ "maxLength": 255
27
+ }
28
+ },
29
+ "required": [
30
+ "key",
31
+ "value"
32
+ ],
33
+ "additionalProperties": false
34
+ }
35
+ },
36
+ "attributes": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "object",
40
+ "properties": {
41
+ "name": {
42
+ "type": "string",
43
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
44
+ },
45
+ "dataType": {
46
+ "type": "string",
47
+ "enum": [
48
+ "string",
49
+ "number",
50
+ "gps",
51
+ "boolean"
52
+ ]
53
+ }
54
+ },
55
+ "required": [
56
+ "name",
57
+ "dataType"
58
+ ],
59
+ "additionalProperties": false
60
+ }
61
+ },
62
+ "deviceClass": {
63
+ "type": "string",
64
+ "enum": [
65
+ "standalone",
66
+ "master",
67
+ "owned",
68
+ "floating",
69
+ "virtual"
70
+ ]
71
+ },
72
+ "masterId": {
73
+ "type": "string",
74
+ "pattern": "^[A-Fa-f\\d]{24}$"
75
+ }
76
+ },
77
+ "additionalProperties": false
78
+ }
@@ -0,0 +1,81 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "name": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "maxLength": 255
9
+ },
10
+ "description": {
11
+ "type": "string",
12
+ "maxLength": 32767
13
+ },
14
+ "tags": {
15
+ "type": "array",
16
+ "items": {
17
+ "type": "object",
18
+ "properties": {
19
+ "key": {
20
+ "type": "string",
21
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
22
+ },
23
+ "value": {
24
+ "type": "string",
25
+ "minLength": 1,
26
+ "maxLength": 255
27
+ }
28
+ },
29
+ "required": [
30
+ "key",
31
+ "value"
32
+ ],
33
+ "additionalProperties": false
34
+ }
35
+ },
36
+ "attributes": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "object",
40
+ "properties": {
41
+ "name": {
42
+ "type": "string",
43
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
44
+ },
45
+ "dataType": {
46
+ "type": "string",
47
+ "enum": [
48
+ "string",
49
+ "number",
50
+ "gps",
51
+ "boolean"
52
+ ]
53
+ }
54
+ },
55
+ "required": [
56
+ "name",
57
+ "dataType"
58
+ ],
59
+ "additionalProperties": false
60
+ }
61
+ },
62
+ "deviceClass": {
63
+ "type": "string",
64
+ "enum": [
65
+ "standalone",
66
+ "master",
67
+ "owned",
68
+ "floating",
69
+ "virtual"
70
+ ]
71
+ },
72
+ "masterId": {
73
+ "type": "string",
74
+ "pattern": "^[A-Fa-f\\d]{24}$"
75
+ }
76
+ },
77
+ "additionalProperties": false,
78
+ "required": [
79
+ "name"
80
+ ]
81
+ }
@@ -0,0 +1,106 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "id": {
6
+ "type": "string",
7
+ "pattern": "^[A-Fa-f\\d]{24}$"
8
+ },
9
+ "deviceRecipeId": {
10
+ "type": "string",
11
+ "pattern": "^[A-Fa-f\\d]{24}$"
12
+ },
13
+ "applicationId": {
14
+ "type": "string",
15
+ "pattern": "^[A-Fa-f\\d]{24}$"
16
+ },
17
+ "creationDate": {
18
+ "type": "string",
19
+ "format": "date-time"
20
+ },
21
+ "lastUpdated": {
22
+ "type": "string",
23
+ "format": "date-time"
24
+ },
25
+ "name": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "maxLength": 255
29
+ },
30
+ "deviceName": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "maxLength": 255
34
+ },
35
+ "description": {
36
+ "type": "string",
37
+ "maxLength": 32767
38
+ },
39
+ "deviceDescription": {
40
+ "type": "string",
41
+ "maxLength": 32767
42
+ },
43
+ "tags": {
44
+ "type": "array",
45
+ "items": {
46
+ "type": "object",
47
+ "properties": {
48
+ "key": {
49
+ "type": "string",
50
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
51
+ },
52
+ "value": {
53
+ "type": "string",
54
+ "minLength": 1,
55
+ "maxLength": 255
56
+ }
57
+ },
58
+ "required": [
59
+ "key",
60
+ "value"
61
+ ],
62
+ "additionalProperties": false
63
+ }
64
+ },
65
+ "attributes": {
66
+ "type": "array",
67
+ "items": {
68
+ "type": "object",
69
+ "properties": {
70
+ "name": {
71
+ "type": "string",
72
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
73
+ },
74
+ "dataType": {
75
+ "type": "string",
76
+ "enum": [
77
+ "string",
78
+ "number",
79
+ "gps",
80
+ "boolean"
81
+ ]
82
+ }
83
+ },
84
+ "required": [
85
+ "name",
86
+ "dataType"
87
+ ],
88
+ "additionalProperties": false
89
+ }
90
+ },
91
+ "deviceClass": {
92
+ "type": "string",
93
+ "enum": [
94
+ "standalone",
95
+ "master",
96
+ "owned",
97
+ "floating",
98
+ "virtual"
99
+ ]
100
+ },
101
+ "masterId": {
102
+ "type": "string",
103
+ "pattern": "^[A-Fa-f\\d]{24}$"
104
+ }
105
+ }
106
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "created": {
6
+ "type": "number"
7
+ },
8
+ "failed": {
9
+ "type": "number"
10
+ },
11
+ "csvResult": {
12
+ "type": "string"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "nameColumn": {
6
+ "type": "string"
7
+ },
8
+ "descriptionColumn": {
9
+ "type": "string"
10
+ },
11
+ "csv": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "additionalProperties": false,
16
+ "required": [
17
+ "csv"
18
+ ]
19
+ }