easy_upnp 0.1.6 → 0.1.7

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: 2849bdeadd6cd4e7a7d1a64990a5cfdcd5074f87
4
- data.tar.gz: 0c6b0e8b1b59cf57811a6217caccf5d6e5cbb060
3
+ metadata.gz: d06b0e0d67f895da180b202c270c0407761dfaad
4
+ data.tar.gz: 199921fe3b7074fa1a1049e13649fe12a7c3b592
5
5
  SHA512:
6
- metadata.gz: c479a9a47ff6c655d320d25ed1778b19e60f99fe6576d325c747b877d41d54cd650d517d03a2e21864e11d27b4513c8178a5a0248130fe3fc5405177e37a75b2
7
- data.tar.gz: e3e01ee79d282d937432a23162a576c6a80415a09c393e949c469dbdc00cc2e3c7b3fb28094fb74b3994ecca53d4992cc0dc704bb741b1eb94755afc226482c3
6
+ metadata.gz: 183c88f2434861fe2ece10d326e6d7917c17ddc1a6d1c2dfc0547e7f1e5cfd4e986411e51529252ab94c0f780a6a1429fa289e0124ba9e4c54469501521adfe3
7
+ data.tar.gz: 8abb23495b5cc314f310daac1999a0ce55519176250d5121a134e93939cafc44b9390dbda3ff250513dc391f58ef2cceaa51d0555f02f4db84ef0dff29853145
data/README.md CHANGED
@@ -45,7 +45,7 @@ device.all_services
45
45
  You can then create a service client and make calls to the service:
46
46
 
47
47
  ```ruby
48
- service = service = device.service 'urn:schemas-upnp-org:service:ContentDirectory:1'
48
+ service = device.service 'urn:schemas-upnp-org:service:ContentDirectory:1'
49
49
 
50
50
  service.service_methods
51
51
  # => ["GetSearchCapabilities", "GetSortCapabilities", "GetSystemUpdateID", "Browse", "Search"]
@@ -7,11 +7,10 @@ require_relative 'device_control_point'
7
7
 
8
8
  module EasyUpnp
9
9
  class UpnpDevice
10
- attr_reader :uuid
10
+ attr_reader :uuid, :name, :host
11
11
 
12
12
  def initialize uuid, messages
13
13
  @uuid = uuid
14
-
15
14
  @service_definitions = messages.
16
15
  # Filter out messages that aren't service definitions. These include
17
16
  # the root device and the root UUID
@@ -21,11 +20,19 @@ module EasyUpnp
21
20
  group_by { |message| message[:st] }.
22
21
  map { |_, matching_messages| matching_messages.first }.
23
22
  map do |message|
24
- {
25
- :location => message[:location],
26
- :st => message[:st]
27
- }
28
- end
23
+ {
24
+ :location => message[:location],
25
+ :st => message[:st]
26
+ }
27
+ end
28
+
29
+ # Download one of the definitions to get the name of this device
30
+ service_location = @service_definitions.first[:location]
31
+
32
+ xml = Nokogiri::XML(open(service_location))
33
+ xml.remove_namespaces!
34
+ @name = xml.xpath('//device/friendlyName').text
35
+ @host = URI.parse(service_location).host
29
36
  end
30
37
 
31
38
  def all_services
@@ -1,3 +1,3 @@
1
1
  module EasyUpnp
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
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: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Mullins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-12 00:00:00.000000000 Z
11
+ date: 2015-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.0.14
117
+ rubygems_version: 2.4.8
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: A super easy to use UPnP control point client