easy_upnp 0.1.3 → 0.1.4

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
  !binary "U0hBMQ==":
3
- metadata.gz: e9f368715acba835a38294efd1ec026e8e53400e
4
- data.tar.gz: 309a486292c2ce750fe1a25bb3b5bb6af30cba06
3
+ metadata.gz: a6b753752916257d2f95d32a468f79b71c99b6ad
4
+ data.tar.gz: 31fcf01b8d619b31d001771fe337334b8bed124f
5
5
  !binary "U0hBNTEy":
6
- metadata.gz: 312b61519e68d976d089b7195fe2aad9dd57d5d5f35bcf5bfd9c615c3bb4049ba37edbba3baae0d10e8e4db69536fe5f0da1cd5dc38de322a571fcb912686efa
7
- data.tar.gz: 8d1cdd7f049db09b24f29cfb49b3f2f79c9d5378550ecc86649f8394b625a3d2d405eebb0216c6eed685dbd798cf14512ce1083d52f03dc4b044bf84e6845b5e
6
+ metadata.gz: 385b3a0aa8a1bbc401947f4f7cb491b0f94a28cbb7652519b011ba8a564890bb6b2de125cb4679034905bcdd68ba4cad5b18eaeff2df99d52f4cd1ed3ca6bdbd
7
+ data.tar.gz: 1362a9139d300698126102ec55d27064236211d4e398357a6d0b41d437c9bb33aeded088c71784c36668d67b47811cf5abfa75f6599d6710b3ab97b2901a6e08
data/README.md CHANGED
@@ -14,3 +14,42 @@ You can also add it to your Gemfile:
14
14
  ```
15
15
  gem 'easy_upnp'
16
16
  ```
17
+
18
+ ## Example usage
19
+
20
+ #### Find devices with SSDP
21
+
22
+ [Simple Service Discovery Protocol](http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf) (SSDP) is a simple UDP protocol used to discover services on a network. It's the entry point to create control points in easy_upnp.
23
+
24
+ The `search` method takes one argument -- the "search target". This controls a header sent in the SSDP packet which affects the devices that respond to the search query. You can use `'ssdp:all'` to specify that all devices should respond.
25
+
26
+ ```ruby
27
+ require 'easy_upnp/ssdp_searcher'
28
+
29
+ searcher = EasyUpnp::SsdpSearcher.new
30
+ devices = searcher.search 'ssdp:all'
31
+ ```
32
+
33
+ This will return a list of `EasyUpnp::UpnpDevice` objects. You'll use these to interact with devices on your network.
34
+
35
+ #### Interacting with a specific device
36
+
37
+ Once you have a `EasyUpnp::UpnpDevice`, you can start interacting with the services it advertizes. To get a list of all services a device supports:
38
+
39
+ ```ruby
40
+ device = devices.first
41
+ device.all_services
42
+ # => ["urn:schemas-upnp-org:service:ContentDirectory:1", "urn:schemas-upnp-org:service:ConnectionManager:1", "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1"]
43
+ ```
44
+
45
+ You can then create a service client and make calls to the service:
46
+
47
+ ```ruby
48
+ service = service = device.service 'urn:schemas-upnp-org:service:ContentDirectory:1'
49
+
50
+ service.service_methods
51
+ # => ["GetSearchCapabilities", "GetSortCapabilities", "GetSystemUpdateID", "Browse", "Search"]
52
+
53
+ service.GetSystemUpdateID
54
+ # => {:Id=>"207"}
55
+ ```
@@ -74,7 +74,7 @@ module EasyUpnp
74
74
 
75
75
  def service_definition(urn)
76
76
  @service_definitions.
77
- reject { |s| s[:st] == urn }.
77
+ reject { |s| s[:st] != urn }.
78
78
  first
79
79
  end
80
80
  end
@@ -1,3 +1,3 @@
1
1
  module EasyUpnp
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_upnp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Mullins