machineshop 0.0.3 → 0.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: 20e82d5fac370db4aa18d4c2d82836afd9bab0b8
4
- data.tar.gz: cf7d16a42671405c07cfc05a993091f2fdc72fff
3
+ metadata.gz: 5d54f636ead5b398e7076611d3aafa0fe4edacbd
4
+ data.tar.gz: 75a98f285a8c2b9b0d571e269e470048f869bbc5
5
5
  SHA512:
6
- metadata.gz: e8b764819235588e57f4b130a5c732aab825a2df6640a9cd12ed1fb01450f0bdfc70f946ae20ab4fcd423356e653ad42e701a18e2e10ecdaf7dc312a0a87cb7f
7
- data.tar.gz: 9da65ab7bff06efd10637bcb3d16ad815e7288261c0dbb3f2233aa8dda7a80c77d7b569654abd5ba2b75b11a3e9dd3b2019f198014df499843a8bd1f6ceae36d
6
+ metadata.gz: ffd6bca5ec40d674a5a7143e68b7307948427bba658e7c9a8597e52e182806dd6fb7fe67317c31b24873ca7e795e93c02121894c29ab4fa4ea1d48bf35108e21
7
+ data.tar.gz: 183d8bc7b1065c036d26cd89a371faddfb62c13246f9ae3015eea5f3db8805dc7ade18425403834d31fb30cddbcdaa239d34e41219bbe910f3a6264c00e51ca9
data/README.md CHANGED
@@ -20,6 +20,15 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
+ ### Setting client specific platform URL
24
+
25
+
26
+ > **Caution: Only If you have custom API endpoints**
27
+
28
+ MachineShop.api_base_url= 'http://stage.services.machineshop.io/api/v0/myClient'
29
+
30
+
31
+
23
32
  ### Authentication
24
33
  Allow a user to authenticate
25
34
 
@@ -28,16 +37,16 @@ Allow a user to authenticate
28
37
  :password => "password"
29
38
  )
30
39
 
31
- ---
40
+
32
41
  * ##### Http_method : Post
33
42
 
34
43
  * ##### Parameters :
35
44
  * email _string_
36
45
  * password _string_
37
46
 
38
- * ##### Response Example
47
+ ##### Response Example
48
+
39
49
 
40
- ----
41
50
  {
42
51
  "id" => "8e98188e981800aaef000001",
43
52
  "_id" => "8e98188e981800aaef000001",
@@ -62,24 +71,24 @@ Allow a user to authenticate
62
71
  "role" => "admin",
63
72
  "sign_in_count" => 234,
64
73
  "tag_ids" => [],
65
- "http_code" => 200
66
- }
74
+ "http_code" => 200}
67
75
 
68
76
  ### Get All user roles
69
77
  Get all the roles assigned to the current user
70
78
 
71
79
  MachineShop::User.all_roles(auth_token)
72
80
 
73
- ---
81
+
74
82
  * ##### Http_method : Get
75
83
 
76
84
  * ##### Parameters :
77
- * auth_token ___ _string_
85
+
86
+ * auth\_token: _string_
78
87
  > obtained from #authentication
79
88
 
80
- * ##### Response Example
89
+ ##### Response Example
90
+
81
91
 
82
- ----
83
92
  [
84
93
  "admin",
85
94
  "publisher",
@@ -92,18 +101,19 @@ Get User object to apply the following actions
92
101
  > user.update,
93
102
  > user.delete
94
103
 
95
-
96
104
  MachineShop::User.retrieve(user_id, auth_token)
97
105
 
98
- ---
99
106
  * ##### Http_method : Get
100
107
 
101
108
  * ##### Parameters :
102
109
  * auth\_token _string_
103
110
  * user\_id: _string_
104
- > available in response object from #authentication
111
+
112
+
113
+ > auth_token available in response object from #authentication
114
+
115
+ ##### Response Example
105
116
 
106
- * ##### Response Example
107
117
 
108
118
  > Same as from authenticate
109
119
 
@@ -115,7 +125,6 @@ Get User object to apply the following actions
115
125
  :per_page => 10},
