easy_upnp 1.1.5 → 1.1.6
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 +4 -4
- data/lib/easy_upnp/control_point/client_wrapper.rb +0 -2
- data/lib/easy_upnp/control_point/device_control_point.rb +6 -8
- data/lib/easy_upnp/control_point/validator_provider.rb +1 -1
- data/lib/easy_upnp/events/event_client.rb +0 -2
- data/lib/easy_upnp/events/event_parser.rb +14 -0
- data/lib/easy_upnp/events/http_listener.rb +7 -4
- data/lib/easy_upnp/events/subscription_manager.rb +0 -2
- data/lib/easy_upnp/ssdp_searcher.rb +1 -1
- data/lib/easy_upnp/upnp_device.rb +1 -1
- data/lib/easy_upnp/version.rb +1 -1
- data/lib/easy_upnp.rb +7 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c66af83dcc88342a62f3853bc9645da68d853efe
|
4
|
+
data.tar.gz: 709d7760d76927f10218e1cc409d88881d28b6b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 254d60281f8155868cc274cc367d2b1c3800384e01a4b371a43fdf1612d4cc07b58bda99f25275de66b1b1c1fb402deea785957283cff8b281498aaa9e9ef3b8
|
7
|
+
data.tar.gz: b4a9f81494418c9bb837fa09efb8f5f53d7d2f35bbae1137d458ebdb22c087893ef85ca325820ce166c95f63788adbe90bd66e0d133a67ea1313c0ca9e5ea7bd
|
@@ -2,15 +2,13 @@ require 'nokogiri'
|
|
2
2
|
require 'open-uri'
|
3
3
|
require 'nori'
|
4
4
|
|
5
|
-
|
5
|
+
require 'easy_upnp/control_point/validator_provider'
|
6
|
+
require 'easy_upnp/control_point/client_wrapper'
|
7
|
+
require 'easy_upnp/control_point/service_method'
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
require_relative '../events/event_client'
|
12
|
-
require_relative '../events/http_listener'
|
13
|
-
require_relative '../events/subscription_manager'
|
9
|
+
require 'easy_upnp/events/event_client'
|
10
|
+
require 'easy_upnp/events/http_listener'
|
11
|
+
require 'easy_upnp/events/subscription_manager'
|
14
12
|
|
15
13
|
module EasyUpnp
|
16
14
|
class DeviceControlPoint
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module EasyUpnp
|
4
|
+
class EventParser
|
5
|
+
def parse(event_xml)
|
6
|
+
x = Nokogiri::XML(event_xml)
|
7
|
+
prop_changes = x.xpath('//e:propertyset/e:property/*', e: 'urn:schemas-upnp-org:event-1-0').map do |n|
|
8
|
+
[n.name.to_sym, n.text]
|
9
|
+
end
|
10
|
+
|
11
|
+
Hash[prop_changes]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'webrick'
|
2
2
|
require 'thread'
|
3
3
|
|
4
|
-
|
4
|
+
require 'easy_upnp/events/event_parser'
|
5
5
|
|
6
6
|
module EasyUpnp
|
7
7
|
class HttpListener
|
@@ -15,8 +15,10 @@ module EasyUpnp
|
|
15
15
|
# interfaces.
|
16
16
|
bind_address: '0.0.0.0',
|
17
17
|
|
18
|
-
# By default, event callback just prints the
|
19
|
-
callback: ->(
|
18
|
+
# By default, event callback just prints the changed state vars
|
19
|
+
callback: ->(state_vars) {
|
20
|
+
puts state_vars.inspect
|
21
|
+
}
|
20
22
|
}
|
21
23
|
|
22
24
|
def initialize(options)
|
@@ -67,10 +69,11 @@ module EasyUpnp
|
|
67
69
|
class NotifyServlet < WEBrick::HTTPServlet::AbstractServlet
|
68
70
|
def initialize(_server, block)
|
69
71
|
@callback = block
|
72
|
+
@parser = EasyUpnp::EventParser.new
|
70
73
|
end
|
71
74
|
|
72
75
|
def do_NOTIFY(request, response)
|
73
|
-
@callback.call(request)
|
76
|
+
@callback.call(@parser.parse(request.body))
|
74
77
|
end
|
75
78
|
end
|
76
79
|
end
|
data/lib/easy_upnp/version.rb
CHANGED
data/lib/easy_upnp.rb
ADDED
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.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Mullins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -66,12 +66,14 @@ files:
|
|
66
66
|
- Rakefile
|
67
67
|
- bin/upnp-list
|
68
68
|
- easy_upnp.gemspec
|
69
|
+
- lib/easy_upnp.rb
|
69
70
|
- lib/easy_upnp/control_point/argument_validator.rb
|
70
71
|
- lib/easy_upnp/control_point/client_wrapper.rb
|
71
72
|
- lib/easy_upnp/control_point/device_control_point.rb
|
72
73
|
- lib/easy_upnp/control_point/service_method.rb
|
73
74
|
- lib/easy_upnp/control_point/validator_provider.rb
|
74
75
|
- lib/easy_upnp/events/event_client.rb
|
76
|
+
- lib/easy_upnp/events/event_parser.rb
|
75
77
|
- lib/easy_upnp/events/http_listener.rb
|
76
78
|
- lib/easy_upnp/events/subscription_manager.rb
|
77
79
|
- lib/easy_upnp/options_base.rb
|