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
data/docs/org.md ADDED
@@ -0,0 +1,279 @@
1
+ # Org Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Org resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Delete](#delete)
10
+ * [Get](#get)
11
+ * [Invite Member](#invite-member)
12
+ * [Modify Member](#modify-member)
13
+ * [Patch](#patch)
14
+ * [Pending Invites](#pending-invites)
15
+ * [Remove Member](#remove-member)
16
+ * [Revoke Invite](#revoke-invite)
17
+
18
+ <br/>
19
+
20
+ ## Delete
21
+
22
+ Deletes an organization
23
+
24
+ ```ruby
25
+ result = client.org.delete(orgId: my_org_id)
26
+
27
+ puts result
28
+ ```
29
+
30
+ #### Available Parameters
31
+
32
+ | Name | Type | Required | Description | Default | Example |
33
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
34
+ | orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
35
+
36
+ #### Successful Responses
37
+
38
+ | Code | Type | Description |
39
+ | ---- | ---- | ----------- |
40
+ | 200 | [Success](_schemas.md#success) | If organization was successfully deleted |
41
+
42
+ #### Error Responses
43
+
44
+ | Code | Type | Description |
45
+ | ---- | ---- | ----------- |
46
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
47
+ | 404 | [Error](_schemas.md#error) | Error if organization was not found |
48
+
49
+ <br/>
50
+
51
+ ## Get
52
+
53
+ Retrieves information on an organization
54
+
55
+ ```ruby
56
+ result = client.org.get(orgId: my_org_id)
57
+
58
+ puts result
59
+ ```
60
+
61
+ #### Available Parameters
62
+
63
+ | Name | Type | Required | Description | Default | Example |
64
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
65
+ | orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
66
+
67
+ #### Successful Responses
68
+
69
+ | Code | Type | Description |
70
+ | ---- | ---- | ----------- |
71
+ | 200 | [Organization](_schemas.md#organization) | Organization information |
72
+
73
+ #### Error Responses
74
+
75
+ | Code | Type | Description |
76
+ | ---- | ---- | ----------- |
77
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
78
+ | 404 | [Error](_schemas.md#error) | Error if organization not found |
79
+
80
+ <br/>
81
+
82
+ ## Invite Member
83
+
84
+ Invites a person to an organization
85
+
86
+ ```ruby
87
+ result = client.org.invite_member(
88
+ orgId: my_org_id,
89
+ invite: my_invite)
90
+
91
+ puts result
92
+ ```
93
+
94
+ #### Available Parameters
95
+
96
+ | Name | Type | Required | Description | Default | Example |
97
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
98
+ | orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
99
+ | invite | [Organization Invitation Post](_schemas.md#organization-invitation-post) | Y | Object containing new invite info | | [Organization Invitation Post Example](_schemas.md#organization-invitation-post-example) |
100
+
101
+ #### Successful Responses
102
+
103
+ | Code | Type | Description |
104
+ | ---- | ---- | ----------- |
105
+ | 200 | [Organization Invitations](_schemas.md#organization-invitations) | Invitation information |
106
+
107
+ #### Error Responses
108
+
109
+ | Code | Type | Description |
110
+ | ---- | ---- | ----------- |
111
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
112
+ | 404 | [Error](_schemas.md#error) | Error if organization not found |
113
+
114
+ <br/>
115
+
116
+ ## Modify Member
117
+
118
+ Modifies a current org member&#x27;s role
119
+
120
+ ```ruby
121
+ result = client.org.modify_member(
122
+ orgId: my_org_id,
123
+ member: my_member)
124
+
125
+ puts result
126
+ ```
127
+
128
+ #### Available Parameters
129
+
130
+ | Name | Type | Required | Description | Default | Example |
131
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
132
+ | orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
133
+ | member | [Organization Member Patch](_schemas.md#organization-member-patch) | Y | Object containing new member pair | | [Organization Member Patch Example](_schemas.md#organization-member-patch-example) |
134
+
135
+ #### Successful Responses
136
+
137
+ | Code | Type | Description |
138
+ | ---- | ---- | ----------- |
139
+ | 200 | [Organization](_schemas.md#organization) | Updated organization information |
140
+
141
+ #### Error Responses
142
+
143
+ | Code | Type | Description |
144
+ | ---- | ---- | ----------- |
145
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
146
+ | 404 | [Error](_schemas.md#error) | Error if organization not found |
147
+
148
+ <br/>
149
+
150
+ ## Patch
151
+
152
+ Updates information about an organization
153
+
154
+ ```ruby
155
+ result = client.org.patch(
156
+ orgId: my_org_id,
157
+ organization: my_organization)
158
+
159
+ puts result
160
+ ```
161
+
162
+ #### Available Parameters
163
+
164
+ | Name | Type | Required | Description | Default | Example |
165
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
166
+ | orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
167
+ | organization | [Organization Patch](_schemas.md#organization-patch) | Y | Object containing new organization properties | | [Organization Patch Example](_schemas.md#organization-patch-example) |
168
+
169
+ #### Successful Responses
170
+
171
+ | Code | Type | Description |
172
+ | ---- | ---- | ----------- |
173
+ | 200 | [Organization](_schemas.md#organization) | Updated organization information |
174
+
175
+ #### Error Responses
176
+
177
+ | Code | Type | Description |
178
+ | ---- | ---- | ----------- |
179
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
180
+ | 404 | [Error](_schemas.md#error) | Error if organization was not found |
181
+
182
+ <br/>
183
+
184
+ ## Pending Invites
185
+
186
+ Gets the current pending invites
187
+
188
+ ```ruby
189
+ result = client.org.pending_invites(orgId: my_org_id)
190
+
191
+ puts result
192
+ ```
193
+
194
+ #### Available Parameters
195
+
196
+ | Name | Type | Required | Description | Default | Example |
197
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
198
+ | orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
199
+
200
+ #### Successful Responses
201
+
202
+ | Code | Type | Description |
203
+ | ---- | ---- | ----------- |
204
+ | 200 | [Organization Invitations](_schemas.md#organization-invitations) | Invitation information |
205
+
206
+ #### Error Responses
207
+
208
+ | Code | Type | Description |
209
+ | ---- | ---- | ----------- |
210
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
211
+ | 404 | [Error](_schemas.md#error) | Error if organization not found |
212
+
213
+ <br/>
214
+
215
+ ## Remove Member
216
+
217
+ Modifies a current org member&#x27;s role
218
+
219
+ ```ruby
220
+ result = client.org.remove_member(
221
+ orgId: my_org_id,
222
+ userId: my_user_id)
223
+
224
+ puts result
225
+ ```
226
+
227
+ #### Available Parameters
228
+
229
+ | Name | Type | Required | Description | Default | Example |
230
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
231
+ | orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
232
+ | userId | string | Y | Id of user to remove | | 575ed70c7ae143cd83dc4aa9 |
233
+
234
+ #### Successful Responses
235
+
236
+ | Code | Type | Description |
237
+ | ---- | ---- | ----------- |
238
+ | 200 | [Organization](_schemas.md#organization) | Updated organization information |
239
+
240
+ #### Error Responses
241
+
242
+ | Code | Type | Description |
243
+ | ---- | ---- | ----------- |
244
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
245
+ | 404 | [Error](_schemas.md#error) | Error if organization not found |
246
+
247
+ <br/>
248
+
249
+ ## Revoke Invite
250
+
251
+ Revokes an existing invite
252
+
253
+ ```ruby
254
+ result = client.org.revoke_invite(
255
+ orgId: my_org_id,
256
+ inviteId: my_invite_id)
257
+
258
+ puts result
259
+ ```
260
+
261
+ #### Available Parameters
262
+
263
+ | Name | Type | Required | Description | Default | Example |
264
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
265
+ | orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
266
+ | inviteId | string | Y | Id of invite to revoke | | 575ed71e7ae143cd83dc4aaa |
267
+
268
+ #### Successful Responses
269
+
270
+ | Code | Type | Description |
271
+ | ---- | ---- | ----------- |
272
+ | 200 | [Organization Invitations](_schemas.md#organization-invitations) | Invitation information |
273
+
274
+ #### Error Responses
275
+
276
+ | Code | Type | Description |
277
+ | ---- | ---- | ----------- |
278
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
279
+ | 404 | [Error](_schemas.md#error) | Error if organization not found |
data/docs/orgs.md ADDED
@@ -0,0 +1,75 @@
1
+ # Orgs Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Orgs resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Get](#get)
10
+ * [Post](#post)
11
+
12
+ <br/>
13
+
14
+ ## Get
15
+
16
+ Returns the organizations associated with the current user
17
+
18
+ ```ruby
19
+ result = client.orgs.get(optional_params)
20
+
21
+ puts result
22
+ ```
23
+
24
+ #### Available Parameters
25
+
26
+ | Name | Type | Required | Description | Default | Example |
27
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
28
+ | sortField | string | N | Field to sort the results by. Accepted values are: name, id, creationDate | name | name |
29
+ | sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
30
+ | page | string | N | Which page of results to return | 0 | 0 |
31
+ | perPage | string | N | How many items to return per page | 1000 | 10 |
32
+ | filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | name |
33
+ | filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*org |
34
+
35
+ #### Successful Responses
36
+
37
+ | Code | Type | Description |
38
+ | ---- | ---- | ----------- |
39
+ | 200 | [Organizations](_schemas.md#organizations) | Collection of organizations |
40
+
41
+ #### Error Responses
42
+
43
+ | Code | Type | Description |
44
+ | ---- | ---- | ----------- |
45
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
46
+
47
+ <br/>
48
+
49
+ ## Post
50
+
51
+ Create a new organization
52
+
53
+ ```ruby
54
+ result = client.orgs.post(organization: my_organization)
55
+
56
+ puts result
57
+ ```
58
+
59
+ #### Available Parameters
60
+
61
+ | Name | Type | Required | Description | Default | Example |
62
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
63
+ | organization | [Organization Post](_schemas.md#organization-post) | Y | New organization information | | [Organization Post Example](_schemas.md#organization-post-example) |
64
+
65
+ #### Successful Responses
66
+
67
+ | Code | Type | Description |
68
+ | ---- | ---- | ----------- |
69
+ | 201 | [Organization](_schemas.md#organization) | Successfully created organization |
70
+
71
+ #### Error Responses
72
+
73
+ | Code | Type | Description |
74
+ | ---- | ---- | ----------- |
75
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
data/docs/webhook.md ADDED
@@ -0,0 +1,115 @@
1
+ # Webhook Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Webhook resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Delete](#delete)
10
+ * [Get](#get)
11
+ * [Patch](#patch)
12
+
13
+ <br/>
14
+
15
+ ## Delete
16
+
17
+ Deletes a webhook
18
+
19
+ ```ruby
20
+ result = client.webhook.delete(
21
+ applicationId: my_application_id,
22
+ webhookId: my_webhook_id)
23
+
24
+ puts result
25
+ ```
26
+
27
+ #### Available Parameters
28
+
29
+ | Name | Type | Required | Description | Default | Example |
30
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
31
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
32
+ | webhookId | string | Y | ID associated with the webhook | | 575ed78e7ae143cd83dc4aab |
33
+
34
+ #### Successful Responses
35
+
36
+ | Code | Type | Description |
37
+ | ---- | ---- | ----------- |
38
+ | 200 | [Success](_schemas.md#success) | If webhook was successfully deleted |
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 webhook was not found |
46
+
47
+ <br/>
48
+
49
+ ## Get
50
+
51
+ Retrieves information on a webhook
52
+
53
+ ```ruby
54
+ result = client.webhook.get(
55
+ applicationId: my_application_id,
56
+ webhookId: my_webhook_id)
57
+
58
+ puts result
59
+ ```
60
+
61
+ #### Available Parameters
62
+
63
+ | Name | Type | Required | Description | Default | Example |
64
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
65
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
66
+ | webhookId | string | Y | ID associated with the webhook | | 575ed78e7ae143cd83dc4aab |
67
+
68
+ #### Successful Responses
69
+
70
+ | Code | Type | Description |
71
+ | ---- | ---- | ----------- |
72
+ | 200 | [Webhook](_schemas.md#webhook) | Webhook information |
73
+
74
+ #### Error Responses
75
+
76
+ | Code | Type | Description |
77
+ | ---- | ---- | ----------- |
78
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
79
+ | 404 | [Error](_schemas.md#error) | Error if webhook was not found |
80
+
81
+ <br/>
82
+
83
+ ## Patch
84
+
85
+ Updates information about a webhook
86
+
87
+ ```ruby
88
+ result = client.webhook.patch(
89
+ applicationId: my_application_id,
90
+ webhookId: my_webhook_id,
91
+ webhook: my_webhook)
92
+
93
+ puts result
94
+ ```
95
+
96
+ #### Available Parameters
97
+
98
+ | Name | Type | Required | Description | Default | Example |
99
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
100
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
101
+ | webhookId | string | Y | ID associated with the webhook | | 575ed78e7ae143cd83dc4aab |
102
+ | webhook | [Webhook Patch](_schemas.md#webhook-patch) | Y | Object containing new properties of the webhook | | [Webhook Patch Example](_schemas.md#webhook-patch-example) |
103
+
104
+ #### Successful Responses
105
+
106
+ | Code | Type | Description |
107
+ | ---- | ---- | ----------- |
108
+ | 200 | [Webhook](_schemas.md#webhook) | Updated webhook information |
109
+
110
+ #### Error Responses
111
+
112
+ | Code | Type | Description |
113
+ | ---- | ---- | ----------- |
114
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
115
+ | 404 | [Error](_schemas.md#error) | Error if webhook was not found |
data/docs/webhooks.md ADDED
@@ -0,0 +1,81 @@
1
+ # Webhooks Actions
2
+
3
+ Details on the various actions that can be performed on the
4
+ Webhooks resource, including the expected
5
+ parameters and the potential responses.
6
+
7
+ ##### Contents
8
+
9
+ * [Get](#get)
10
+ * [Post](#post)
11
+
12
+ <br/>
13
+
14
+ ## Get
15
+
16
+ Returns the webhooks for an application
17
+
18
+ ```ruby
19
+ result = client.webhooks.get(applicationId: my_application_id)
20
+
21
+ puts result
22
+ ```
23
+
24
+ #### Available Parameters
25
+
26
+ | Name | Type | Required | Description | Default | Example |
27
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
28
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
29
+ | sortField | string | N | Field to sort the results by. Accepted values are: name, id, creationDate | name | name |
30
+ | sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
31
+ | page | string | N | Which page of results to return | 0 | 0 |
32
+ | perPage | string | N | How many items to return per page | 1000 | 10 |
33
+ | filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | name |
34
+ | filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my*webhook |
35
+
36
+ #### Successful Responses
37
+
38
+ | Code | Type | Description |
39
+ | ---- | ---- | ----------- |
40
+ | 200 | [Webhooks](_schemas.md#webhooks) | Collection of webhooks |
41
+
42
+ #### Error Responses
43
+
44
+ | Code | Type | Description |
45
+ | ---- | ---- | ----------- |
46
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
47
+ | 404 | [Error](_schemas.md#error) | Error if application was not found |
48
+
49
+ <br/>
50
+
51
+ ## Post
52
+
53
+ Create a new webhook for an application
54
+
55
+ ```ruby
56
+ result = client.webhooks.post(
57
+ applicationId: my_application_id,
58
+ webhook: my_webhook)
59
+
60
+ puts result
61
+ ```
62
+
63
+ #### Available Parameters
64
+
65
+ | Name | Type | Required | Description | Default | Example |
66
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
67
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
68
+ | webhook | [Webhook Post](_schemas.md#webhook-post) | Y | New webhook information | | [Webhook Post Example](_schemas.md#webhook-post-example) |
69
+
70
+ #### Successful Responses
71
+
72
+ | Code | Type | Description |
73
+ | ---- | ---- | ----------- |
74
+ | 201 | [Webhook](_schemas.md#webhook) | Successfully created webhook |
75
+
76
+ #### Error Responses
77
+
78
+ | Code | Type | Description |
79
+ | ---- | ---- | ----------- |
80
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
81
+ | 404 | [Error](_schemas.md#error) | Error if application was not found |
data/examples/auth.rb ADDED
@@ -0,0 +1,32 @@
1
+ require "losant_rest"
2
+
3
+ client = LosantRest::Client.new
4
+
5
+ user_response = client.auth.authenticate_user(credentials: {
6
+ email: "example@losant.com",
7
+ password: "your_password"
8
+ })
9
+
10
+ puts user_response
11
+ # Example user result
12
+ # {
13
+ # "token" => "an auth token string",
14
+ # "userId" => "theUserId"
15
+ # }
16
+
17
+
18
+ device_response = client.auth.authenticate_device(credentials: {
19
+ deviceId: "myDeviceId",
20
+ key: "my_app_access_key",
21
+ secret: "my_app_access_secret"
22
+ })
23
+
24
+ puts device_response
25
+ # Example device result
26
+ # {
27
+ # "applicationId" => "myAppId",
28
+ # "token" => "an auth token string",
29
+ # "restricted" => false,
30
+ # "deviceId" => "myDeviceId",
31
+ # "deviceClass" => "standalone"
32
+ # }
@@ -0,0 +1,45 @@
1
+ require "losant_rest"
2
+
3
+ client = LosantRest::Client.new(auth_token: "my_token")
4
+ result = client.devices.get(applicationId: "myAppId")
5
+
6
+ puts result
7
+ # Example result
8
+ # {
9
+ # "count" => 1,
10
+ # "items" => [ {
11
+ # "deviceClass" => "standalone",
12
+ # "connectionInfo" => { "connected" => 0, "time" => "2016-06-01T17:16:02.324Z" },
13
+ # "name" => "Ruby Client Testing",
14
+ # "creationDate" => "2016-01-31T17:58:57.541Z",
15
+ # "lastUpdated" => "2016-05-31T14:47:32.288Z",
16
+ # "id" => "myDevId",
17
+ # "attributes" => [
18
+ # { "name" => "string", "dataType" => "string" },
19
+ # { "name" => "number", "dataType" => "number" },
20
+ # { "name" => "boolean", "dataType" => "boolean" }
21
+ # ],
22
+ # "description" => "",
23
+ # "_etag" => "\"174-u7/3je4oFyaKGePPbcHLqw\"",
24
+ # "deviceId" => "myDevId",
25
+ # "tags" => [],
26
+ # "applicationId" => "myAppId",
27
+ # "_type" => "device",
28
+ # "_links" => {
29
+ # "application" => { "href" => "/applications/myAppId" },
30
+ # "devices" => { "href" => "/applications/myAppId/devices" },
31
+ # "self" => { "href" => "/applications/myAppId/devices/myDevId" }
32
+ # }
33
+ # } ],
34
+ # "applicationId" => "myAppId",
35
+ # "perPage" => 100,
36
+ # "page" => 0,
37
+ # "sortField" => "name",
38
+ # "sortDirection" => "asc",
39
+ # "totalCount" => 1,
40
+ # "_type" => "devices",
41
+ # "_links" => {
42
+ # "application" => { "href" => "/applications/myAppId" },
43
+ # "self" => { "href" => "/applications/myAppId/devices" }
44
+ # }
45
+ # }