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,110 @@
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
+ "required": [
108
+ "name"
109
+ ]
110
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "patternProperties": {
5
+ "^.{1,255}$": {}
6
+ }
7
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "key": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "maxLength": 255
9
+ },
10
+ "value": {}
11
+ },
12
+ "additionalProperties": false,
13
+ "required": [
14
+ "key"
15
+ ]
16
+ }
@@ -0,0 +1,179 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "items": {
6
+ "type": "array",
7
+ "items": {
8
+ "title": "Workflow",
9
+ "description": "Schema for a single Workflow",
10
+ "type": "object",
11
+ "properties": {
12
+ "id": {
13
+ "type": "string",
14
+ "pattern": "^[A-Fa-f\\d]{24}$"
15
+ },
16
+ "flowId": {
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
+ "name": {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "maxLength": 255
36
+ },
37
+ "description": {
38
+ "type": "string",
39
+ "maxLength": 32767
40
+ },
41
+ "enabled": {
42
+ "type": "boolean"
43
+ },
44
+ "triggers": {
45
+ "type": "array",
46
+ "items": {
47
+ "type": "object",
48
+ "properties": {
49
+ "key": {
50
+ "type": "string"
51
+ },
52
+ "type": {
53
+ "type": "string"
54
+ },
55
+ "config": {
56
+ "type": "object"
57
+ },
58
+ "meta": {
59
+ "type": "object"
60
+ },
61
+ "outputIds": {
62
+ "type": "array",
63
+ "items": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "string"
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "additionalProperties": false,
72
+ "required": [
73
+ "type"
74
+ ]
75
+ }
76
+ },
77
+ "nodes": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "object",
81
+ "properties": {
82
+ "id": {
83
+ "type": "string"
84
+ },
85
+ "type": {
86
+ "type": "string"
87
+ },
88
+ "config": {
89
+ "type": "object"
90
+ },
91
+ "meta": {
92
+ "type": "object"
93
+ },
94
+ "outputIds": {
95
+ "type": "array",
96
+ "items": {
97
+ "type": "array",
98
+ "items": {
99
+ "type": "string"
100
+ }
101
+ }
102
+ }
103
+ },
104
+ "additionalProperties": false,
105
+ "required": [
106
+ "id",
107
+ "type"
108
+ ]
109
+ }
110
+ },
111
+ "globals": {
112
+ "type": "array",
113
+ "items": {
114
+ "type": "object",
115
+ "properties": {
116
+ "key": {
117
+ "type": "string",
118
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
119
+ },
120
+ "json": {
121
+ "type": "string",
122
+ "minLength": 1
123
+ }
124
+ },
125
+ "additionalProperties": false,
126
+ "required": [
127
+ "key",
128
+ "json"
129
+ ]
130
+ }
131
+ },
132
+ "stats": {
133
+ "type": "object",
134
+ "properties": {
135
+ "runCount": {
136
+ "type": "number"
137
+ },
138
+ "errorCount": {
139
+ "type": "number"
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+ },
146
+ "count": {
147
+ "type": "integer"
148
+ },
149
+ "totalCount": {
150
+ "type": "integer"
151
+ },
152
+ "perPage": {
153
+ "type": "integer"
154
+ },
155
+ "page": {
156
+ "type": "integer"
157
+ },
158
+ "filter": {
159
+ "type": "string"
160
+ },
161
+ "filterField": {
162
+ "type": "string"
163
+ },
164
+ "sortField": {
165
+ "type": "string"
166
+ },
167
+ "sortDirection": {
168
+ "type": "string",
169
+ "enum": [
170
+ "asc",
171
+ "desc"
172
+ ]
173
+ },
174
+ "applicationId": {
175
+ "type": "string",
176
+ "pattern": "^[A-Fa-f\\d]{24}$"
177
+ }
178
+ }
179
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "accessToken": {
6
+ "type": "string",
7
+ "minLength": 1
8
+ }
9
+ },
10
+ "required": [
11
+ "accessToken"
12
+ ],
13
+ "additionalProperties": false
14
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "patternProperties": {
5
+ "^[A-Fa-f\\d]{24}$": {
6
+ "type": "object",
7
+ "properties": {
8
+ "time": {
9
+ "type": "string",
10
+ "format": "date-time"
11
+ },
12
+ "data": {
13
+ "type": "object",
14
+ "patternProperties": {
15
+ "^[0-9a-zA-Z_-]{1,255}$": {
16
+ "type": [
17
+ "number",
18
+ "string",
19
+ "boolean"
20
+ ]
21
+ }
22
+ },
23
+ "additionalProperties": false
24
+ }
25
+ },
26
+ "additionalProperties": false,
27
+ "required": [
28
+ "data",
29
+ "time"
30
+ ]
31
+ }
32
+ },
33
+ "additionalProperties": false
34
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "attribute": {
6
+ "type": "string",
7
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
8
+ },
9
+ "deviceTags": {
10
+ "type": "array",
11
+ "items": {
12
+ "type": "object",
13
+ "properties": {
14
+ "key": {
15
+ "type": "string",
16
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
17
+ },
18
+ "value": {
19
+ "type": "string",
20
+ "minLength": 1,
21
+ "maxLength": 255
22
+ }
23
+ },
24
+ "additionalProperties": false
25
+ }
26
+ },
27
+ "deviceIds": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "string",
31
+ "pattern": "^[A-Fa-f\\d]{24}$"
32
+ }
33
+ }
34
+ },
35
+ "additionalProperties": false
36
+ }
data/schemas/me.json ADDED
@@ -0,0 +1,173 @@
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
+ "userId": {
10
+ "type": "string",
11
+ "pattern": "^[A-Fa-f\\d]{24}$"
12
+ },
13
+ "creationDate": {
14
+ "type": "string",
15
+ "format": "date-time"
16
+ },
17
+ "lastUpdated": {
18
+ "type": "string",
19
+ "format": "date-time"
20
+ },
21
+ "passwordLastUpdated": {
22
+ "type": "string",
23
+ "format": "date-time"
24
+ },
25
+ "email": {
26
+ "type": "string",
27
+ "format": "email",
28
+ "maxLength": 1024
29
+ },
30
+ "firstName": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "maxLength": 1024
34
+ },
35
+ "lastName": {
36
+ "type": "string",
37
+ "minLength": 1,
38
+ "maxLength": 1024
39
+ },
40
+ "companyName": {
41
+ "type": "string",
42
+ "maxLength": 1024
43
+ },
44
+ "phoneNumber": {
45
+ "type": "string",
46
+ "maxLength": 1024
47
+ },
48
+ "location": {
49
+ "type": "string",
50
+ "maxLength": 1024
51
+ },
52
+ "url": {
53
+ "type": "string",
54
+ "maxLength": 1024
55
+ },
56
+ "emailVerified": {
57
+ "type": "boolean"
58
+ },
59
+ "twoFactorAuthEnabled": {
60
+ "type": "boolean"
61
+ },
62
+ "fullName": {
63
+ "type": "string"
64
+ },
65
+ "githubName": {
66
+ "type": "string"
67
+ },
68
+ "twitterName": {
69
+ "type": "string"
70
+ },
71
+ "avatarUrl": {
72
+ "type": "string",
73
+ "format": "url"
74
+ },
75
+ "limits": {
76
+ "application": {
77
+ "type": "number"
78
+ },
79
+ "dashboard": {
80
+ "type": "number"
81
+ }
82
+ },
83
+ "recentDashboards": {
84
+ "title": "Recent Item List",
85
+ "description": "Schema for an array of recent items",
86
+ "type": "object",
87
+ "properties": {
88
+ "itemType": {
89
+ "type": "string",
90
+ "enum": [
91
+ "application",
92
+ "device",
93
+ "flow",
94
+ "dashboard"
95
+ ]
96
+ },
97
+ "parentId": {
98
+ "type": "string",
99
+ "pattern": "^[A-Fa-f\\d]{24}$"
100
+ },
101
+ "items": {
102
+ "type": "array",
103
+ "items": {
104
+ "type": "object",
105
+ "properties": {
106
+ "id": {
107
+ "type": "string",
108
+ "pattern": "^[A-Fa-f\\d]{24}$"
109
+ },
110
+ "name": {
111
+ "type": "string",
112
+ "minLength": 1,
113
+ "maxLength": 255
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ },
120
+ "recentApplications": {
121
+ "title": "Recent Item List",
122
+ "description": "Schema for an array of recent items",
123
+ "type": "object",
124
+ "properties": {
125
+ "itemType": {
126
+ "type": "string",
127
+ "enum": [
128
+ "application",
129
+ "device",
130
+ "flow",
131
+ "dashboard"
132
+ ]
133
+ },
134
+ "parentId": {
135
+ "type": "string",
136
+ "pattern": "^[A-Fa-f\\d]{24}$"
137
+ },
138
+ "items": {
139
+ "type": "array",
140
+ "items": {
141
+ "type": "object",
142
+ "properties": {
143
+ "id": {
144
+ "type": "string",
145
+ "pattern": "^[A-Fa-f\\d]{24}$"
146
+ },
147
+ "name": {
148
+ "type": "string",
149
+ "minLength": 1,
150
+ "maxLength": 255
151
+ }
152
+ }
153
+ }
154
+ }
155
+ }
156
+ },
157
+ "defaults": {},
158
+ "summary": {
159
+ "type": "object",
160
+ "properties": {
161
+ "appCount": {
162
+ "type": "number"
163
+ },
164
+ "dashCount": {
165
+ "type": "number"
166
+ },
167
+ "orgCount": {
168
+ "type": "number"
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "email": {
6
+ "type": "string",
7
+ "format": "email",
8
+ "maxLength": 1024
9
+ },
10
+ "firstName": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "maxLength": 1024
14
+ },
15
+ "lastName": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "maxLength": 1024
19
+ },
20
+ "companyName": {
21
+ "type": "string",
22
+ "maxLength": 1024
23
+ },
24
+ "phoneNumber": {
25
+ "type": "string",
26
+ "maxLength": 1024
27
+ },
28
+ "location": {
29
+ "type": "string",
30
+ "maxLength": 1024
31
+ },
32
+ "url": {
33
+ "type": "string",
34
+ "maxLength": 1024
35
+ },
36
+ "password": {
37
+ "type": "string",
38
+ "minLength": 8,
39
+ "maxLength": 2048
40
+ }
41
+ },
42
+ "additionalProperties": false
43
+ }
@@ -0,0 +1,45 @@
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
+ "deviceTags": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "properties": {
20
+ "key": {
21
+ "type": "string",
22
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
23
+ },
24
+ "value": {
25
+ "type": "string",
26
+ "minLength": 1,
27
+ "maxLength": 255
28
+ }
29
+ },
30
+ "additionalProperties": false
31
+ }
32
+ },
33
+ "deviceIds": {
34
+ "type": "array",
35
+ "items": {
36
+ "type": "string",
37
+ "pattern": "^[A-Fa-f\\d]{24}$"
38
+ }
39
+ }
40
+ },
41
+ "required": [
42
+ "name"
43
+ ],
44
+ "additionalProperties": false
45
+ }