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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e5fd1c0f9598bbcb10fa556088ee68a29418e5dc
4
- data.tar.gz: d33520a5c26e3a834ab6f76202805bff78006e7c
2
+ SHA256:
3
+ metadata.gz: d9e6c55c2cba266a5ab5e19f0d2d9b9f65ad52e1bc0250c984e749c1945912db
4
+ data.tar.gz: f4928cb755ec9f5b5eb83bc272eac56b8c797c44887a9641d248657d7e9e0054
5
5
  SHA512:
6
- metadata.gz: 5eaa817a0abd8b9515faf238dacd5605545a6b3cf62ba96687f8af4a493f538170d24805b60eaae6df83ebd79e6794d1c6d7cb974bd0346ff403d864d9442983
7
- data.tar.gz: 8542ae25bc869cd9314275ccf1c59df148042a736eec3dae347c0987ea31e73f79f827e313684f25ef74a0abc2f0ae298e49e2a9ee8cb450a3939edc121ce7ca
6
+ metadata.gz: 56a71ebbe15b45abb01180ff2f2c504ed80591e4df11134503761313d3e4cba1262a88a4e6da0be49d00c2b6210dc3ed77e52a79e77ba35cf6f9ed7f202cf47d
7
+ data.tar.gz: f9326da628785805f124b39b8625a62f4d72bb1cc0c90ee96f827b02298f0061d20ed81186db98944f57835f281eefbc77b06a7119ff8b1ffeac7a632e43b4a1
@@ -0,0 +1 @@
1
+ 2.5.1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arlo (0.0.7)
4
+ arlo (0.0.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -37,6 +37,7 @@ GEM
37
37
 
38
38
  PLATFORMS
39
39
  ruby
40
+ x64-mingw32
40
41
 
41
42
  DEPENDENCIES
42
43
  arlo!
data/README.md CHANGED
@@ -22,9 +22,16 @@ Or install it yourself as:
22
22
 
23
23
  # Testing
24
24
 
25
- ARLO_TEST_DEVICE=ddd ARLO_EMAIL=xxx ARLO_PASSWORD=yyy bundle exec rspec
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
- ARLO_TEST_DEVICE being the name of the device you want to test with
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
@@ -26,4 +26,10 @@
26
26
 
27
27
  * Using the dotenv gem to store environment variables
28
28
 
29
+ ## 2018-08-27
30
+
31
+ ### Non-breaking
32
+
33
+ * Added siren_on API
34
+
29
35
 
@@ -32,26 +32,34 @@ module Arlo
32
32
  JSON.parse(ret_val.body)
33
33
  end
34
34
 
35
- def take_snapshot(camera)
36
- camera_id = camera['deviceId']
35
+ def set_siren_on(device, duration)
36
+ device_id = device['deviceId']
37
37
 
38
38
  payload = {
39
- 'to': camera_id,
40
- 'from': 'ArloGem',
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
- 'activityState': 'startUserStream',
47
- 'cameraId': camera_id
46
+ 'duration': duration,
47
+ 'pattern': 'alarm',
48
+ 'sirenState': 'on',
49
+ 'volume': 8
48
50
  }
49
51
  }
50
52
 
51
- ret_val = post('https://arlo.netgear.com/hmsweb/users/devices/startStream',
52
- payload, 'xcloudId': camera['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 = JSON.parse(ret_val.body)
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
- '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
- }
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/stopStream',
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
- def record_video(camera, duration)
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': parent_id,
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': 'startUserStream',
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/startStream',
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
- sleep(duration)
125
-
130
+ def start_stream(camera, dest)
131
+ camera_id = camera['deviceId']
126
132
  payload = {
127
- 'xcloudId': camera['xCloudId'],
128
- 'parentId': camera['parentId'],
129
- 'deviceId': camera_id,
130
- 'olsonTimeZone': camera['properties']['olsonTimeZone']
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/stopRecord',
135
- payload, 'xcloudId': camera['xCloudId'])
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
@@ -1,3 +1,3 @@
1
1
  module Arlo
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
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.7
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-07 00:00:00.000000000 Z
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.13
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