easy_upnp 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/bin/upnp-list +1 -1
- data/easy_upnp.gemspec +1 -0
- data/lib/easy_upnp/upnp_device.rb +13 -9
- data/lib/easy_upnp/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 217e192e49ffaeda07523f9d727be2ad627a027c64b45693e50c9efb4058f46f
|
4
|
+
data.tar.gz: 62042fd87475783b47e1e4a3b0ebf76e2a7c804200a114c20631f8189c8546a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d2b91ed872a3176d78a1ef17225ded757500576ad830a177b8c571b4ee13f2204dd26d4a2e02066b62d487eabae2227d30c832df3d2dd2b09ca743d1dbc3e69
|
7
|
+
data.tar.gz: 3cf3e2649d7d2eff1a3ece29e6db5866cf943fd35e7c0a222f39319b86a325527c981122ffcfb857cdb3c7b9a83028aaced5f91a7295a94033bb70f0153af4d2
|
data/README.md
CHANGED
@@ -55,6 +55,22 @@ service.GetSystemUpdateID
|
|
55
55
|
# => {:Id=>"207"}
|
56
56
|
```
|
57
57
|
|
58
|
+
#### Get information about a specific device
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
device.description
|
62
|
+
# => { ... } # all available information
|
63
|
+
|
64
|
+
device.description['friendlyName']
|
65
|
+
# => "WeMo Switch"
|
66
|
+
|
67
|
+
device.description['deviceType']
|
68
|
+
# => "urn:Belkin:device:controllee:1"
|
69
|
+
|
70
|
+
device.description['serialNumber']
|
71
|
+
# => "221520K1100836"
|
72
|
+
```
|
73
|
+
|
58
74
|
## Static client construction
|
59
75
|
|
60
76
|
After you've constructed a client (`DeviceControlPoint`), you probably don't want to have to use SSDP to construct it again the next time you use it. `DeviceControlPoint` is equipped with `#to_params` and `#from_params` methods to make this easy.
|
data/bin/upnp-list
CHANGED
@@ -35,7 +35,7 @@ if devices.any?
|
|
35
35
|
printf "%30s %45s %s\n", "Name", "UUID", "Services"
|
36
36
|
|
37
37
|
devices.each do |device|
|
38
|
-
name = device.
|
38
|
+
name = device.description[:friendlyName] rescue '*** Error fetching name ***'
|
39
39
|
|
40
40
|
printf "%30s %45s ", name, device.uuid
|
41
41
|
|
data/easy_upnp.gemspec
CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.add_dependency 'rake'
|
16
16
|
gem.add_dependency 'savon', '~> 2.11'
|
17
17
|
gem.add_dependency 'nokogiri', '~> 1.8'
|
18
|
+
gem.add_dependency 'nori', '~> 2.6'
|
18
19
|
gem.add_dependency 'rubyntlm', '~> 0.3'
|
19
20
|
|
20
21
|
gem.required_ruby_version = '>= 2.1.0'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'uri'
|
2
|
-
require '
|
2
|
+
require 'nori'
|
3
3
|
require 'open-uri'
|
4
4
|
require 'savon'
|
5
5
|
|
@@ -37,8 +37,14 @@ module EasyUpnp
|
|
37
37
|
@host ||= URI.parse(@service_definitions.first[:location]).host
|
38
38
|
end
|
39
39
|
|
40
|
+
def description
|
41
|
+
@description ||= fetch_description
|
42
|
+
end
|
43
|
+
|
44
|
+
# @deprecated Use {#description['friendlyName']} instead of this method.
|
45
|
+
# It will be removed in the next major release.
|
40
46
|
def device_name
|
41
|
-
@device_name ||=
|
47
|
+
@device_name ||= description['friendlyName']
|
42
48
|
end
|
43
49
|
|
44
50
|
def all_services
|
@@ -65,16 +71,14 @@ module EasyUpnp
|
|
65
71
|
|
66
72
|
private
|
67
73
|
|
68
|
-
|
74
|
+
# @return [Hash]
|
75
|
+
def fetch_description
|
69
76
|
if all_services.empty?
|
70
|
-
raise RuntimeError, "Couldn't resolve device
|
77
|
+
raise RuntimeError, "Couldn't resolve device description because no endpoints are defined"
|
71
78
|
end
|
72
79
|
|
73
|
-
|
74
|
-
|
75
|
-
xml.remove_namespaces!
|
76
|
-
|
77
|
-
xml.xpath("//device/friendlyName").text
|
80
|
+
location = service_definition(all_services.first)[:location]
|
81
|
+
Nori.new.parse(open(location) { |f| f.read })['root']['device']
|
78
82
|
end
|
79
83
|
end
|
80
84
|
end
|
data/lib/easy_upnp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_upnp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Mullins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nori
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.6'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.6'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rubyntlm
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|