arlo 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ef361a03fce87641da660189ebb83dd3b7fbfc4
4
- data.tar.gz: d89c72f4e22601bf702807624fb515116b8c5f68
3
+ metadata.gz: b667adad1fa2ab948b69b22e5a2d485523785976
4
+ data.tar.gz: 39bb68118a09ee89f99ce32faabbadc2f07c242d
5
5
  SHA512:
6
- metadata.gz: 5aa0bccc7721415c7a78e6b745b45a81acf4ed67828dbe12de1099ca3362fd47e839e2d97c4f25b0f7140f6ff634495052fa394855321359c878a86d9b289657
7
- data.tar.gz: 96c787a6bd3f6716e8f43c1a64fc44adc5cb80d11ffe308e006a34c9e65123b1f891b7da39b8c19f43a89c549f2fc3c08712db39f9b063801b98abae5ad6d07b
6
+ metadata.gz: 435f7d73b99a299070da0ecb00b6e43a5c51aac1162a54698ee4286c83de6a3e9107bd7b4e5c9390cfed7a2b3f09a2ce26031390441e9bd8aa99d20dc7048151
7
+ data.tar.gz: 18342bd90298a257716f15dec229cebf2d7c59a8a58f8cae5e2ab7063f28767b3e9d61a81c94d0c215906a202e4389a6dd33f352411ea45c7826e8552a295dee
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arlo (0.0.4)
4
+ arlo (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -94,9 +94,19 @@ api = Arlo::API.new
94
94
  library = api.get_library '20180802', '20180803'
95
95
  ```
96
96
 
97
+ ## take_snapshot
98
+
99
+ Call this to take a snapshot using a given camera.
100
+
101
+ ```
102
+ api = Arlo::API.new
103
+ camera = @api.get_device_info(camera_name)
104
+ result = @api.take_snapshot(camera)
105
+ ```
106
+
97
107
  # TODO
98
108
 
99
- * Control cameras (start/stop recordings, take snapshots)
109
+ * Control cameras (start/stop recordings)
100
110
  * Download videos
101
111
 
102
112
  # Development
data/changelog.md CHANGED
@@ -12,3 +12,4 @@
12
12
  * API object is logged-in when created
13
13
  * Devices and Profile are loaded when API object is created
14
14
  * Added arm/disarm API method
15
+ * Added API to take a snapshot
data/lib/arlo/devices.rb CHANGED
@@ -12,11 +12,11 @@ module Arlo
12
12
  @devices['data'].select {|device| device['deviceName'] == device_name }[0]
13
13
  end
14
14
 
15
- def arm_device(base_station, armed)
16
- station_id = base_station['deviceId']
15
+ def arm_device(device, armed)
16
+ device_id = device['deviceId']
17
17
  payload = {
18
18
  'from': 'arlogem',
19
- 'to': station_id,
19
+ 'to': device_id,
20
20
  'action': 'set',
21
21
  'resource': 'modes',
22
22
  'transId': SecureRandom.uuid,
@@ -26,10 +26,64 @@ module Arlo
26
26
  }
27
27
  }
28
28
 
29
- ret_val = post("https://arlo.netgear.com/hmsweb/users/devices/notify/#{station_id}",
30
- payload,
31
- 'xcloudId': base_station['xCloudId'])
29
+ ret_val = post("https://arlo.netgear.com/hmsweb/users/devices/notify/#{device_id}",
30
+ payload, 'xcloudId': device['xCloudId'])
31
+
32
+ JSON.parse(ret_val.body)
33
+ end
34
+
35
+ def take_snapshot(camera)
36
+ camera_id = camera['deviceId']
37
+
38
+ payload = {
39
+ 'to': camera_id,
40
+ 'from': 'ArloGem',
41
+ 'resource': "cameras/#{camera_id}",
42
+ 'action': 'set',
43
+ 'publishResponse': true,
44
+ 'transId': SecureRandom.uuid,
45
+ 'properties': {
46
+ 'activityState': 'startUserStream',
47
+ 'cameraId': camera_id
48
+ }
49
+ }
50
+
51
+ ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/startStream',
52
+ payload, 'xcloudId': camera['xCloudId'])
53
+
54
+ ret_val = JSON.parse(ret_val.body)
55
+ return ret_val unless ret_val['success']
56
+
57
+ payload = {
58
+ 'cameraId': camera_id,
59
+ 'parentId': camera_id,
60
+ 'deviceId': camera_id,
61
+ 'olsonTimeZone': 'Americal/New York'
62
+ }
63
+
64
+ ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/takeSnapshot',
65
+ payload, 'xcloudId': camera['xCloudId'])
66
+
67
+ snapshot_ret_val = JSON.parse(ret_val.body)
68
+
69
+ payload = {
70
+ 'to': camera_id,
71
+ 'from': 'ArloGem',
72
+ 'resource': "cameras/#{camera_id}",
73
+ 'action': 'set',
74
+ 'publishResponse': true,
75
+ 'transId': SecureRandom.uuid,
76
+ 'properties': {
77
+ 'activityState': 'stopUserStream',
78
+ 'cameraId': camera_id
79
+ }
80
+ }
81
+
82
+ ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/stopStream',
83
+ payload, 'xcloudId': camera['xCloudId'])
84
+
32
85
  JSON.parse(ret_val.body)
86
+ snapshot_ret_val
33
87
  end
34
88
  end
35
89
  end
data/lib/arlo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arlo
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arlo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Itamar Hassin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-05 00:00:00.000000000 Z
11
+ date: 2018-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler