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,115 @@
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
+ "eventId": {
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
+ "sourceType": {
26
+ "type": "string",
27
+ "enum": [
28
+ "flow",
29
+ "user",
30
+ "device"
31
+ ]
32
+ },
33
+ "sourceId": {
34
+ "type": "string",
35
+ "pattern": "^[A-Fa-f\\d]{24}$"
36
+ },
37
+ "level": {
38
+ "type": "string",
39
+ "enum": [
40
+ "info",
41
+ "warning",
42
+ "error",
43
+ "critical"
44
+ ]
45
+ },
46
+ "state": {
47
+ "type": "string",
48
+ "enum": [
49
+ "new",
50
+ "acknowledged",
51
+ "resolved"
52
+ ]
53
+ },
54
+ "subject": {
55
+ "type": "string",
56
+ "minLength": 1,
57
+ "maxLength": 255
58
+ },
59
+ "message": {
60
+ "type": "string",
61
+ "maxLength": 32767
62
+ },
63
+ "data": {},
64
+ "updates": {
65
+ "type": "array",
66
+ "items": {
67
+ "type": "object",
68
+ "properties": {
69
+ "sourceType": {
70
+ "type": "string",
71
+ "enum": [
72
+ "flow",
73
+ "user",
74
+ "device"
75
+ ]
76
+ },
77
+ "sourceId": {
78
+ "type": "string",
79
+ "pattern": "^[A-Fa-f\\d]{24}$"
80
+ },
81
+ "creationDate": {
82
+ "type": "string",
83
+ "format": "date-time"
84
+ },
85
+ "comment": {
86
+ "type": "string",
87
+ "maxLength": 32767
88
+ },
89
+ "data": {},
90
+ "stateChange": {
91
+ "type": "object",
92
+ "properties": {
93
+ "old": {
94
+ "type": "string",
95
+ "enum": [
96
+ "new",
97
+ "acknowledged",
98
+ "resolved"
99
+ ]
100
+ },
101
+ "new": {
102
+ "type": "string",
103
+ "enum": [
104
+ "new",
105
+ "acknowledged",
106
+ "resolved"
107
+ ]
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "state": {
6
+ "type": "string",
7
+ "enum": [
8
+ "new",
9
+ "acknowledged",
10
+ "resolved"
11
+ ]
12
+ },
13
+ "comment": {
14
+ "type": "string",
15
+ "maxLength": 32767
16
+ },
17
+ "data": {}
18
+ },
19
+ "additionalProperties": false
20
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "level": {
6
+ "type": "string",
7
+ "enum": [
8
+ "info",
9
+ "warning",
10
+ "error",
11
+ "critical"
12
+ ]
13
+ },
14
+ "state": {
15
+ "type": "string",
16
+ "enum": [
17
+ "new",
18
+ "acknowledged",
19
+ "resolved"
20
+ ]
21
+ },
22
+ "subject": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "maxLength": 255
26
+ },
27
+ "message": {
28
+ "type": "string",
29
+ "maxLength": 32767
30
+ },
31
+ "data": {}
32
+ },
33
+ "required": [
34
+ "level",
35
+ "state",
36
+ "subject"
37
+ ],
38
+ "additionalProperties": false
39
+ }
@@ -0,0 +1,165 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "items": {
6
+ "type": "array",
7
+ "items": {
8
+ "title": "Event",
9
+ "description": "Schema for a single Event",
10
+ "type": "object",
11
+ "properties": {
12
+ "id": {
13
+ "type": "string",
14
+ "pattern": "^[A-Fa-f\\d]{24}$"
15
+ },
16
+ "eventId": {
17
+ "type": "string",
18
+ "pattern": "^[A-Fa-f\\d]{24}$"
19
+ },
20
+ "applicationId": {
21
+ "type": "string",
22
+ "pattern": "^[A-Fa-f\\d]{24}$"
23
+ },
24
+ "creationDate": {
25
+ "type": "string",
26
+ "format": "date-time"
27
+ },
28
+ "lastUpdated": {
29
+ "type": "string",
30
+ "format": "date-time"
31
+ },
32
+ "sourceType": {
33
+ "type": "string",
34
+ "enum": [
35
+ "flow",
36
+ "user",
37
+ "device"
38
+ ]
39
+ },
40
+ "sourceId": {
41
+ "type": "string",
42
+ "pattern": "^[A-Fa-f\\d]{24}$"
43
+ },
44
+ "level": {
45
+ "type": "string",
46
+ "enum": [
47
+ "info",
48
+ "warning",
49
+ "error",
50
+ "critical"
51
+ ]
52
+ },
53
+ "state": {
54
+ "type": "string",
55
+ "enum": [
56
+ "new",
57
+ "acknowledged",
58
+ "resolved"
59
+ ]
60
+ },
61
+ "subject": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "maxLength": 255
65
+ },
66
+ "message": {
67
+ "type": "string",
68
+ "maxLength": 32767
69
+ },
70
+ "data": {},
71
+ "updates": {
72
+ "type": "array",
73
+ "items": {
74
+ "type": "object",
75
+ "properties": {
76
+ "sourceType": {
77
+ "type": "string",
78
+ "enum": [
79
+ "flow",
80
+ "user",
81
+ "device"
82
+ ]
83
+ },
84
+ "sourceId": {
85
+ "type": "string",
86
+ "pattern": "^[A-Fa-f\\d]{24}$"
87
+ },
88
+ "creationDate": {
89
+ "type": "string",
90
+ "format": "date-time"
91
+ },
92
+ "comment": {
93
+ "type": "string",
94
+ "maxLength": 32767
95
+ },
96
+ "data": {},
97
+ "stateChange": {
98
+ "type": "object",
99
+ "properties": {
100
+ "old": {
101
+ "type": "string",
102
+ "enum": [
103
+ "new",
104
+ "acknowledged",
105
+ "resolved"
106
+ ]
107
+ },
108
+ "new": {
109
+ "type": "string",
110
+ "enum": [
111
+ "new",
112
+ "acknowledged",
113
+ "resolved"
114
+ ]
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ },
124
+ "count": {
125
+ "type": "integer"
126
+ },
127
+ "totalCount": {
128
+ "type": "integer"
129
+ },
130
+ "perPage": {
131
+ "type": "integer"
132
+ },
133
+ "page": {
134
+ "type": "integer"
135
+ },
136
+ "filter": {
137
+ "type": "string"
138
+ },
139
+ "filterField": {
140
+ "type": "string"
141
+ },
142
+ "sortField": {
143
+ "type": "string"
144
+ },
145
+ "sortDirection": {
146
+ "type": "string",
147
+ "enum": [
148
+ "asc",
149
+ "desc"
150
+ ]
151
+ },
152
+ "state": {
153
+ "type": "string",
154
+ "enum": [
155
+ "new",
156
+ "acknowledged",
157
+ "resolved"
158
+ ]
159
+ },
160
+ "applicationId": {
161
+ "type": "string",
162
+ "pattern": "^[A-Fa-f\\d]{24}$"
163
+ }
164
+ }
165
+ }
data/schemas/flow.json ADDED
@@ -0,0 +1,137 @@
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
+ "flowId": {
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
+ "enabled": {
35
+ "type": "boolean"
36
+ },
37
+ "triggers": {
38
+ "type": "array",
39
+ "items": {
40
+ "type": "object",
41
+ "properties": {
42
+ "key": {
43
+ "type": "string"
44
+ },
45
+ "type": {
46
+ "type": "string"
47
+ },
48
+ "config": {
49
+ "type": "object"
50
+ },
51
+ "meta": {
52
+ "type": "object"
53
+ },
54
+ "outputIds": {
55
+ "type": "array",
56
+ "items": {
57
+ "type": "array",
58
+ "items": {
59
+ "type": "string"
60
+ }
61
+ }
62
+ }
63
+ },
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "type"
67
+ ]
68
+ }
69
+ },
70
+ "nodes": {
71
+ "type": "array",
72
+ "items": {
73
+ "type": "object",
74
+ "properties": {
75
+ "id": {
76
+ "type": "string"
77
+ },
78
+ "type": {
79
+ "type": "string"
80
+ },
81
+ "config": {
82
+ "type": "object"
83
+ },
84
+ "meta": {
85
+ "type": "object"
86
+ },
87
+ "outputIds": {
88
+ "type": "array",
89
+ "items": {
90
+ "type": "array",
91
+ "items": {
92
+ "type": "string"
93
+ }
94
+ }
95
+ }
96
+ },
97
+ "additionalProperties": false,
98
+ "required": [
99
+ "id",
100
+ "type"
101
+ ]
102
+ }
103
+ },
104
+ "globals": {
105
+ "type": "array",
106
+ "items": {
107
+ "type": "object",
108
+ "properties": {
109
+ "key": {
110
+ "type": "string",
111
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
112
+ },
113
+ "json": {
114
+ "type": "string",
115
+ "minLength": 1
116
+ }
117
+ },
118
+ "additionalProperties": false,
119
+ "required": [
120
+ "key",
121
+ "json"
122
+ ]
123
+ }
124
+ },
125
+ "stats": {
126
+ "type": "object",
127
+ "properties": {
128
+ "runCount": {
129
+ "type": "number"
130
+ },
131
+ "errorCount": {
132
+ "type": "number"
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "array",
4
+ "items": {
5
+ "type": "object",
6
+ "properties": {
7
+ "time": {
8
+ "type": "string",
9
+ "format": "date-time"
10
+ },
11
+ "errorCount": {
12
+ "type": "number"
13
+ },
14
+ "pathsCompleted": {
15
+ "type": "number"
16
+ },
17
+ "totalCount": {
18
+ "type": "number"
19
+ },
20
+ "totalTime": {
21
+ "type": "number"
22
+ },
23
+ "wallTime": {
24
+ "type": "number"
25
+ },
26
+ "nodes": {
27
+ "type": "object",
28
+ "additionalProperties": {
29
+ "type": "object",
30
+ "properties": {
31
+ "time": {
32
+ "type": "number"
33
+ },
34
+ "count": {
35
+ "type": "number"
36
+ }
37
+ }
38
+ }
39
+ },
40
+ "errors": {
41
+ "type": "array",
42
+ "items": {}
43
+ }
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,107 @@
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
+ "enabled": {
15
+ "type": "boolean"
16
+ },
17
+ "triggers": {
18
+ "type": "array",
19
+ "items": {
20
+ "type": "object",
21
+ "properties": {
22
+ "key": {
23
+ "type": "string"
24
+ },
25
+ "type": {
26
+ "type": "string"
27
+ },
28
+ "config": {
29
+ "type": "object"
30
+ },
31
+ "meta": {
32
+ "type": "object"
33
+ },
34
+ "outputIds": {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "string"
40
+ }
41
+ }
42
+ }
43
+ },
44
+ "additionalProperties": false,
45
+ "required": [
46
+ "type"
47
+ ]
48
+ }
49
+ },
50
+ "nodes": {
51
+ "type": "array",
52
+ "items": {
53
+ "type": "object",
54
+ "properties": {
55
+ "id": {
56
+ "type": "string"
57
+ },
58
+ "type": {
59
+ "type": "string"
60
+ },
61
+ "config": {
62
+ "type": "object"
63
+ },
64
+ "meta": {
65
+ "type": "object"
66
+ },
67
+ "outputIds": {
68
+ "type": "array",
69
+ "items": {
70
+ "type": "array",
71
+ "items": {
72
+ "type": "string"
73
+ }
74
+ }
75
+ }
76
+ },
77
+ "additionalProperties": false,
78
+ "required": [
79
+ "id",
80
+ "type"
81
+ ]
82
+ }
83
+ },
84
+ "globals": {
85
+ "type": "array",
86
+ "items": {
87
+ "type": "object",
88
+ "properties": {
89
+ "key": {
90
+ "type": "string",
91
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
92
+ },
93
+ "json": {
94
+ "type": "string",
95
+ "minLength": 1
96
+ }
97
+ },
98
+ "additionalProperties": false,
99
+ "required": [
100
+ "key",
101
+ "json"
102
+ ]
103
+ }
104
+ }
105
+ },
106
+ "additionalProperties": false
107
+ }