arlo 0.0.1 → 0.0.2

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: 607c25334f0a83ac9d39ac776550356762b1231f
4
- data.tar.gz: e04ac76d38af3770f87af64b42479abb7fe86598
3
+ metadata.gz: 33f0f6248f85c972d54a967d495b83344a1ad080
4
+ data.tar.gz: 00dfd8e3db21e725a6238a838f1b56ae2a87464d
5
5
  SHA512:
6
- metadata.gz: 28499e64145988d61936562d8c8ba6d37c13f170194a427a0ae6af0dfcbbec6c21229369566867196ecd501ebcd20dfbb883047bb39d6237730f4061054c624a
7
- data.tar.gz: b59339d544d31dd2872f8567ee13c83858e1eacca4508ca678781a3ce11a351d4a56e8019929bf44fbf14f12f1c39d3cde842935ec65342c21fe472fbb99ac39
6
+ metadata.gz: 55b19f41cf216956dd81f0c739b0192eb86aed60dd726a34072022e6d7d68516dd39d3886ab471cab3fb1d5445e910bdf2825bdeb9d85caf15df2309ce025ec1
7
+ data.tar.gz: 31a2666add610c74e75e613e0adbc7b5d1d94a839252a3060c067a5a6fe98e4620233c759902dad76ec1428aad2c784cdf7c9f319f5d821dd5ee6f54a73599fd
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  .idea/
13
+ spec/vcr_cassettes
@@ -3,3 +3,7 @@ language: ruby
3
3
  rvm:
4
4
  - 2.4.2
5
5
  before_install: gem install bundler -v 1.16.2
6
+
7
+ script:
8
+ - bundle
9
+ - bundle exec rspec
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in arlo.gemspec
6
6
  gemspec
7
+
8
+ gem 'bundler'
@@ -1,12 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arlo (0.0.1)
4
+ arlo (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ addressable (2.5.2)
10
+ public_suffix (>= 2.0.2, < 4.0)
11
+ crack (0.4.3)
12
+ safe_yaml (~> 1.0.0)
9
13
  diff-lcs (1.3)
14
+ hashdiff (0.3.7)
15
+ public_suffix (3.0.2)
10
16
  rake (10.5.0)
11
17
  rspec (3.7.0)
12
18
  rspec-core (~> 3.7.0)
@@ -21,15 +27,23 @@ GEM
21
27
  diff-lcs (>= 1.2.0, < 2.0)
22
28
  rspec-support (~> 3.7.0)
23
29
  rspec-support (3.7.1)
30
+ safe_yaml (1.0.4)
31
+ vcr (4.0.0)
32
+ webmock (3.4.2)
33
+ addressable (>= 2.3.6)
34
+ crack (>= 0.3.2)
35
+ hashdiff
24
36
 
25
37
  PLATFORMS
26
38
  ruby
27
39
 
28
40
  DEPENDENCIES
29
41
  arlo!
30
- bundler (~> 1.16)
42
+ bundler
31
43
  rake (~> 10.0)
32
44
  rspec (~> 3.0)
45
+ vcr (~> 4.0)
46
+ webmock (~> 3.4, >= 3.4.2)
33
47
 
34
48
  BUNDLED WITH
35
49
  1.16.2
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Arlo
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/arlo.svg)](https://badge.fury.io/rb/arlo) [![Build Status](https://travis-ci.org/ihassin/arlo.svg?branch=master)](https://travis-ci.org/ihassin/arlo)
4
+
3
5
  Get information about your Arlo account as well as your devices.
4
6
 
5
- ## Installation
7
+ # Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
8
10
 
@@ -18,44 +20,65 @@ Or install it yourself as:
18
20
 
19
21
  $ gem install arlo
20
22
 
21
- ## Testing
23
+ # Testing
24
+
25
+ ARLO_TEST_DEVICE=ddd ARLO_EMAIL=xxx ARLO_PASSWORD=yyy bundle exec rspec
22
26
 
23
- ARLO_EMAIL=xxx ARLO_PASSWORD=yyy bundle exec rspec
27
+ ARLO_TEST_DEVICE being the name of the device you want to test with
24
28
 
25
- ## Usage
29
+ # Usage
26
30
 
27
31
  Please see the tests for client usage.
28
32
 
29
- ### get_token
33
+ Set up the environment variables reflecting your Arlo credentials:
34
+
35
+ export ARLO_EMAIL=xxx
36
+ export ARLO_PASSWORD=yyy
37
+
38
+ ## get_token
30
39
 
31
40
  Call this to gain access to the other APIs.
32
41
 
33
- ### get_profile
42
+ ## get_profile
34
43
 
35
44
  Call this to get your profile information.
36
45
 
37
- ### get_devices token
46
+ ## get_devices
47
+
48
+ Call this to get the list of devices (including basestations) registered with the account.
49
+
50
+ ## get_device_info
38
51
 
39
52
  Call this to get device information.
40
53
 
41
- ## Development
54
+ # TODO
55
+
56
+ * Provide a convenient interface to manage devices
57
+ * Control cameras (start/stop recordings)
58
+ * Download videos
59
+
60
+ # Development
42
61
 
43
62
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
44
63
 
45
64
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
46
65
 
47
- ## Contributing
66
+ # Contributing
48
67
 
49
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/arlo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
68
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ihassin/arlo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
50
69
 
51
- ## License
70
+ # License
52
71
 
53
72
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
54
73
 
55
- ## Code of Conduct
74
+ # Code of Conduct
56
75
 
57
76
  Everyone interacting in the Arlo project’s codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/arlo/blob/master/CODE_OF_CONDUCT.md).
