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,87 @@
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
+ "deviceName": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "maxLength": 255
14
+ },
15
+ "description": {
16
+ "type": "string",
17
+ "maxLength": 32767
18
+ },
19
+ "deviceDescription": {
20
+ "type": "string",
21
+ "maxLength": 32767
22
+ },
23
+ "tags": {
24
+ "type": "array",
25
+ "items": {
26
+ "type": "object",
27
+ "properties": {
28
+ "key": {
29
+ "type": "string",
30
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
31
+ },
32
+ "value": {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "maxLength": 255
36
+ }
37
+ },
38
+ "required": [
39
+ "key",
40
+ "value"
41
+ ],
42
+ "additionalProperties": false
43
+ }
44
+ },
45
+ "attributes": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "object",
49
+ "properties": {
50
+ "name": {
51
+ "type": "string",
52
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
53
+ },
54
+ "dataType": {
55
+ "type": "string",
56
+ "enum": [
57
+ "string",
58
+ "number",
59
+ "gps",
60
+ "boolean"
61
+ ]
62
+ }
63
+ },
64
+ "required": [
65
+ "name",
66
+ "dataType"
67
+ ],
68
+ "additionalProperties": false
69
+ }
70
+ },
71
+ "deviceClass": {
72
+ "type": "string",
73
+ "enum": [
74
+ "standalone",
75
+ "master",
76
+ "owned",
77
+ "floating",
78
+ "virtual"
79
+ ]
80
+ },
81
+ "masterId": {
82
+ "type": "string",
83
+ "pattern": "^[A-Fa-f\\d]{24}$"
84
+ }
85
+ },
86
+ "additionalProperties": false
87
+ }
@@ -0,0 +1,90 @@
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
+ "deviceName": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "maxLength": 255
14
+ },
15
+ "description": {
16
+ "type": "string",
17
+ "maxLength": 32767
18
+ },
19
+ "deviceDescription": {
20
+ "type": "string",
21
+ "maxLength": 32767
22
+ },
23
+ "tags": {
24
+ "type": "array",
25
+ "items": {
26
+ "type": "object",
27
+ "properties": {
28
+ "key": {
29
+ "type": "string",
30
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
31
+ },
32
+ "value": {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "maxLength": 255
36
+ }
37
+ },
38
+ "required": [
39
+ "key",
40
+ "value"
41
+ ],
42
+ "additionalProperties": false
43
+ }
44
+ },
45
+ "attributes": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "object",
49
+ "properties": {
50
+ "name": {
51
+ "type": "string",
52
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
53
+ },
54
+ "dataType": {
55
+ "type": "string",
56
+ "enum": [
57
+ "string",
58
+ "number",
59
+ "gps",
60
+ "boolean"
61
+ ]
62
+ }
63
+ },
64
+ "required": [
65
+ "name",
66
+ "dataType"
67
+ ],
68
+ "additionalProperties": false
69
+ }
70
+ },
71
+ "deviceClass": {
72
+ "type": "string",
73
+ "enum": [
74
+ "standalone",
75
+ "master",
76
+ "owned",
77
+ "floating",
78
+ "virtual"
79
+ ]
80
+ },
81
+ "masterId": {
82
+ "type": "string",
83
+ "pattern": "^[A-Fa-f\\d]{24}$"
84
+ }
85
+ },
86
+ "additionalProperties": false,
87
+ "required": [
88
+ "name"
89
+ ]
90
+ }
@@ -0,0 +1,148 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "items": {
6
+ "type": "array",
7
+ "items": {
8
+ "title": "Device Recipe",
9
+ "description": "Schema for a single Device Recipe",
10
+ "type": "object",
11
+ "properties": {
12
+ "id": {
13
+ "type": "string",
14
+ "pattern": "^[A-Fa-f\\d]{24}$"
15
+ },
16
+ "deviceRecipeId": {
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
+ "deviceName": {
38
+ "type": "string",
39
+ "minLength": 1,
40
+ "maxLength": 255
41
+ },
42
+ "description": {
43
+ "type": "string",
44
+ "maxLength": 32767
45
+ },
46
+ "deviceDescription": {
47
+ "type": "string",
48
+ "maxLength": 32767
49
+ },
50
+ "tags": {
51
+ "type": "array",
52
+ "items": {
53
+ "type": "object",
54
+ "properties": {
55
+ "key": {
56
+ "type": "string",
57
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
58
+ },
59
+ "value": {
60
+ "type": "string",
61
+ "minLength": 1,
62
+ "maxLength": 255
63
+ }
64
+ },
65
+ "required": [
66
+ "key",
67
+ "value"
68
+ ],
69
+ "additionalProperties": false
70
+ }
71
+ },
72
+ "attributes": {
73
+ "type": "array",
74
+ "items": {
75
+ "type": "object",
76
+ "properties": {
77
+ "name": {
78
+ "type": "string",
79
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
80
+ },
81
+ "dataType": {
82
+ "type": "string",
83
+ "enum": [
84
+ "string",
85
+ "number",
86
+ "gps",
87
+ "boolean"
88
+ ]
89
+ }
90
+ },
91
+ "required": [
92
+ "name",
93
+ "dataType"
94
+ ],
95
+ "additionalProperties": false
96
+ }
97
+ },
98
+ "deviceClass": {
99
+ "type": "string",
100
+ "enum": [
101
+ "standalone",
102
+ "master",
103
+ "owned",
104
+ "floating",
105
+ "virtual"
106
+ ]
107
+ },
108
+ "masterId": {
109
+ "type": "string",
110
+ "pattern": "^[A-Fa-f\\d]{24}$"
111
+ }
112
+ }
113
+ }
114
+ },
115
+ "count": {
116
+ "type": "integer"
117
+ },
118
+ "totalCount": {
119
+ "type": "integer"
120
+ },
121
+ "perPage": {
122
+ "type": "integer"
123
+ },
124
+ "page": {
125
+ "type": "integer"
126
+ },
127
+ "filter": {
128
+ "type": "string"
129
+ },
130
+ "filterField": {
131
+ "type": "string"
132
+ },
133
+ "sortField": {
134
+ "type": "string"
135
+ },
136
+ "sortDirection": {
137
+ "type": "string",
138
+ "enum": [
139
+ "asc",
140
+ "desc"
141
+ ]
142
+ },
143
+ "applicationId": {
144
+ "type": "string",
145
+ "pattern": "^[A-Fa-f\\d]{24}$"
146
+ }
147
+ }
148
+ }
@@ -0,0 +1,30 @@
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
+ "relayId": {
10
+ "type": "string"
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
+ "required": [
27
+ "data"
28
+ ],
29
+ "additionalProperties": false
30
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "array",
4
+ "items": {
5
+ "title": "Device State",
6
+ "description": "Schema for a single Device state",
7
+ "type": "object",
8
+ "properties": {
9
+ "time": {
10
+ "type": "string",
11
+ "format": "date-time"
12
+ },
13
+ "relayId": {
14
+ "type": "string"
15
+ },
16
+ "data": {
17
+ "type": "object",
18
+ "patternProperties": {
19
+ "^[0-9a-zA-Z_-]{1,255}$": {
20
+ "type": [
21
+ "number",
22
+ "string",
23
+ "boolean"
24
+ ]
25
+ }
26
+ },
27
+ "additionalProperties": false
28
+ }
29
+ },
30
+ "required": [
31
+ "data"
32
+ ],
33
+ "additionalProperties": false
34
+ }
35
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "array",
4
+ "items": {
5
+ "type": "object",
6
+ "properties": {
7
+ "key": {
8
+ "type": "string",
9
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
10
+ },
11
+ "value": {
12
+ "type": "string",
13
+ "minLength": 1,
14
+ "maxLength": 255
15
+ }
16
+ },
17
+ "additionalProperties": false
18
+ }
19
+ }
@@ -0,0 +1,155 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "items": {
6
+ "type": "array",
7
+ "items": {
8
+ "title": "Device",
9
+ "description": "Schema for a single Device",
10
+ "type": "object",
11
+ "properties": {
12
+ "id": {
13
+ "type": "string",
14
+ "pattern": "^[A-Fa-f\\d]{24}$"
15
+ },
16
+ "deviceId": {
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
+ "tags": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "object",
45
+ "properties": {
46
+ "key": {
47
+ "type": "string",
48
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
49
+ },
50
+ "value": {
51
+ "type": "string",
52
+ "minLength": 1,
53
+ "maxLength": 255
54
+ }
55
+ },
56
+ "required": [
57
+ "key",
58
+ "value"
59
+ ],
60
+ "additionalProperties": false
61
+ }
62
+ },
63
+ "attributes": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "object",
67
+ "properties": {
68
+ "name": {
69
+ "type": "string",
70
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
71
+ },
72
+ "dataType": {
73
+ "type": "string",
74
+ "enum": [
75
+ "string",
76
+ "number",
77
+ "gps",
78
+ "boolean"
79
+ ]
80
+ }
81
+ },
82
+ "required": [
83
+ "name",
84
+ "dataType"
85
+ ],
86
+ "additionalProperties": false
87
+ }
88
+ },
89
+ "deviceClass": {
90
+ "type": "string",
91
+ "enum": [
92
+ "standalone",
93
+ "master",
94
+ "owned",
95
+ "floating",
96
+ "virtual"
97
+ ]
98
+ },
99
+ "masterId": {
100
+ "type": "string",
101
+ "pattern": "^[A-Fa-f\\d]{24}$"
102
+ },
103
+ "connectionInfo": {
104
+ "type": "object",
105
+ "properties": {
106
+ "time": {
107
+ "type": "string",
108
+ "format": "date-time"
109
+ },
110
+ "connected": {
111
+ "enum": [
112
+ 1,
113
+ 0,
114
+ null
115
+ ]
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ },
122
+ "count": {
123
+ "type": "integer"
124
+ },
125
+ "totalCount": {
126
+ "type": "integer"
127
+ },
128
+ "perPage": {
129
+ "type": "integer"
130
+ },
131
+ "page": {
132
+ "type": "integer"
133
+ },
134
+ "filter": {
135
+ "type": "string"
136
+ },
137
+ "filterField": {
138
+ "type": "string"
139
+ },
140
+ "sortField": {
141
+ "type": "string"
142
+ },
143
+ "sortDirection": {
144
+ "type": "string",
145
+ "enum": [
146
+ "asc",
147
+ "desc"
148
+ ]
149
+ },
150
+ "applicationId": {
151
+ "type": "string",
152
+ "pattern": "^[A-Fa-f\\d]{24}$"
153
+ }
154
+ }
155
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "twoFactorCode": {
6
+ "type": "string",
7
+ "maxLength": 2048
8
+ },
9
+ "password": {
10
+ "type": "string",
11
+ "minLength": 8,
12
+ "maxLength": 2048
13
+ }
14
+ },
15
+ "required": [
16
+ "password",
17
+ "twoFactorCode"
18
+ ],
19
+ "additionalProperties": false
20
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "twoFactorAuthKey": {
6
+ "type": "string",
7
+ "minLength": 52,
8
+ "maxLength": 52
9
+ },
10
+ "password": {
11
+ "type": "string",
12
+ "minLength": 8,
13
+ "maxLength": 2048
14
+ }
15
+ },
16
+ "required": [
17
+ "password",
18
+ "twoFactorAuthKey"
19
+ ],
20
+ "additionalProperties": false
21
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "type": {
6
+ "type": "string"
7
+ },
8
+ "message": {
9
+ "type": "string"
10
+ }
11
+ }
12
+ }