losant_rest 1.0.3 → 1.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d4984ce6e897781e101ef6a2b3ced5ef16aacbd
4
- data.tar.gz: 864fe05a7e6190cbc4dd30d20ef780657407ae90
3
+ metadata.gz: f34146e8bcd43a84f034b934b1b92d02a9f333b9
4
+ data.tar.gz: 64e00d60d94fef39a63f6f2f24bd200e99a9d0d0
5
5
  SHA512:
6
- metadata.gz: 7df3f9e14c6fa970baa3133f9a5c5bdc9918bb7d051da7a0f5ed26b58bd5bd20e1b3c6b199f0364404029e49315f7c979fc825363e1a3ce7fb17838b588dad41
7
- data.tar.gz: da6d8dbda68b947a5d5e5b706439819ced07073a2a11f556ef87f14348a0ccd480244c967e3477d3552e2476049b1ebe9bf69513a6dd8dfd109c3e4b48e9bc76
6
+ metadata.gz: 9da52f3b2c492f063a14b6da89a6a935b2a5e45c0fb7ac73c0ad23da75d48b99b4ea1b9cf92713fdb09f4cc2e5e405bf828c58ba176ac05cf58aeb737ade96c8
7
+ data.tar.gz: a3c8023a2c5e620758939251c902c70b11d292c3afa05f35f60c590d54c3dbad5a96d9ffbd209d7d56ce7b4201c0d3088c146078f0eb45737d84506f974cf478
data/docs/_schemas.md CHANGED
@@ -32,7 +32,7 @@
32
32
  * [Device Recipe Patch](#device-recipe-patch)
33
33
  * [Device Recipe Post](#device-recipe-post)
34
34
  * [Device Recipes](#device-recipes)
35
- * [Device State](#device-state)
35
+ * [Single or Multiple Device States](#single-or-multiple-device-states)
36
36
  * [Device States](#device-states)
37
37
  * [Device Tag Filter](#device-tag-filter)
38
38
  * [Devices](#devices)
@@ -63,6 +63,7 @@
63
63
  * [Organization Patch](#organization-patch)
64
64
  * [Organization Post](#organization-post)
65
65
  * [Organizations](#organizations)
66
+ * [Payload Counts](#payload-counts)
66
67
  * [Recent Item](#recent-item)
67
68
  * [Recent Item List](#recent-item-list)
68
69
  * [Solution](#solution)
@@ -2903,46 +2904,89 @@ Schema for a collection of Device Recipes
2903
2904
 
2904
2905
  <br/>
2905
2906
 
2906
- ## Device State
2907
+ ## Single or Multiple Device States
2907
2908
 
2908
- Schema for a single Device state
2909
+ Schema for a single device state or an array of device states
2909
2910
 
2910
- ### <a name="device-state-schema"></a> Schema
2911
+ ### <a name="single-or-multiple-device-states-schema"></a> Schema
2911
2912
 
2912
2913
  ```json
2913
2914
  {
2914
2915
  "$schema": "http://json-schema.org/draft-04/schema#",
2915
- "type": "object",
2916
- "properties": {
2917
- "time": {
2918
- "type": "string",
2919
- "format": "date-time"
2920
- },
2921
- "relayId": {
2922
- "type": "string"
2923
- },
2924
- "meta": {},
2925
- "data": {
2916
+ "oneOf": [
2917
+ {
2918
+ "title": "Device State",
2919
+ "description": "Schema for a single Device state",
2926
2920
  "type": "object",
2927
- "patternProperties": {
2928
- "^[0-9a-zA-Z_-]{1,255}$": {
2929
- "type": [
2930
- "number",
2931
- "string",
2932
- "boolean"
2933
- ]
2921
+ "properties": {
2922
+ "time": {
2923
+ "type": "string",
2924
+ "format": "date-time"
2925
+ },
2926
+ "relayId": {
2927
+ "type": "string"
2928
+ },
2929
+ "meta": {},
2930
+ "data": {
2931
+ "type": "object",
2932
+ "patternProperties": {
2933
+ "^[0-9a-zA-Z_-]{1,255}$": {
2934
+ "type": [
2935
+ "number",
2936
+ "string",
2937
+ "boolean"
2938
+ ]
2939
+ }
2940
+ },
2941
+ "additionalProperties": false
2934
2942
  }
2935
2943
  },
2944
+ "required": [
2945
+ "data"
2946
+ ],
2936
2947
  "additionalProperties": false
2948
+ },
2949
+ {
2950
+ "title": "Device States",
2951
+ "description": "Schema for an array of Device states",
2952
+ "type": "array",
2953
+ "items": {
2954
+ "title": "Device State",
2955
+ "description": "Schema for a single Device state",
2956
+ "type": "object",
2957
+ "properties": {
2958
+ "time": {
2959
+ "type": "string",
2960
+ "format": "date-time"
2961
+ },
2962
+ "relayId": {
2963
+ "type": "string"
2964
+ },
2965
+ "meta": {},
2966
+ "data": {
2967
+ "type": "object",
2968
+ "patternProperties": {
2969
+ "^[0-9a-zA-Z_-]{1,255}$": {
2970
+ "type": [
2971
+ "number",
2972
+ "string",
2973
+ "boolean"
2974
+ ]
2975
+ }
2976
+ },
2977
+ "additionalProperties": false
2978
+ }
2979
+ },
2980
+ "required": [
2981
+ "data"
2982
+ ],
2983
+ "additionalProperties": false
2984
+ }
2937
2985
  }
2938
- },
2939
- "required": [
2940
- "data"
2941
- ],
2942
- "additionalProperties": false
2986
+ ]
2943
2987
  }
2944
2988
  ```
2945
- ### <a name="device-state-example"></a> Example
2989
+ ### <a name="single-or-multiple-device-states-example"></a> Example
2946
2990
 
2947
2991
  ```json
2948
2992
  {
@@ -3003,6 +3047,12 @@ Schema for an array of Device states
3003
3047
 
3004
3048
  ```json
3005
3049
  [
3050
+ {
3051
+ "time": "2016-06-13T04:00:00.000Z",
3052
+ "data": {
3053
+ "voltage": 22.4
3054
+ }
3055
+ },
3006
3056
  {
3007
3057
  "time": "2016-06-13T04:00:00.000Z",
3008
3058
  "data": {
@@ -4870,8 +4920,26 @@ Schema for information about the currently authenticated user
4870
4920
  "application": {
4871
4921
  "type": "number"
4872
4922
  },
4923
+ "applicationkey": {
4924
+ "type": "number"
4925
+ },
4873
4926
  "dashboard": {
4874
4927
  "type": "number"
4928
+ },
4929
+ "device": {
4930
+ "type": "number"
4931
+ },
4932
+ "devicerecipe": {
4933
+ "type": "number"
4934
+ },
4935
+ "flow": {
4936
+ "type": "number"
4937
+ },
4938
+ "webhook": {
4939
+ "type": "number"
4940
+ },
4941
+ "dataTTL": {
4942
+ "type": "number"
4875
4943
  }
4876
4944
  },
4877
4945
  "recentDashboards": {
@@ -4948,7 +5016,6 @@ Schema for information about the currently authenticated user
4948
5016
  }
4949
5017
  }
4950
5018
  },
4951
- "defaults": {},
4952
5019
  "summary": {
4953
5020
  "type": "object",
4954
5021
  "properties": {
@@ -4960,6 +5027,24 @@ Schema for information about the currently authenticated user
4960
5027
  },
4961
5028
  "orgCount": {
4962
5029
  "type": "number"
5030
+ },
5031
+ "deviceCount": {
5032
+ "type": "number"
5033
+ },
5034
+ "flowCount": {
5035
+ "type": "number"
5036
+ },
5037
+ "webhookCount": {
5038
+ "type": "number"
5039
+ },
5040
+ "keyCount": {
5041
+ "type": "number"
5042
+ },
5043
+ "eventCount": {
5044
+ "type": "number"
5045
+ },
5046
+ "deviceRecipeCount": {
5047
+ "type": "number"
4963
5048
  }
4964
5049
  }
4965
5050
  }
@@ -4986,7 +5071,12 @@ Schema for information about the currently authenticated user
4986
5071
  "summary": {
4987
5072
  "appCount": 8,
4988
5073
  "dashCount": 5,
4989
- "orgCount": 2
5074
+ "orgCount": 2,
5075
+ "deviceCount": 12,
5076
+ "flowCount": 3,
5077
+ "webhookCount": 0,
5078
+ "keyCount": 2,
5079
+ "deviceRecipeCount": 0
4990
5080
  }
4991
5081
  }
4992
5082
  ```
@@ -5214,6 +5304,35 @@ Schema for a single Organization
5214
5304
  }
5215
5305
  }
5216
5306
  },
5307
+ "limits": {
5308
+ "application": {
5309
+ "type": "number"
5310
+ },
5311
+ "applicationkey": {
5312
+ "type": "number"
5313
+ },
5314
+ "dashboard": {
5315
+ "type": "number"
5316
+ },
5317
+ "device": {
5318
+ "type": "number"
5319
+ },
5320
+ "devicerecipe": {
5321
+ "type": "number"
5322
+ },
5323
+ "flow": {
5324
+ "type": "number"
5325
+ },
5326
+ "solution": {
5327
+ "type": "number"
5328
+ },
5329
+ "webhook": {
5330
+ "type": "number"
5331
+ },
5332
+ "dataTTL": {
5333
+ "type": "number"
5334
+ }
5335
+ },
5217
5336
  "summary": {
5218
5337
  "type": "object",
5219
5338
  "properties": {
@@ -5222,6 +5341,27 @@ Schema for a single Organization
5222
5341
  },
5223
5342
  "dashCount": {
5224
5343
  "type": "number"
5344
+ },
5345
+ "solutionCount": {
5346
+ "type": "number"
5347
+ },
5348
+ "deviceCount": {
5349
+ "type": "number"
5350
+ },
5351
+ "flowCount": {
5352
+ "type": "number"
5353
+ },
5354
+ "webhookCount": {
5355
+ "type": "number"
5356
+ },
5357
+ "keyCount": {
5358
+ "type": "number"
5359
+ },
5360
+ "eventCount": {
5361
+ "type": "number"
5362
+ },
5363
+ "deviceRecipeCount": {
5364
+ "type": "number"
5225
5365
  }
5226
5366
  }
5227
5367
  }
@@ -5256,7 +5396,13 @@ Schema for a single Organization
5256
5396
  ],
5257
5397
  "summary": {
5258
5398
  "appCount": 2,
5259
- "dashCount": 1
5399
+ "dashCount": 1,
5400
+ "solutionCount": 0,
5401
+ "deviceCount": 12,
5402
+ "flowCount": 3,
5403
+ "webhookCount": 0,
5404
+ "keyCount": 2,
5405
+ "deviceRecipeCount": 0
5260
5406
  }
5261
5407
  }
5262
5408
  ```
@@ -5567,6 +5713,35 @@ Schema for a collection of Organizations
5567
5713
  }
5568
5714
  }
5569
5715
  },
5716
+ "limits": {
5717
+ "application": {
5718
+ "type": "number"
5719
+ },
5720
+ "applicationkey": {
5721
+ "type": "number"
5722
+ },
5723
+ "dashboard": {
5724
+ "type": "number"
5725
+ },
5726
+ "device": {
5727
+ "type": "number"
5728
+ },
5729
+ "devicerecipe": {
5730
+ "type": "number"
5731
+ },
5732
+ "flow": {
5733
+ "type": "number"
5734
+ },
5735
+ "solution": {
5736
+ "type": "number"
5737
+ },
5738
+ "webhook": {
5739
+ "type": "number"
5740
+ },
5741
+ "dataTTL": {
5742
+ "type": "number"
5743
+ }
5744
+ },
5570
5745
  "summary": {
5571
5746
  "type": "object",
5572
5747
  "properties": {
@@ -5575,6 +5750,27 @@ Schema for a collection of Organizations
5575
5750
  },
5576
5751
  "dashCount": {
5577
5752
  "type": "number"
5753
+ },
5754
+ "solutionCount": {
5755
+ "type": "number"
5756
+ },
5757
+ "deviceCount": {
5758
+ "type": "number"
5759
+ },
5760
+ "flowCount": {
5761
+ "type": "number"
5762
+ },
5763
+ "webhookCount": {
5764
+ "type": "number"
5765
+ },
5766
+ "keyCount": {
5767
+ "type": "number"
5768
+ },
5769
+ "eventCount": {
5770
+ "type": "number"
5771
+ },
5772
+ "deviceRecipeCount": {
5773
+ "type": "number"
5578
5774
  }
5579
5775
  }
5580
5776
  }
@@ -5642,7 +5838,13 @@ Schema for a collection of Organizations
5642
5838
  ],
5643
5839
  "summary": {
5644
5840
  "appCount": 2,
5645
- "dashCount": 1
5841
+ "dashCount": 1,
5842
+ "solutionCount": 0,
5843
+ "deviceCount": 12,
5844
+ "flowCount": 3,
5845
+ "webhookCount": 0,
5846
+ "keyCount": 2,
5847
+ "deviceRecipeCount": 0
5646
5848
  }
5647
5849
  }
5648
5850
  ],
@@ -5657,6 +5859,128 @@ Schema for a collection of Organizations
5657
5859
 
5658
5860
  <br/>
5659
5861
 
5862
+ ## Payload Counts
5863
+
5864
+ Schema the result of a payload count request
5865
+
5866
+ ### <a name="payload-counts-schema"></a> Schema
5867
+
5868
+ ```json
5869
+ {
5870
+ "$schema": "http://json-schema.org/draft-04/schema#",
5871
+ "type": "object",
5872
+ "properties": {
5873
+ "mqttOut": {
5874
+ "type": "object",
5875
+ "patternProperties": {
5876
+ ".*": {
5877
+ "type": "number"
5878
+ }
5879
+ }
5880
+ },
5881
+ "mqttIn": {
5882
+ "type": "object",
5883
+ "patternProperties": {
5884
+ ".*": {
5885
+ "type": "number"
5886
+ }
5887
+ }
5888
+ },
5889
+ "deviceState": {
5890
+ "type": "object",
5891
+ "patternProperties": {
5892
+ ".*": {
5893
+ "type": "number"
5894
+ }
5895
+ }
5896
+ },
5897
+ "deviceCommand": {
5898
+ "type": "object",
5899
+ "patternProperties": {
5900
+ ".*": {
5901
+ "type": "number"
5902
+ }
5903
+ }
5904
+ },
5905
+ "webhook": {
5906
+ "type": "object",
5907
+ "patternProperties": {
5908
+ ".*": {
5909
+ "type": "number"
5910
+ }
5911
+ }
5912
+ },
5913
+ "timer": {
5914
+ "type": "object",
5915
+ "patternProperties": {
5916
+ ".*": {
5917
+ "type": "number"
5918
+ }
5919
+ }
5920
+ },
5921
+ "event": {
5922
+ "type": "object",
5923
+ "patternProperties": {
5924
+ ".*": {
5925
+ "type": "number"
5926
+ }
5927
+ }
5928
+ },
5929
+ "virtualButton": {
5930
+ "type": "object",
5931
+ "patternProperties": {
5932
+ ".*": {
5933
+ "type": "number"
5934
+ }
5935
+ }
5936
+ },
5937
+ "deviceConnect": {
5938
+ "type": "object",
5939
+ "patternProperties": {
5940
+ ".*": {
5941
+ "type": "number"
5942
+ }
5943
+ }
5944
+ },
5945
+ "deviceDisconnect": {
5946
+ "type": "object",
5947
+ "patternProperties": {
5948
+ ".*": {
5949
+ "type": "number"
5950
+ }
5951
+ }
5952
+ }
5953
+ }
5954
+ }
5955
+ ```
5956
+ ### <a name="payload-counts-example"></a> Example
5957
+
5958
+ ```json
5959
+ {
5960
+ "timer": {
5961
+ "timer.flow": 19772
5962
+ },
5963
+ "deviceState": {
5964
+ "flow.flow": 5215,
5965
+ "device.mqtt": 1244049
5966
+ },
5967
+ "mqttOut": {
5968
+ "device.mqtt": 12
5969
+ },
5970
+ "webhook": {
5971
+ "public.rest": 1713284
5972
+ },
5973
+ "deviceConnect": {
5974
+ "device.mqtt": 1016
5975
+ },
5976
+ "deviceDisconnect": {
5977
+ "device.mqtt": 1016
5978
+ }
5979
+ }
5980
+ ```
5981
+
5982
+ <br/>
5983
+
5660
5984
  ## Recent Item
5661
5985
 
5662
5986
  Schema for the body of a request to add a recent item
data/docs/application.md CHANGED
@@ -9,6 +9,7 @@ parameters and the potential responses.
9
9
  * [Delete](#delete)
10
10
  * [Get](#get)
11
11
  * [Patch](#patch)
12
+ * [Payload Counts](#payload-counts)
12
13
 
13
14
  <br/>
14
15
 
@@ -105,3 +106,36 @@ puts result
105
106
  | ---- | ---- | ----------- |
106
107
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
107
108
  | 404 | [Error](_schemas.md#error) | Error if application was not found |
109
+
110
+ <br/>
111
+
112
+ ## Payload Counts
113
+
114
+ Returns payload counts for the time range specified for this application
115
+
116
+ ```ruby
117
+ result = client.application.payload_counts(applicationId: my_application_id)
118
+
119
+ puts result
120
+ ```
121
+
122
+ #### Available Parameters
123
+
124
+ | Name | Type | Required | Description | Default | Example |
125
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
126
+ | applicationId | string | Y | ID of the associated application | | 575ec8687ae143cd83dc4a97 |
127
+ | start | string | N | Start of range for payload count query (ms since epoch) | -2592000000 | 0 |
128
+ | end | string | N | End of range for payload count query (ms since epoch) | 0 | 1465790400000 |
129
+
130
+ #### Successful Responses
131
+
132
+ | Code | Type | Description |
133
+ | ---- | ---- | ----------- |
134
+ | 200 | [Payload Counts](_schemas.md#payload-counts) | Payload counts, by type and source |
135
+
136
+ #### Error Responses
137
+
138
+ | Code | Type | Description |
139
+ | ---- | ---- | ----------- |
140
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
141
+ | 404 | [Error](_schemas.md#error) | Error if application was not found |
data/docs/device.md CHANGED
@@ -358,7 +358,7 @@ puts result
358
358
  | ---- | ---- | -------- | ----------- | ------- | ------- |
359
359
  | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
360
360
  | deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 |
361
- | deviceState | [Device State](_schemas.md#device-state) | Y | Object containing the current state of the device | | [Device State Example](_schemas.md#device-state-example) |
361
+ | deviceState | [Single or Multiple Device States](_schemas.md#single-or-multiple-device-states) | Y | A single device state object, or an array of device state objects | | [Single or Multiple Device States Example](_schemas.md#single-or-multiple-device-states-example) |
362
362
 
363
363
  #### Successful Responses
364
364
 
data/docs/events.md CHANGED
@@ -84,7 +84,7 @@ puts result
84
84
 
85
85
  ## Patch
86
86
 
87
- Updates information for matching events by subject and/or current state
87
+ Asynchronously updates information for matching events by subject and/or current state
88
88
 
89
89
  ```ruby
90
90
  result = client.events.patch(
@@ -108,7 +108,7 @@ puts result
108
108
 
109
109
  | Code | Type | Description |
110
110
  | ---- | ---- | ----------- |
111
- | 200 | [Success](_schemas.md#success) | If updates were successfully applied |
111
+ | 200 | [Success](_schemas.md#success) | If the bulk update has been successfully started |
112
112
 
113
113
  #### Error Responses
114
114
 
data/docs/me.md CHANGED
@@ -15,6 +15,7 @@ parameters and the potential responses.
15
15
  * [Fetch Recent Items](#fetch-recent-items)
16
16
  * [Get](#get)
17
17
  * [Patch](#patch)
18
+ * [Payload Counts](#payload-counts)
18
19
  * [Verify Email](#verify-email)
19
20
 
20
21
  <br/>
@@ -285,6 +286,38 @@ puts result
285
286
 
286
287
  <br/>
287
288
 
289
+ ## Payload Counts
290
+
291
+ Returns payload counts for the time range specified for all applications the current user owns
292
+
293
+ ```ruby
294
+ result = client.me.payload_counts(optional_params)
295
+
296
+ puts result
297
+ ```
298
+
299
+ #### Available Parameters
300
+
301
+ | Name | Type | Required | Description | Default | Example |
302
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
303
+ | start | string | N | Start of range for payload count query (ms since epoch) | -2592000000 | 0 |
304
+ | end | string | N | End of range for payload count query (ms since epoch) | 0 | 1465790400000 |
305
+
306
+ #### Successful Responses
307
+
308
+ | Code | Type | Description |
309
+ | ---- | ---- | ----------- |
310
+ | 200 | [Payload Counts](_schemas.md#payload-counts) | Payload counts, by type and source |
311
+
312
+ #### Error Responses
313
+
314
+ | Code | Type | Description |
315
+ | ---- | ---- | ----------- |
316
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
317
+ | 404 | [Error](_schemas.md#error) | Error if application was not found |
318
+
319
+ <br/>
320
+
288
321
  ## Verify Email
289
322
 
290
323
  Sends an email verification to the user
data/docs/org.md CHANGED
@@ -11,6 +11,7 @@ parameters and the potential responses.
11
11
  * [Invite Member](#invite-member)
12
12
  * [Modify Member](#modify-member)
13
13
  * [Patch](#patch)
14
+ * [Payload Counts](#payload-counts)
14
15
  * [Pending Invites](#pending-invites)
15
16
  * [Remove Member](#remove-member)
16
17
  * [Revoke Invite](#revoke-invite)
@@ -181,6 +182,39 @@ puts result
181
182
 
182
183
  <br/>
183
184
 
185
+ ## Payload Counts
186
+
187
+ Returns payload counts for the time range specified for all applications this organization owns
188
+
189
+ ```ruby
190
+ result = client.org.payload_counts(orgId: my_org_id)
191
+
192
+ puts result
193
+ ```
194
+
195
+ #### Available Parameters
196
+
197
+ | Name | Type | Required | Description | Default | Example |
198
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
199
+ | orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
200
+ | start | string | N | Start of range for payload count query (ms since epoch) | -2592000000 | 0 |
201
+ | end | string | N | End of range for payload count query (ms since epoch) | 0 | 1465790400000 |
202
+
203
+ #### Successful Responses
204
+
205
+ | Code | Type | Description |
206
+ | ---- | ---- | ----------- |
207
+ | 200 | [Payload Counts](_schemas.md#payload-counts) | Payload counts, by type and source |
208
+
209
+ #### Error Responses
210
+
211
+ | Code | Type | Description |
212
+ | ---- | ---- | ----------- |
213
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
214
+ | 404 | [Error](_schemas.md#error) | Error if application was not found |
215
+
216
+ <br/>
217
+
184
218
  ## Pending Invites
185
219
 
186
220
  Gets the current pending invites
@@ -124,5 +124,47 @@ module LosantRest
124
124
  body: body)
125
125
  end
126
126
 
127
+ # Returns payload counts for the time range specified for this application
128
+ #
129
+ # Parameters:
130
+ # * {string} applicationId - ID of the associated application
131
+ # * {string} start - Start of range for payload count query (ms since epoch)
132
+ # * {string} end - End of range for payload count query (ms since epoch)
133
+ # * {string} losantdomain - Domain scope of request (rarely needed)
134
+ # * {boolean} _actions - Return resource actions in response
135
+ # * {boolean} _links - Return resource link in response
136
+ # * {boolean} _embedded - Return embedded resources in response
137
+ #
138
+ # Responses:
139
+ # * 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadCounts)
140
+ #
141
+ # Errors:
142
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
143
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
144
+ def payload_counts(params = {})
145
+ params = Utils.symbolize_hash_keys(params)
146
+ query_params = { _actions: false, _links: true, _embedded: true }
147
+ headers = {}
148
+ body = nil
149
+
150
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
151
+
152
+ query_params[:start] = params[:start] if params.has_key?(:start)
153
+ query_params[:end] = params[:end] if params.has_key?(:end)
154
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
155
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
156
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
157
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
158
+
159
+ path = "/applications/#{params[:applicationId]}/payloadCounts"
160
+
161
+ @client.request(
162
+ method: :get,
163
+ path: path,
164
+ query: query_params,
165
+ headers: headers,
166
+ body: body)
167
+ end
168
+
127
169
  end
128
170
  end
@@ -5,7 +5,7 @@ module LosantRest
5
5
  #
6
6
  # User API for accessing Losant data
7
7
  #
8
- # Built For Version 1.4.3
8
+ # Built For Version 1.4.9
9
9
  class Client
10
10
  attr_accessor :auth_token, :url
11
11
 
@@ -128,7 +128,7 @@ module LosantRest
128
128
 
129
129
  headers["Accept"] = "application/json"
130
130
  headers["Content-Type"] = "application/json"
131
- headers["Accept-Version"] = "^1.4.3"
131
+ headers["Accept-Version"] = "^1.4.9"
132
132
  headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
133
133
  path = self.url + options.fetch(:path, "")
134
134
 
@@ -398,7 +398,7 @@ module LosantRest
398
398
  # Parameters:
399
399
  # * {string} applicationId - ID associated with the application
400
400
  # * {string} deviceId - ID associated with the device
401
- # * {hash} deviceState - Object containing the current state of the device (https://api.losant.com/#/definitions/deviceState)
401
+ # * {hash} deviceState - A single device state object, or an array of device state objects (https://api.losant.com/#/definitions/deviceStateOrStates)
402
402
  # * {string} losantdomain - Domain scope of request (rarely needed)
403
403
  # * {boolean} _actions - Return resource actions in response
404
404
  # * {boolean} _links - Return resource link in response
@@ -98,7 +98,7 @@ module LosantRest
98
98
  body: body)
99
99
  end
100
100
 
101
- # Updates information for matching events by subject and/or current state
101
+ # Asynchronously updates information for matching events by subject and/or current state
102
102
  #
103
103
  # Parameters:
104
104
  # * {string} applicationId - ID associated with the application
@@ -112,7 +112,7 @@ module LosantRest
112
112
  # * {boolean} _embedded - Return embedded resources in response
113
113
  #
114
114
  # Responses:
115
- # * 200 - If updates were successfully applied (https://api.losant.com/#/definitions/success)
115
+ # * 200 - If the bulk update has been successfully started (https://api.losant.com/#/definitions/success)
116
116
  #
117
117
  # Errors:
118
118
  # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
@@ -343,6 +343,46 @@ module LosantRest
343
343
  body: body)
344
344
  end
345
345
 
346
+ # Returns payload counts for the time range specified for all applications the current user owns
347
+ #
348
+ # Parameters:
349
+ # * {string} start - Start of range for payload count query (ms since epoch)
350
+ # * {string} end - End of range for payload count query (ms since epoch)
351
+ # * {string} losantdomain - Domain scope of request (rarely needed)
352
+ # * {boolean} _actions - Return resource actions in response
353
+ # * {boolean} _links - Return resource link in response
354
+ # * {boolean} _embedded - Return embedded resources in response
355
+ #
356
+ # Responses:
357
+ # * 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadCounts)
358
+ #
359
+ # Errors:
360
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
361
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
362
+ def payload_counts(params = {})
363
+ params = Utils.symbolize_hash_keys(params)
364
+ query_params = { _actions: false, _links: true, _embedded: true }
365
+ headers = {}
366
+ body = nil
367
+
368
+
369
+ query_params[:start] = params[:start] if params.has_key?(:start)
370
+ query_params[:end] = params[:end] if params.has_key?(:end)
371
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
372
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
373
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
374
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
375
+
376
+ path = "/me/payloadCounts"
377
+
378
+ @client.request(
379
+ method: :get,
380
+ path: path,
381
+ query: query_params,
382
+ headers: headers,
383
+ body: body)
384
+ end
385
+
346
386
  # Sends an email verification to the user
347
387
  #
348
388
  # Parameters:
@@ -206,6 +206,48 @@ module LosantRest
206
206
  body: body)
207
207
  end
208
208
 
209
+ # Returns payload counts for the time range specified for all applications this organization owns
210
+ #
211
+ # Parameters:
212
+ # * {string} orgId - ID associated with the organization
213
+ # * {string} start - Start of range for payload count query (ms since epoch)
214
+ # * {string} end - End of range for payload count query (ms since epoch)
215
+ # * {string} losantdomain - Domain scope of request (rarely needed)
216
+ # * {boolean} _actions - Return resource actions in response
217
+ # * {boolean} _links - Return resource link in response
218
+ # * {boolean} _embedded - Return embedded resources in response
219
+ #
220
+ # Responses:
221
+ # * 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadCounts)
222
+ #
223
+ # Errors:
224
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
225
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
226
+ def payload_counts(params = {})
227
+ params = Utils.symbolize_hash_keys(params)
228
+ query_params = { _actions: false, _links: true, _embedded: true }
229
+ headers = {}
230
+ body = nil
231
+
232
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
233
+
234
+ query_params[:start] = params[:start] if params.has_key?(:start)
235
+ query_params[:end] = params[:end] if params.has_key?(:end)
236
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
237
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
238
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
239
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
240
+
241
+ path = "/orgs/#{params[:orgId]}/payloadCounts"
242
+
243
+ @client.request(
244
+ method: :get,
245
+ path: path,
246
+ query: query_params,
247
+ headers: headers,
248
+ body: body)
249
+ end
250
+
209
251
  # Gets the current pending invites
210
252
  #
211
253
  # Parameters:
@@ -1,3 +1,3 @@
1
1
  module LosantRest
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -0,0 +1,74 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "oneOf": [
4
+ {
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
+ "meta": {},
17
+ "data": {
18
+ "type": "object",
19
+ "patternProperties": {
20
+ "^[0-9a-zA-Z_-]{1,255}$": {
21
+ "type": [
22
+ "number",
23
+ "string",
24
+ "boolean"
25
+ ]
26
+ }
27
+ },
28
+ "additionalProperties": false
29
+ }
30
+ },
31
+ "required": [
32
+ "data"
33
+ ],
34
+ "additionalProperties": false
35
+ },
36
+ {
37
+ "title": "Device States",
38
+ "description": "Schema for an array of Device states",
39
+ "type": "array",
40
+ "items": {
41
+ "title": "Device State",
42
+ "description": "Schema for a single Device state",
43
+ "type": "object",
44
+ "properties": {
45
+ "time": {
46
+ "type": "string",
47
+ "format": "date-time"
48
+ },
49
+ "relayId": {
50
+ "type": "string"
51
+ },
52
+ "meta": {},
53
+ "data": {
54
+ "type": "object",
55
+ "patternProperties": {
56
+ "^[0-9a-zA-Z_-]{1,255}$": {
57
+ "type": [
58
+ "number",
59
+ "string",
60
+ "boolean"
61
+ ]
62
+ }
63
+ },
64
+ "additionalProperties": false
65
+ }
66
+ },
67
+ "required": [
68
+ "data"
69
+ ],
70
+ "additionalProperties": false
71
+ }
72
+ }
73
+ ]
74
+ }
data/schemas/me.json CHANGED
@@ -76,8 +76,26 @@
76
76
  "application": {
77
77
  "type": "number"
78
78
  },
79
+ "applicationkey": {
80
+ "type": "number"
81
+ },
79
82
  "dashboard": {
80
83
  "type": "number"
84
+ },
85
+ "device": {
86
+ "type": "number"
87
+ },
88
+ "devicerecipe": {
89
+ "type": "number"
90
+ },
91
+ "flow": {
92
+ "type": "number"
93
+ },
94
+ "webhook": {
95
+ "type": "number"
96
+ },
97
+ "dataTTL": {
98
+ "type": "number"
81
99
  }
82
100
  },
83
101
  "recentDashboards": {
@@ -154,7 +172,6 @@
154
172
  }
155
173
  }
156
174
  },
157
- "defaults": {},
158
175
  "summary": {
159
176
  "type": "object",
160
177
  "properties": {
@@ -166,6 +183,24 @@
166
183
  },
167
184
  "orgCount": {
168
185
  "type": "number"
186
+ },
187
+ "deviceCount": {
188
+ "type": "number"
189
+ },
190
+ "flowCount": {
191
+ "type": "number"
192
+ },
193
+ "webhookCount": {
194
+ "type": "number"
195
+ },
196
+ "keyCount": {
197
+ "type": "number"
198
+ },
199
+ "eventCount": {
200
+ "type": "number"
201
+ },
202
+ "deviceRecipeCount": {
203
+ "type": "number"
169
204
  }
170
205
  }
171
206
  }
data/schemas/org.json CHANGED
@@ -69,6 +69,35 @@
69
69
  }
70
70
  }
71
71
  },
72
+ "limits": {
73
+ "application": {
74
+ "type": "number"
75
+ },
76
+ "applicationkey": {
77
+ "type": "number"
78
+ },
79
+ "dashboard": {
80
+ "type": "number"
81
+ },
82
+ "device": {
83
+ "type": "number"
84
+ },
85
+ "devicerecipe": {
86
+ "type": "number"
87
+ },
88
+ "flow": {
89
+ "type": "number"
90
+ },
91
+ "solution": {
92
+ "type": "number"
93
+ },
94
+ "webhook": {
95
+ "type": "number"
96
+ },
97
+ "dataTTL": {
98
+ "type": "number"
99
+ }
100
+ },
72
101
  "summary": {
73
102
  "type": "object",
74
103
  "properties": {
@@ -77,6 +106,27 @@
77
106
  },
78
107
  "dashCount": {
79
108
  "type": "number"
109
+ },
110
+ "solutionCount": {
111
+ "type": "number"
112
+ },
113
+ "deviceCount": {
114
+ "type": "number"
115
+ },
116
+ "flowCount": {
117
+ "type": "number"
118
+ },
119
+ "webhookCount": {
120
+ "type": "number"
121
+ },
122
+ "keyCount": {
123
+ "type": "number"
124
+ },
125
+ "eventCount": {
126
+ "type": "number"
127
+ },
128
+ "deviceRecipeCount": {
129
+ "type": "number"
80
130
  }
81
131
  }
82
132
  }
data/schemas/orgs.json CHANGED
@@ -76,6 +76,35 @@
76
76
  }
77
77
  }
78
78
  },
79
+ "limits": {
80
+ "application": {
81
+ "type": "number"
82
+ },
83
+ "applicationkey": {
84
+ "type": "number"
85
+ },
86
+ "dashboard": {
87
+ "type": "number"
88
+ },
89
+ "device": {
90
+ "type": "number"
91
+ },
92
+ "devicerecipe": {
93
+ "type": "number"
94
+ },
95
+ "flow": {
96
+ "type": "number"
97
+ },
98
+ "solution": {
99
+ "type": "number"
100
+ },
101
+ "webhook": {
102
+ "type": "number"
103
+ },
104
+ "dataTTL": {
105
+ "type": "number"
106
+ }
107
+ },
79
108
  "summary": {
80
109
  "type": "object",
81
110
  "properties": {
@@ -84,6 +113,27 @@
84
113
  },
85
114
  "dashCount": {
86
115
  "type": "number"
116
+ },
117
+ "solutionCount": {
118
+ "type": "number"
119
+ },
120
+ "deviceCount": {
121
+ "type": "number"
122
+ },
123
+ "flowCount": {
124
+ "type": "number"
125
+ },
126
+ "webhookCount": {
127
+ "type": "number"
128
+ },
129
+ "keyCount": {
130
+ "type": "number"
131
+ },
132
+ "eventCount": {
133
+ "type": "number"
134
+ },
135
+ "deviceRecipeCount": {
136
+ "type": "number"
87
137
  }
88
138
  }
89
139
  }
@@ -0,0 +1,86 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "mqttOut": {
6
+ "type": "object",
7
+ "patternProperties": {
8
+ ".*": {
9
+ "type": "number"
10
+ }
11
+ }
12
+ },
13
+ "mqttIn": {
14
+ "type": "object",
15
+ "patternProperties": {
16
+ ".*": {
17
+ "type": "number"
18
+ }
19
+ }
20
+ },
21
+ "deviceState": {
22
+ "type": "object",
23
+ "patternProperties": {
24
+ ".*": {
25
+ "type": "number"
26
+ }
27
+ }
28
+ },
29
+ "deviceCommand": {
30
+ "type": "object",
31
+ "patternProperties": {
32
+ ".*": {
33
+ "type": "number"
34
+ }
35
+ }
36
+ },
37
+ "webhook": {
38
+ "type": "object",
39
+ "patternProperties": {
40
+ ".*": {
41
+ "type": "number"
42
+ }
43
+ }
44
+ },
45
+ "timer": {
46
+ "type": "object",
47
+ "patternProperties": {
48
+ ".*": {
49
+ "type": "number"
50
+ }
51
+ }
52
+ },
53
+ "event": {
54
+ "type": "object",
55
+ "patternProperties": {
56
+ ".*": {
57
+ "type": "number"
58
+ }
59
+ }
60
+ },
61
+ "virtualButton": {
62
+ "type": "object",
63
+ "patternProperties": {
64
+ ".*": {
65
+ "type": "number"
66
+ }
67
+ }
68
+ },
69
+ "deviceConnect": {
70
+ "type": "object",
71
+ "patternProperties": {
72
+ ".*": {
73
+ "type": "number"
74
+ }
75
+ }
76
+ },
77
+ "deviceDisconnect": {
78
+ "type": "object",
79
+ "patternProperties": {
80
+ ".*": {
81
+ "type": "number"
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: losant_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kuehl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -176,6 +176,7 @@ files:
176
176
  - schemas/deviceRecipePost.json
177
177
  - schemas/deviceRecipes.json
178
178
  - schemas/deviceState.json
179
+ - schemas/deviceStateOrStates.json
179
180
  - schemas/deviceStates.json
180
181
  - schemas/deviceTagFilter.json
181
182
  - schemas/devices.json
@@ -206,6 +207,7 @@ files:
206
207
  - schemas/orgPatch.json
207
208
  - schemas/orgPost.json
208
209
  - schemas/orgs.json
210
+ - schemas/payloadCounts.json
209
211
  - schemas/recentItem.json
210
212
  - schemas/recentItemList.json
211
213
  - schemas/solution.json