58
77
 
59
78
  # Thanks
60
79
 
61
80
  Thank you to [Roberto Gallea](http://www.robertogallea.com/blog/netgear-arlo-api) and [bburtin](https://github.com/bburtin/arlo-api) for their inspiring blog posts and repos.
81
+
82
+ # Other work
83
+
84
+ Whats seems like a very comprehensive Python library by [jeffreydwalter](https://github.com/jeffreydwalter/arlo)
@@ -34,4 +34,6 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency 'bundler', '~> 1.16'
35
35
  spec.add_development_dependency 'rake', '~> 10.0'
36
36
  spec.add_development_dependency 'rspec', '~> 3.0'
37
+ spec.add_development_dependency 'vcr', '~> 4.0'
38
+ spec.add_development_dependency 'webmock', '~> 3.4', '>= 3.4.2'
37
39
  end
@@ -1,3 +1,5 @@
1
+ require_relative 'arlo/network_helper'
2
+
1
3
  module Arlo
2
4
  require 'arlo/version'
3
5
  require 'arlo/token'
@@ -4,5 +4,10 @@ module Arlo
4
4
  profile = get('https://arlo.netgear.com/hmsweb/users/devices', token)
5
5
  JSON.parse(profile.body)
6
6
  end
7
+
8
+ def get_device_info device_name, device_list
9
+ raise 'Missing device_name' unless device_name
10
+ device_list['data'].select {|device| device['deviceName'] == device_name }[0]
11
+ end
7
12
  end
8
13
  end
@@ -0,0 +1,32 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'json'
4
+ require 'openssl'
5
+
6
+ module Arlo
7
+ class API
8
+ def get url, token
9
+ uri = URI.parse(url)
10
+ http = Net::HTTP.new(uri.host, uri.port)
11
+ http.use_ssl = true
12
+
13
+ request = Net::HTTP::Get.new(uri)
14
+ request.add_field('Content-Type', 'application/json')
15
+ request.add_field('Authorization', token)
16
+
17
+ http.request(request)
18
+ end
19
+
20
+ def post url, payload
21
+ uri = URI.parse(url)
22
+ http = Net::HTTP.new(uri.host, uri.port)
23
+ http.use_ssl = true
24
+
25
+ request = Net::HTTP::Post.new(uri)
26
+ request.add_field('Content-Type', 'application/json')
27
+ request.body = payload.to_json
28
+
29
+ http.request(request)
30
+ end
31
+ end
32
+ end
@@ -4,18 +4,5 @@ module Arlo
4
4
  profile = get('https://arlo.netgear.com/hmsweb/users/profile', token)
5
5
  JSON.parse(profile.body)
6
6
  end
7
-
8
- private
9
- def get url, token
10
- uri = URI.parse(url)
11
- http = Net::HTTP.new(uri.host, uri.port)
12
- http.use_ssl = true
13
-
14
- request = Net::HTTP::Get.new(uri)
15
- request.add_field('Content-Type', 'application/json')
16
- request.add_field('Authorization', token)
17
-
18
- http.request(request)
19
- end
20
7
  end
21
8
  end
@@ -1,10 +1,6 @@
1
- require 'net/http'
2
- require 'uri'
3
- require 'json'
4
- require 'openssl'
5
-
6
1
  module Arlo
7
2
  class API
3
+
8
4
  def initialize
9
5
  @@token = nil
10
6
  end
@@ -24,17 +20,5 @@ module Arlo
24
20
  @@token = JSON.parse(response.body)['data']['token']
25
21
  end
26
22
 
27
- private
28
- def post url, payload
29
- uri = URI.parse(url)
30
- http = Net::HTTP.new(uri.host, uri.port)
31
- http.use_ssl = true
32
-
33
- request = Net::HTTP::Post.new(uri)
34
- request.add_field('Content-Type', 'application/json')
35
- request.body = payload.to_json
36
-
37
- http.request(request)
38
- end
39
23
  end
40
24
  end
@@ -1,3 +1,3 @@
1
1
  module Arlo
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
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.1
4
+ version: 0.0.2
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-02 00:00:00.000000000 Z
11
+ date: 2018-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,40 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.4'
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 3.4.2
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '3.4'
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 3.4.2
55
89
  description: Allows one to query and control one's Arlo devices
56
90
  email:
57
91
  - ihassin@mac.com
@@ -75,6 +109,7 @@ files:
75
109
  - exe/arlo
76
110
  - lib/arlo.rb
77
111
  - lib/arlo/devices.rb
112
+ - lib/arlo/network_helper.rb
78
113
  - lib/arlo/profile.rb
79
114
  - lib/arlo/token.rb
80
115
  - lib/arlo/version.rb