arlo 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -0
- data/Gemfile.lock +2 -1
- data/README.md +16 -2
- data/changelog.md +6 -0
- data/lib/arlo/devices.rb +61 -51
- data/lib/arlo/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d9e6c55c2cba266a5ab5e19f0d2d9b9f65ad52e1bc0250c984e749c1945912db
|
4
|
+
data.tar.gz: f4928cb755ec9f5b5eb83bc272eac56b8c797c44887a9641d248657d7e9e0054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56a71ebbe15b45abb01180ff2f2c504ed80591e4df11134503761313d3e4cba1262a88a4e6da0be49d00c2b6210dc3ed77e52a79e77ba35cf6f9ed7f202cf47d
|
7
|
+
data.tar.gz: f9326da628785805f124b39b8625a62f4d72bb1cc0c90ee96f827b02298f0061d20ed81186db98944f57835f281eefbc77b06a7119ff8b1ffeac7a632e43b4a1
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -22,9 +22,16 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
# Testing
|
24
24
|
|
25
|
-
|
25
|
+
## Set up environment variables in a local ```.env``` file:
|
26
|
+
ARLO_EMAIL=your account email
|
27
|
+
ARLO_PASSWORD=your account password
|
28
|
+
ARLO_TEST_BASE_STATION=base-station name
|
29
|
+
ARLO_TEST_DEVICE=a camera's name
|
30
|
+
ARLO_SIREN_BASE_STATION=base-station with siren name
|
26
31
|
|
27
|
-
|
32
|
+
Run the tests
|
33
|
+
|
34
|
+
bundle exec rspec
|
28
35
|
|
29
36
|
# Usage
|
30
37
|
|
@@ -114,6 +121,13 @@ camera = @api.get_device_info(camera_name)
|
|
114
121
|
result = @api.record_video(camera, 10)
|
115
122
|
```
|
116
123
|
|
124
|
+
## sound the siren for a determined duration
|
125
|
+
|
126
|
+
```
|
127
|
+
basestation = @api.get_device_info(basestation_name)
|
128
|
+
result = @api.set_siren_on(basestation, 3) # siren will sound for 3 seconds
|
129
|
+
```
|
130
|
+
|
117
131
|
# TODO
|
118
132
|
|
119
133
|
* Record and take snapshots asynchronously
|
data/changelog.md
CHANGED
data/lib/arlo/devices.rb
CHANGED
@@ -32,26 +32,34 @@ module Arlo
|
|
32
32
|
JSON.parse(ret_val.body)
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
|
35
|
+
def set_siren_on(device, duration)
|
36
|
+
device_id = device['deviceId']
|
37
37
|
|
38
38
|
payload = {
|
39
|
-
'
|
40
|
-
'
|
41
|
-
'resource': "cameras/#{camera_id}",
|
39
|
+
'from': 'arlogem',
|
40
|
+
'to': device_id,
|
42
41
|
'action': 'set',
|
43
|
-
'publishResponse': true,
|
44
42
|
'transId': SecureRandom.uuid,
|
43
|
+
'publishResponse': true,
|
44
|
+
'resource': 'siren',
|
45
45
|
'properties': {
|
46
|
-
|
47
|
-
|
46
|
+
'duration': duration,
|
47
|
+
'pattern': 'alarm',
|
48
|
+
'sirenState': 'on',
|
49
|
+
'volume': 8
|
48
50
|
}
|
49
51
|
}
|
50
52
|
|
51
|
-
ret_val = post(
|
52
|
-
payload, 'xcloudId':
|
53
|
+
ret_val = post("https://arlo.netgear.com/hmsweb/users/devices/notify/#{device_id}",
|
54
|
+
payload, 'xcloudId': device['xCloudId'])
|
55
|
+
|
56
|
+
JSON.parse(ret_val.body)
|
57
|
+
end
|
58
|
+
|
59
|
+
def take_snapshot(camera)
|
60
|
+
camera_id = camera['deviceId']
|
53
61
|
|
54
|
-
ret_val =
|
62
|
+
ret_val = start_stream(camera, camera_id)
|
55
63
|
return ret_val unless ret_val['success']
|
56
64
|
|
57
65
|
payload = {
|
@@ -66,74 +74,76 @@ module Arlo
|
|
66
74
|
|
67
75
|
snapshot_ret_val = JSON.parse(ret_val.body)
|
68
76
|
|
77
|
+
stop_stream(camera)
|
78
|
+
snapshot_ret_val
|
79
|
+
end
|
80
|
+
|
81
|
+
def record_video(camera, duration)
|
82
|
+
camera_id = camera['deviceId']
|
83
|
+
parent_id = camera['parentId']
|
84
|
+
|
85
|
+
ret_val = start_stream(camera, parent_id)
|
86
|
+
return ret_val unless ret_val['success']
|
87
|
+
|
88
|
+
# ret_val['data']['url']
|
69
89
|
payload = {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
'publishResponse': true,
|
75
|
-
'transId': SecureRandom.uuid,
|
76
|
-
'properties': {
|
77
|
-
'activityState': 'stopUserStream',
|
78
|
-
'cameraId': camera_id
|
79
|
-
}
|
90
|
+
'xcloudId': camera['xCloudId'],
|
91
|
+
'parentId': parent_id,
|
92
|
+
'deviceId': camera_id,
|
93
|
+
'olsonTimeZone': camera['properties']['olsonTimeZone']
|
80
94
|
}
|
81
95
|
|
82
|
-
ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/
|
96
|
+
ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/startRecord',
|
83
97
|
payload, 'xcloudId': camera['xCloudId'])
|
84
98
|
|
99
|
+
sleep(duration)
|
100
|
+
|
101
|
+
stop_stream(camera)
|
102
|
+
|
85
103
|
JSON.parse(ret_val.body)
|
86
|
-
snapshot_ret_val
|
87
104
|
end
|
88
105
|
|
89
|
-
|
106
|
+
private
|
107
|
+
|
108
|
+
def stop_stream(camera)
|
90
109
|
camera_id = camera['deviceId']
|
91
|
-
parent_id = camera['parentId']
|
92
110
|
|
93
111
|
payload = {
|
94
|
-
'to':
|
112
|
+
'to': camera_id,
|
95
113
|
'from': 'ArloGem',
|
96
114
|
'resource': "cameras/#{camera_id}",
|
97
115
|
'action': 'set',
|
98
|
-
'responseUrl': '',
|
99
116
|
'publishResponse': true,
|
100
117
|
'transId': SecureRandom.uuid,
|
101
118
|
'properties': {
|
102
|
-
'activityState': '
|
119
|
+
'activityState': 'stopUserStream',
|
103
120
|
'cameraId': camera_id
|
104
121
|
}
|
105
122
|
}
|
106
123
|
|
107
|
-
ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/
|
108
|
-
payload, 'xcloudId': camera['xCloudId'])
|
109
|
-
|
110
|
-
ret_val = JSON.parse(ret_val.body)
|
111
|
-
payload = {
|
112
|
-
'xcloudId': camera['xCloudId'],
|
113
|
-
'parentId': camera['parentId'],
|
114
|
-
'deviceId': camera_id,
|
115
|
-
'olsonTimeZone': camera['properties']['olsonTimeZone']
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/startRecord',
|
124
|
+
ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/stopStream',
|
120
125
|
payload, 'xcloudId': camera['xCloudId'])
|
121
126
|
|
122
127
|
JSON.parse(ret_val.body)
|
128
|
+
end
|
123
129
|
|
124
|
-
|
125
|
-
|
130
|
+
def start_stream(camera, dest)
|
131
|
+
camera_id = camera['deviceId']
|
126
132
|
payload = {
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
133
|
+
'to': dest,
|
134
|
+
'from': 'ArloGem',
|
135
|
+
'resource': "cameras/#{camera_id}",
|
136
|
+
'action': 'set',
|
137
|
+
'publishResponse': true,
|
138
|
+
'transId': SecureRandom.uuid,
|
139
|
+
'properties': {
|
140
|
+
'activityState': 'startUserStream',
|
141
|
+
'cameraId': camera_id
|
142
|
+
}
|
132
143
|
}
|
133
144
|
|
134
|
-
ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/
|
135
|
-
|
136
|
-
|
145
|
+
ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/startStream',
|
146
|
+
payload, 'xcloudId': camera['xCloudId'])
|
137
147
|
JSON.parse(ret_val.body)
|
138
148
|
end
|
139
149
|
end
|
data/lib/arlo/version.rb
CHANGED
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
|
+
version: 0.0.8
|
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-
|
11
|
+
date: 2018-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,6 +110,7 @@ extra_rdoc_files: []
|
|
110
110
|
files:
|
111
111
|
- ".gitignore"
|
112
112
|
- ".rspec"
|
113
|
+
- ".ruby-version"
|
113
114
|
- ".travis.yml"
|
114
115
|
- CODE_OF_CONDUCT.md
|
115
116
|
- Gemfile
|
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
150
|
version: '0'
|
150
151
|
requirements: []
|
151
152
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.6
|
153
|
+
rubygems_version: 2.7.6
|
153
154
|
signing_key:
|
154
155
|
specification_version: 4
|
155
156
|
summary: Allows one to query and control one's Arlo devices
|