116
126
  auth_token)
117
127
 
118
- ---
119
128
  * ##### Http_method : Get
120
129
 
121
130
  * ##### Parameters :
@@ -129,9 +138,8 @@ Get User object to apply the following actions
129
138
  > Number of items to display
130
139
  * auth\_token
131
140
 
132
- * ##### Response Example
141
+ ##### Response Example
133
142
 
134
- ----
135
143
 
136
144
  [{
137
145
  "id": "9584216470180077f7000157",
@@ -184,23 +192,23 @@ Get User object to apply the following actions
184
192
  "user_id": "11161696201800aaef0000459"} ]
185
193
 
186
194
 
187
-
195
+ ---
188
196
  ### Retrieve Device
189
197
 
190
198
  specificDevice = MachineShop::Device.retrieve(device_id, auth_token)
191
199
 
192
- ---
193
200
  * ##### Http_method : Get
194
201
 
195
202
  * ##### Parameters :
196
203
  * device\_id
204
+
197
205
  > device id
198
206
 
199
207
  * auth\_token
208
+
200
209
 
201
- * ##### Response Example
210
+ ##### Response Example
202
211
 
203
- ----
204
212
 
205
213
  {
206
214
  "id" => "51795428911800d51400016c",
@@ -229,6 +237,7 @@ Get User object to apply the following actions
229
237
  "user_id" => "11161696201800aaef000056",
230
238
  "http_code" => 200}
231
239
 
240
+ ---
232
241
 
233
242
  ### Create device instance for the device
234
243
 
@@ -238,16 +247,18 @@ Get User object to apply the following actions
238
247
  :active => "yes"
239
248
  }
240
249
 
241
- ---
250
+
251
+
242
252
  * ##### Http_method : Post
243
253
 
244
254
  * ##### Parameters :
245
255
  * name
246
256
  * active
247
257
 
248
- * ##### Response Example
258
+ ##### Response Example
259
+
260
+
249
261
 
250
- ----
251
262
 
252
263
  {
253
264
  "id" => "30048840211800a9c600000c",
@@ -287,7 +298,7 @@ Create a new device
287
298
  :image_url => "http://someurl.com/your_image.png",
288
299
  :manual_url => "http://someurl.com/manual.pdf"},auth_token)
289
300
 
290
- ---
301
+
291
302
 
292
303
  * Http_method : Post
293
304
 
@@ -301,13 +312,14 @@ Create a new device
301
312
  }
302
313
  )
303
314
 
315
+ ---
304
316
 
305
317
  ### Get the device instances
306
318
  Get all the device instances of the user
307
319
 
308
320
  MachineShop::DeviceInstance.all({:name => "instance_name"}, auth_token)
309
321
 
310
- ---
322
+
311
323
  > Pass first parameter as empty array if no filters to be applied
312
324
 
313
325
  * ##### Http_method : Get
@@ -318,9 +330,8 @@ Get all the device instances of the user
318
330
 
319
331
  * * name
320
332
 
321
- * ##### Response Example
333
+ ##### Response Example
322
334
 
323
- ----
324
335
 
325
336
  {
326
337
  "id" => "51795428911800d51400016c",
@@ -362,6 +373,7 @@ or without filters
362
373
  > where specficiDevice is the object from retrieve
363
374
 
364
375
 
376
+ ---
365
377
 
366
378
  ### Create Customers
367
379
 
@@ -375,7 +387,7 @@ or without filters
375
387
 
376
388
  },auth_token)
377
389
 
378
- ---
390
+
379
391
  * ##### Http_method : Post
380
392
 
381
393
  * ##### Parameters
@@ -383,9 +395,9 @@ or without filters
383
395
  * Post parameters: _array of params_
