doxie-scanner 1.0.0 → 1.1.0

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
- SHA1:
3
- metadata.gz: 0f5ae45f5092a67305235d6acd0c0cf018f16ca8
4
- data.tar.gz: a5db5df580ccc6dff3390b903ab62729f7dd368f
2
+ SHA256:
3
+ metadata.gz: 3d19094d1abad744e8bf10c3e9c1fddf14459be1158db960c460a61ed9e76123
4
+ data.tar.gz: 32e13587cd42cdddfbc070384d6c31d20948ea93cb138450606db8529326ca86
5
5
  SHA512:
6
- metadata.gz: a056afdb2c3228c838029e38af15b3b7fe17dcf6defa441493fe358e8d43946bb4ea7a1025740316c588d528ca59973acc6fc663496851a7338c912e96c31c25
7
- data.tar.gz: 9275baf29379ece4950c386aa418a2fc7a158f27d9ff7222f194d77940ed6fe202fd0c591847cf1c9da64296dd143f22bc3a4e41d4279aa106fe3b120e670f16
6
+ metadata.gz: f6c217d412b6aec0e69d04c2d781fd8152846b4ea4126f838e6113b83d9564db39de1bf7c6b5dff48fcf25b173d499b84414c59da1277f194c62b9a4c8b0dabc
7
+ data.tar.gz: 3061edd67b68532ad3b3118394b91b2ecbfd31298e35f671d097fc5f75f44e89b93310f8314c5739b50c72d1b8f198a2e526377bdbfb1fa7bdd7e7719a85629e
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Doxie Scanner
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/doxie_Scanner.svg)](https://badge.fury.io/rb/doxie_Scanner)
3
+ [![Gem Version](https://badge.fury.io/rb/doxie-scanner.svg)](https://badge.fury.io/rb/doxie-scanner) [![Build Status](https://travis-ci.org/cbetta/doxie-scanner.svg?branch=master)](https://travis-ci.org/cbetta/doxie-scanner)
4
4
 
5
- A scanner to find your the [Doxie Go Wifi](http://getdoxie.com). Returns an IP or list of IPs for your Doxie scanner. Very useful in combination with the [Doxie API gem](https://github.com/cbetta/doxie).
5
+ A scanner to find your WiFi enabled [Doxie](http://getdoxie.com) scanner. It returns a list of IP addressess for all Doxie scanners discovered on your network.
6
+
7
+ This Gem is especially useful in combination with the [Doxie client library](https://github.com/cbetta/doxie).
6
8
 
7
9
  ## Installation
8
10
 
@@ -14,7 +16,7 @@ gem 'doxie-scanner'
14
16
 
15
17
  ## Usage
16
18
 
17
- The scanner uses UPnP and SSDP to search for your Doxie.
19
+ The scanner uses UPnP and SSDP to search for your Doxie scanner.
18
20
 
19
21
  ```rb
20
22
  require 'doxie/scanner'
@@ -35,7 +37,7 @@ Doxie::Scanner.ips
35
37
  ### Development
36
38
 
37
39
  * `bundle install` to get dependencies
38
- * `rake` to run tests
40
+ * `rake` to run all tests
39
41
  * `rake console` to run a local console with the library loaded
40
42
 
41
43
  ## License
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'doxie-scanner'
3
- s.version = '1.0.0'
3
+ s.version = '1.1.0'
4
4
  s.summary = "A simple scanner for your Doxie Go Wifi"
5
5
  s.description = "A simple scanner for your Doxie Go Wifi"
6
6
  s.authors = ["Cristiano Betta"]
@@ -11,4 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_path = 'lib'
12
12
 
13
13
  s.add_dependency('frisky')
14
+
15
+ s.add_development_dependency('rake')
16
+ s.add_development_dependency('minitest')
14
17
  end
@@ -2,8 +2,8 @@ require 'frisky/ssdp'
2
2
 
3
3
  module Doxie
4
4
  class Scanner
5
- def self.ips
6
- root_devices = Frisky::SSDP.search 'upnp:rootdevices'
5
+ def self.ips(frisky = Frisky::SSDP)
6
+ root_devices = frisky.search 'upnp:rootdevices'
7
7
  doxies = root_devices.select { |device| device[:location].include?('doxie')}
8
8
  hosts = doxies.map {|doxie| URI.parse(doxie[:location]).host }
9
9
  hosts.uniq
@@ -0,0 +1,35 @@
1
+ require 'minitest/autorun'
2
+ require 'doxie/scanner'
3
+
4
+ describe 'Doxie::Scanner' do
5
+ before do
6
+ @frisky = Minitest::Mock.new
7
+ @return_value = []
8
+ @args = ['upnp:rootdevices']
9
+ end
10
+
11
+ it 'should search for upnp:rootdevices' do
12
+ @frisky.expect :search, @return_value, @args
13
+ ips = Doxie::Scanner.ips(@frisky)
14
+ @frisky.verify
15
+ assert_equal ips, @return_value
16
+ end
17
+
18
+ it 'should extract the host names for doxie devices' do
19
+ @frisky.expect :search, [
20
+ { location: "http://127.0.0.1/doxie/foo" },
21
+ { location: "http://127.0.0.2/doksy/foo" },
22
+ ], @args
23
+ ips = Doxie::Scanner.ips(@frisky)
24
+ assert_equal ips, ['127.0.0.1']
25
+ end
26
+
27
+ it 'should only find unique host names' do
28
+ @frisky.expect :search, [
29
+ { location: "http://127.0.0.1/doxie/foo" },
30
+ { location: "http://127.0.0.1/doxie/foo" },
31
+ ], @args
32
+ ips = Doxie::Scanner.ips(@frisky)
33
+ assert_equal ips.length, 1
34
+ end
35
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doxie-scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristiano Betta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-30 00:00:00.000000000 Z
11
+ date: 2019-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: frisky
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  description: A simple scanner for your Doxie Go Wifi
28
56
  email: cbetta@gmail.com
29
57
  executables: []
@@ -35,6 +63,7 @@ files:
35
63
  - doxie-scanner.gemspec
36
64
  - lib/doxie.rb
37
65
  - lib/doxie/scanner.rb
66
+ - spec/doxie/scanner_spec.rb
38
67
  homepage: https://github.com/cbetta/doxie-scanner
39
68
  licenses:
40
69
  - MIT
@@ -54,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
83
  - !ruby/object:Gem::Version
55
84
  version: '0'
56
85
  requirements: []
57
- rubyforge_project:
58
- rubygems_version: 2.5.1
86
+ rubygems_version: 3.0.2
59
87
  signing_key:
60
88
  specification_version: 4
61
89
  summary: A simple scanner for your Doxie Go Wifi