384
396
  * auth_token
385
397
 
386
- * ##### Response Example
398
+ ##### Response Example
399
+
387
400
 
388
- ----
389
401
 
390
402
  {
391
403
  "id" => "958421647080007a004506b",
@@ -417,7 +429,7 @@ Retrieve customer by Id
417
429
 
418
430
  retrievedCustomer = MachineShop::Customer.retrieve(customer_id, auth_token)
419
431
 
420
- ---
432
+
421
433
  * ##### Http_method : Get
422
434
 
423
435
  * ##### Parameters
@@ -425,9 +437,10 @@ Retrieve customer by Id
425
437
  * customer\_id _string_
426
438
  * auth_token
427
439
 
428
- * ##### Response Example
440
+ ##### Response Example
441
+
442
+
429
443
 
430
- ----
431
444
  same as above
432
445
 
433
446
  ----
@@ -438,7 +451,7 @@ Retrieve customer by Id
438
451
  MachineShop::Customer.update(customer_id,auth_token,{:notification_method => 'email'})
439
452
 
440
453
 
441
- ---
454
+
442
455
  * ##### Http_method : Put
443
456
 
444
457
  * ##### Parameters
@@ -447,9 +460,9 @@ Retrieve customer by Id
447
460
  * update parameters: _array of params_
448
461
  * auth_token
449
462
 
450
- * ##### Response Example
463
+ ##### Response Example
464
+
451
465
 
452
- ----
453
466
 
454
467
  {
455
468
  "id": "958421647080007a004506b",
@@ -477,32 +490,34 @@ Retrieve customer by Id
477
490
  retrieved_cust.update({:notification_method => 'email'})
478
491
 
479
492
 
493
+ ---
480
494
  ### Delete Customer
481
495
  Delete the Customer
482
496
 
483
497
  retrievedCustomer.delete
484
498
 
485
- ---
499
+
486
500
  > retrievedCustomer is the retrieved customer object
487
501
 
488
502
  * ##### Http_method : delete
489
503
 
490
504
 
491
- * ##### Response Example
505
+ ##### Response Example
506
+
492
507
 
493
- ----
494
508
 
495
509
  {"http_code":200,"deleted":true}
496
510
 
497
511
 
512
+ ---
498
513
 
499
514
  ### List rules
500
515
  List all the rules of user
501
516
 
502
517
  MachineShop::Rule.all({},auth_token)
503
518
 
504
- ---
505
- > Filter parameters else empty array
519
+
520
+ > First parameters is filters or empty array should be provided
506
521
 
507
522
  * ##### Http_method : Get
508
523
 
@@ -511,9 +526,9 @@ List all the rules of user
511
526
  * filter parameters: _array of params_
512
527
  * auth_token
513
528
 
514
- * ##### Response Example
529
+ ##### Response Example
530
+
515
531
 
516
- ----
517
532
 
518
533
  {
519
534
  "id": "958421647080007a004506b",
@@ -587,9 +602,9 @@ Create a rule
587
602
  * create parameter: _json array of params_
588
603
  * auth_token
589
604
 
590
- * ##### Response Example
605
+ ##### Response Example
606
+
591
607
 
592
- ----
593
608
 
594
609
  {
595
610
  "id" => "5395b245385f7fe266000037",
@@ -626,7 +641,7 @@ Create a rule
626
641
 
627
642
 
628
643
  ### Retrieve Rule
629
- specificRule = MachineShop::Rule.retrieve("rule_id",auth_token)
644
+ specificRule = MachineShop::Rule.retrieve(rule_id,auth_token)
630
645
 
631
646
  * ##### Http_method : Get
632
647
 
@@ -636,9 +651,9 @@ Create a rule
636
651
 
637
652
  * auth_token
638
653
 
639
- * ##### Response Example
654
+ ##### Response Example
655
+
640
656
 
641
- ----
642
657
 
643
658
  {
644
659
  "id" => "5395b245385f7fe266000037",
@@ -679,13 +694,13 @@ Delete the rule
679
694
 
680
695
  * ##### Http_method : Delete
681
696
 
682
- * ##### Response Example
697
+ ##### Response Example
698
+
683
699
 
684
- ----
685
700
 
686
701
  {"http_code":200,"deleted":true}
687
702
 
688
- ----
703
+ ---
689
704
 
690
705
  ### Get join rule conditions
691
706
  Get join rule conditions
@@ -699,9 +714,10 @@ Get join rule conditions
699
714
 
700
715
  * auth_token
701
716
 
702
- * ##### Response Example
717
+ ##### Response Example
718
+
719
+
703
720
 
704
- ----
705
721
  [
706
722
  ["A few conditions where only one needs to be true.", "or_rule_condition"],
707
723
  ["A few conditions that must all be true.", "and_rule_condition"]]
@@ -719,9 +735,9 @@ Get join rule conditions
719
735
 
720
736
  * auth_token
721
737
 
722
- * ##### Response Example
738
+ ##### Response Example
739
+
723
740
 
724
- ----
725
741
  [
726
742
  [
727
743
  ["A numeric payload value is greater than a specified threshold."]
@@ -746,9 +762,9 @@ Get join rule conditions
746
762
 
747
763
  * auth_token
748
764
 
749
- * ##### Response Example
765
+ ##### Response Example
766
+
750
767
 
751
- ----
752
768
  {: _id => "958421647080007a004506b",
753
769
  : active => true,
754
770
  : created_at => "2014-02-05T21:22:53Z",
@@ -772,6 +788,186 @@ Get join rule conditions
772
788
 
773
789
  ----
774
790
 
791
+
792
+ ### Get Reports
793
+ Get all the report of the device
794
+
795
+ MachineShop::Report.all({:device_instance_id => '958421647080007a004506b',:per_page=>'10',}, auth_token)
796
+
797
+ > First parameter should be empty array if no filter is to be applied.
798
+
799
+ * ##### Http_method : Get
800
+
801
+ * ##### Parameters
802
+ * device\_instance\_id: _string_
803
+
804
+ * per\_page: _string_
805
+
806
+
807
+ * auth_token
808
+
809
+ ##### Response Example
810
+
811
+
812
+ {
813
+ "id": "958421647080007a004506b",
814
+ "_id": "958421647080007a004506b",
815
+ "created_at": "2014-06-10T08:19:34Z",
816
+ "deleted_at": null,
817
+ "device_datetime": "2014-06-10T08:19:37+00:00",
818
+ "device_instance_id": "3004884021800aaef0056893",
819
+ "duplicate": false,
820
+ "payload": {
821
+ "event": {
822
+ "eventIdx": 0,
823
+ "policy_id": "f7f8a8e538530000092d1c6b",
824
+ "values": {
825
+ "lightLevel": 320456,
826
+ "fixType": 3,
827
+ "motion": {
828
+ "distance": 0,
829
+ "floor_change": 0,
830
+ "context": 5,
831
+ "steps": 0
832
+ },
833
+ "batteryExternalPower": false,
834
+ "utcTime": 1402388377,
835
+ "temperature": 429,
836
+ "health": {
837
+ "temp4": 15515,
838
+ "heartRateMon": {
839
+ "devBodyLoc": 141,
840
+ "rr": 15504,
841
+ "heartRate": 142,
842
+ "devName": "One_HRM",
843
+ "energy": 15503
844
+ },
845
+ "sensorPod": {
846
+ "devBodyLoc": 151,
847
+ "distance": 15507,
848
+ "floor_change": -107,
849
+ "context": 146,
850
+ "stride_len": 150,
851
+ "devName": "myPod",
852
+ "steps": 15508
853
+ },
854
+ "temp2": 15513,
855
+ "temp3": 15514,
856
+ "temp1": 15512
857
+ },
858
+ "location": {
859
+ "altitude": 0,
860
+ "hor_error_min": 0,
861
+ "latitude": 64.37989,
862
+ "vert_error": 0,
863
+ "hor_error_max": 0,
864
+ "longitude": -122.08374
865
+ },
866
+ "pressure": 42,
867
+ "speed": {
868
+ "heading": 9000,
869
+ "ver_speed": 0,
870
+ "hor_speed": 10000
871
+ },
872
+ "batteryLevel": 87
873
+ },
874
+ "reportMask": 14463
875
+ },
876
+ "sequenceId": 44725
877
+ },
878
+ "profile_timestamps": {
879
+ "translator": "2014-06-10T08:19:37Z",
880
+ "worker": "2014-06-10T08:19:34Z",
881
+ "device": "2014-06-10T08:19:37Z",
882
+ "platform": "2014-06-10T08:19:50Z"
883
+ },
884
+ "raw_data": "AQEAAgAAFnRyYWNrZXIAc2ltdWxhdG9yAENTUgCutQEAOH8BJl+Xgrc7f+YAAAAAAAAAACcQAAAjKAUAAAAAAAAAAABTlr+ZAAMBrQAqAFc/DU9uZV9TZW5zcm9Qb2SRkgAAPJQAADyTlZaXB09uZV9IUk2NjjyPPJA8mDyZPJo8mwAE48gAAA==",
885
+ "report_processor": "java",
886
+ "stale": null,
887
+ "updated_at": "2014-06-10T08:19:34Z"}
888
+
889
+ ---
890
+
891
+
892
+ ### Retrieve Report by report_id
893
+ Get all the report of the device
894
+
895
+ MachineShop::Report.retrieve(report_id,auth_token)
896
+
897
+ > First parameter should be an empty array if no filter is to be applied.
898
+
899
+ * ##### Http_method : Get
900
+
901
+ * ##### Parameters
902
+ * report\_id: _string_
903
+ * auth_token
904
+
905
+ ##### Response Example
906
+ Same as above
907
+ ---
908
+
909
+
910
+ ### Get Meters
911
+ Get all the meters
912
+
913
+ MachineShop::Meter.all({}, auth_token)
914
+
915
+
916
+ * ##### Http_method : Get
917
+
918
+ * ##### Parameters
919
+
920
+ * auth_token
921
+
922
+ ##### Response Example
923
+
924
+
925
+ {
926
+ "id": "958421647080007a004506b",
927
+ "_id": "958421647080007a004506b",
928
+ "body": null,
929
+ "client_ip": "110.34.0.243",
930
+ "created_at": "2014-06-03T17:45:08Z",
931
+ "device_instance_id": null,
932
+ "request_at": "2014-06-03T17:45:10+00:00",
933
+ "request_method": "get",
934
+ "request_path": "/api/v0/platform/device",
935
+ "request_route": "get '/device'",
936
+ "response_code": 200,
937
+ "updated_at": "2014-06-03T17:45:08Z",
938
+ "user_id": "3004884021800aaef0056893"}
939
+
940
+
941
+ > meters via user
942
+
943
+ user.meters
944
+
945
+ > where user is the object obtaied from #authentication
946
+
947
+ user = MachineShop::User.authenticate(
948
+ :email => publisher_username,
949
+ :password => publisher_password
950
+ ---
951
+
952
+
953
+ ### Retrieve meter
954
+ Get meter by meter_id
955
+
956
+ MachineShop::Meter.retrieve(meter_id, auth_token)
957
+
958
+ * ##### Http_method : Get
959
+
960
+ * ##### Parameters
961
+ * meter\_id: _string_
962
+ * auth_token
963
+
964
+ ##### Response Example
965
+
966
+ same as above
967
+
968
+ ---
969
+
970
+
775
971
  ## Contributing
776
972
 
777
973
  1. Fork it