lupin 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 290ac6900a11d25d1377a0649e563234a61347c5ae62d5c3b4f9021fbfaedbba
4
+ data.tar.gz: 215b63dbe50329e4721fbe00916a8be849411ac8704fcdc9b5cd189434d95699
5
+ SHA512:
6
+ metadata.gz: 77d87e3243ca54def8cf4875ca8cf63f5dc53fd503fcff4dd87acb55a1f655174b35b79d4e5a6299f6f8134ee17b8ebd9afa5060e98454fc9668c5b84c69feaf
7
+ data.tar.gz: 0c53bae8c7481e573960ea3c4bbfba0878123af947551d5ebfd9537137036b6ce46cf2e6fb8a4d0b46c8718cb032d79258e7a4436c2a309a35ea883bbe8cfb16
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-10-25
4
+
5
+ - Initial release
@@ -0,0 +1,89 @@
1
+ # Contributor Covenant 3.0 Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We pledge to make our community welcoming, safe, and equitable for all.
6
+
7
+ We are committed to fostering an environment that respects and promotes the dignity, rights, and contributions of all individuals, regardless of characteristics including race, ethnicity, caste, colour, age, physical characteristics, neurodiversity, disability, sex or gender, gender identity or expression, sexual orientation, language, philosophy or religion, national or social origin, socio-economic position, level of education, or other status. The same privileges of participation are extended to everyone who participates in good faith and in accordance with this Covenant.
8
+
9
+
10
+ ## Encouraged Behaviours
11
+
12
+ While acknowledging differences in social norms, we all strive to meet our community's expectations for positive behaviour. We also understand that our words and actions may be interpreted differently than we intend based on culture, background, or native language.
13
+
14
+ With these considerations in mind, we agree to behave mindfully toward each other and act in ways that centre our shared values, including:
15
+
16
+ 1. Respecting the **purpose of our community**, our activities, and our ways of gathering.
17
+ 2. Engaging **kindly and honestly** with others.
18
+ 3. Respecting **different viewpoints** and experiences.
19
+ 4. **Taking responsibility** for our actions and contributions.
20
+ 5. Gracefully giving and accepting **constructive feedback**.
21
+ 6. Committing to **repairing harm** when it occurs.
22
+ 7. Behaving in other ways that promote and sustain the **well-being of our community**.
23
+
24
+
25
+ ## Restricted Behaviours
26
+
27
+ We agree to restrict the following behaviours in our community. Instances, threats, and promotion of these behaviours are violations of this Code of Conduct.
28
+
29
+ 1. **Harassment.** Violating explicitly expressed boundaries or engaging in unnecessary personal attention after any clear request to stop.
30
+ 2. **Character attacks.** Making insulting, demeaning, or pejorative comments directed at a community member or group of people.
31
+ 3. **Stereotyping or discrimination.** Characterising anyone’s personality or behaviour on the basis of immutable identities or traits.
32
+ 4. **Sexualization.** Behaving in a way that would generally be considered inappropriately intimate in the context or purpose of the community.
33
+ 5. **Violating confidentiality**. Sharing or acting on someone's personal or private information without their permission.
34
+ 6. **Endangerment.** Causing, encouraging, or threatening violence or other harm toward any person or group.
35
+ 7. Behaving in other ways that **threaten the well-being** of our community.
36
+
37
+ ### Other Restrictions
38
+
39
+ 1. **Misleading identity.** Impersonating someone else for any reason, or pretending to be someone else to evade enforcement actions.
40
+ 2. **Failing to credit sources.** Not properly crediting the sources of content you contribute.
41
+ 3. **Promotional materials**. Sharing marketing or other commercial content in a way that is outside the norms of the community.
42
+ 4. **Irresponsible communication.** Failing to responsibly present content which includes, links or describes any other restricted behaviours.
43
+
44
+
45
+ ## Reporting an Issue
46
+
47
+ Tensions can occur between community members even when they are trying their best to collaborate. Not every conflict represents a code of conduct violation, and this Code of Conduct reinforces encouraged behaviours and norms that can help avoid conflicts and minimise harm.
48
+
49
+ When an incident does occur, it is important to report it promptly. To report a possible violation, **[NOTE: describe your means of reporting here.]**
50
+
51
+ Community Moderators take reports of violations seriously and will make every effort to respond in a timely manner. They will investigate all reports of code of conduct violations, reviewing messages, logs, and recordings, or interviewing witnesses and other participants. Community Moderators will keep investigation and enforcement actions as transparent as possible while prioritising safety and confidentiality. In order to honour these values, enforcement actions are carried out in private with the involved parties, but communicating to the whole community may be part of a mutually agreed upon resolution.
52
+
53
+
54
+ ## Addressing and Repairing Harm
55
+
56
+ If an investigation by the Community Moderators finds that this Code of Conduct has been violated, the following enforcement ladder may be used to determine how best to repair harm, based on the incident's impact on the individuals involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be skipped.
57
+
58
+ 1) Warning
59
+ 1) Event: A violation involving a single incident or series of incidents.
60
+ 2) Consequence: A private, written warning from the Community Moderators.
61
+ 3) Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking clarification on expectations.
62
+ 2) Temporarily Limited Activities
63
+ 1) Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a more serious violation.
64
+ 2) Consequence: A private, written warning with a time-limited cooldown period designed to underscore the seriousness of the situation and give the community members involved time to process the incident. The cooldown period may be limited to particular communication channels or interactions with particular community members.
65
+ 3) Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and impact, and being thoughtful about re-entering community spaces after the period is over.
66
+ 3) Temporary Suspension
67
+ 1) Event: A pattern of repeated violation which the Community Moderators have tried to address with warnings, or a single serious violation.
68
+ 2) Consequence: A private written warning with conditions for return from suspension. In general, temporary suspensions give the person being suspended time to reflect upon their behaviour and possible corrective actions.
69
+ 3) Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for return, and being thoughtful about how to reintegrate with the community when the suspension is lifted.
70
+ 4) Permanent Ban
71
+ 1) Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member.
72
+ 2) Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behaviour.
73
+ 3) Repair: There is no possible repair in cases of this severity.
74
+
75
+ This enforcement ladder is intended as a guideline. It does not limit the ability of Community Managers to use their discretion and judgment, in keeping with the best interests of our community.
76
+
77
+
78
+ ## Scope
79
+
80
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public or other spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
81
+
82
+
83
+ ## Attribution
84
+
85
+ This Code of Conduct is adapted from the Contributor Covenant, version 3.0, permanently available at [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/).
86
+
87
+ Contributor Covenant is stewarded by the Organization for Ethical Source and licensed under CC BY-SA 4.0. To view a copy of this license, visit [https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/)
88
+
89
+ For answers to common questions about Contributor Covenant, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are provided at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations). Additional enforcement and community guideline resources can be found at [https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources). The enforcement ladder was inspired by the work of [Mozilla’s code of conduct team](https://github.com/mozilla/inclusion).
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Pat Allan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # Lupin
2
+
3
+ A *L*ight *UP*nP *IN*terface for Ruby.
4
+
5
+ UPnP requires caution, much like interactions with a gentlemen thief.
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ ```bash
12
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
13
+ ```
14
+
15
+ Or install it directly:
16
+
17
+ ```bash
18
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Using Lupin probably starts by discovering what devices you have access to:
24
+
25
+ ```ruby
26
+ # Discover all UPnP devices broadcasting on your network, waiting 2 seconds:
27
+ devices = Lupin::Scanner.call
28
+ # Or, find a specific service and/or with a custom waiting time:
29
+ devices = Lupin::Scanner.call(
30
+ "urn:schemas-upnp-org:device:ZonePlayer:1",
31
+ timeout: 5
32
+ )
33
+ ```
34
+
35
+ Keep in mind that devices can sometimes forget to respond, or respond slowly, so increasing the timeout value could be worthwhile.
36
+
37
+ You can also initialise a device directly with a description URI, which is a sensible move if you're referencing a device regularly (instead of waiting for discovery each time):
38
+
39
+ ```ruby
40
+ device = Lupin::Device.new(
41
+ URI("http://192.168.1.41:1400/xml/device_description.xml")
42
+ )
43
+ ```
44
+
45
+ Each device has attributes - some of which are available directly, but otherwise there's an `attribute` method.
46
+
47
+ ```ruby
48
+ device.device_type
49
+ device.friendly_name
50
+ device.udn
51
+ device.attribute("roomName")
52
+ ```
53
+
54
+ A device may contain sub-devices:
55
+
56
+ ```ruby
57
+ device.devices.collect(&:device_type)
58
+ # => [
59
+ # "urn:schemas-upnp-org:device:MediaServer:1",
60
+ # "urn:schemas-upnp-org:device:MediaRenderer:1"
61
+ # ]
62
+ ```
63
+
64
+ You can interrogate a device about its services, or request a service directly - the latter will consider all sub-devices as well:
65
+
66
+ ```ruby
67
+ device.services.collect(&:id)
68
+ # => [
69
+ # "urn:upnp-org:serviceId:AlarmClock",
70
+ # "urn:upnp-org:serviceId:MusicServices",
71
+ # "urn:upnp-org:serviceId:AudioIn",
72
+ # "urn:upnp-org:serviceId:DeviceProperties",
73
+ # "urn:upnp-org:serviceId:SystemProperties",
74
+ # "urn:upnp-org:serviceId:ZoneGroupTopology",
75
+ # "urn:upnp-org:serviceId:GroupManagement",
76
+ # "urn:tencent-com:serviceId:QPlay"
77
+ # ]
78
+
79
+ # Get a specific service by ID:
80
+ device.service("urn:upnp-org:serviceId:AVTransport")
81
+ # Provided there's no naming conflicts, short IDs work too:
82
+ device.service("AVTransport")
83
+ ```
84
+
85
+ And then, once you have a sense of which service you're dealing with, you can interrogate the available actions, and invoke them.
86
+
87
+ ```ruby
88
+ device.service("AVTransport").actions.collect(&:name)
89
+ # => [
90
+ # "SetAVTransportURI",
91
+ # "SetNextAVTransportURI",
92
+ # "AddURIToQueue",
93
+ # "AddMultipleURIsToQueue",
94
+ # ...
95
+ # ]
96
+
97
+ device.service("AVTransport").action("Play").call(
98
+ "InstanceID" => 0, "Speed" => 1
99
+ )
100
+
101
+ # You can also get details on the inputs and outputs of an action:
102
+ action = device.service("AVTransport").action("Play")
103
+ action.inputs # => ["InstanceID", "Speed"]
104
+ action.outputs # => []
105
+
106
+ # An action with outputs will return a hash of those output name/value pairs.
107
+ ```
108
+
109
+ ## Development
110
+
111
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment, and you can install this gem locally on your machine by running `bundle exec rake install`.
112
+
113
+ ## Contributing
114
+
115
+ Bug reports and pull requests are welcome on GitHub at https://codeberg.org/patallan/lupin. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://codeberg.org/patallan/lupin/src/branch/main/CODE_OF_CONDUCT.md).
116
+
117
+ ## License
118
+
119
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
120
+
121
+ ## Code of Conduct
122
+
123
+ Everyone interacting in the Lupin project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://codeberg.org/patallan/lupin/src/branch/main/CODE_OF_CONDUCT.md).
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "nokogiri"
5
+
6
+ require_relative "action_error"
7
+
8
+ module Lupin
9
+ class Action
10
+ attr_reader :inputs, :outputs
11
+
12
+ def initialize(host, namespace, node)
13
+ @host = host
14
+ @namespace = namespace
15
+ @node = node
16
+ @inputs = []
17
+ @outputs = []
18
+
19
+ parse_arguments
20
+ end
21
+
22
+ def call(arguments = {})
23
+ response = send_request(arguments)
24
+ raise ActionError, response.body if response.code != "200"
25
+
26
+ response_document = Nokogiri::XML(response.body)
27
+ outputs.each_with_object({}) do |name, hash|
28
+ node = response_document.xpath("//#{name}")
29
+ hash[name] = node.text
30
+ end
31
+ end
32
+
33
+ def name
34
+ @name ||= node.css("> name").text
35
+ end
36
+
37
+ private
38
+
39
+ attr_reader :host, :namespace, :node
40
+
41
+ def body(arguments)
42
+ <<~XML
43
+ <?xml version="1.0" encoding="utf-8"?>
44
+ <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
45
+ <s:Body>
46
+ <u:#{name} xmlns:u="#{namespace}">
47
+ #{body_inputs(arguments).join("\n")}
48
+ </u:#{name}>
49
+ </s:Body>
50
+ </s:Envelope>
51
+ XML
52
+ end
53
+
54
+ def body_inputs(arguments)
55
+ inputs.collect { |input| "<#{input}>#{arguments[input]}</#{input}>" }
56
+ end
57
+
58
+ def parse_arguments
59
+ node.css("argumentList argument").each do |argument|
60
+ if argument.css("direction").text == "in"
61
+ @inputs << argument.css("name").text
62
+ else
63
+ @outputs << argument.css("name").text
64
+ end
65
+ end
66
+ end
67
+
68
+ def send_request(arguments)
69
+ Net::HTTP.post(
70
+ host,
71
+ body(arguments),
72
+ {
73
+ "soapaction" => "#{namespace}##{name}",
74
+ "Content-Type" => 'text/xml; charset="utf-8"'
75
+ }
76
+ )
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "error"
4
+
5
+ module Lupin
6
+ class ActionError < Lupin::Error
7
+ end
8
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "nokogiri"
4
+
5
+ require_relative "service"
6
+
7
+ module Lupin
8
+ class Device
9
+ NAMESPACE = "urn:schemas-upnp-org:device-1-0"
10
+
11
+ attr_reader :description_uri
12
+
13
+ def initialize(description_uri, raw_document = nil)
14
+ @description_uri = description_uri
15
+ @raw_document = raw_document
16
+ end
17
+
18
+ def attribute(key)
19
+ xpath("/d:root/d:device/d:#{key}").text
20
+ end
21
+
22
+ def devices
23
+ @devices = xpath("/d:root/d:device/d:deviceList/d:device").collect do |node|
24
+ self.class.new(
25
+ description_uri,
26
+ "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">#{node}</root>"
27
+ )
28
+ end
29
+ end
30
+
31
+ def device_type
32
+ attribute("deviceType")
33
+ end
34
+
35
+ def friendly_name
36
+ attribute("friendlyName")
37
+ end
38
+
39
+ def udn
40
+ attribute("UDN")
41
+ end
42
+
43
+ def services
44
+ @services ||= xpath("/d:root/d:device/d:serviceList/d:service").collect do |node|
45
+ Service.new(description_uri.merge("/"), node)
46
+ end
47
+ end
48
+
49
+ def service(id)
50
+ all_services.detect { |service| service.id == id } ||
51
+ all_services.detect { |service| service.short_id == id }
52
+ end
53
+
54
+ private
55
+
56
+ def all_services
57
+ services + devices.collect(&:services).flatten
58
+ end
59
+
60
+ def document
61
+ @document ||= Nokogiri::XML.parse(raw_document).tap do |doc|
62
+ next unless doc.namespaces["xmlns"].nil?
63
+
64
+ doc.root.add_namespace(nil, NAMESPACE)
65
+ end
66
+ end
67
+
68
+ def raw_document
69
+ @raw_document ||= Net::HTTP.get(description_uri)
70
+ end
71
+
72
+ def xpath(path)
73
+ document.xpath(path, "d" => NAMESPACE)
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lupin
4
+ class Error < StandardError
5
+ end
6
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "socket"
5
+ require "timeout"
6
+ require "uri"
7
+
8
+ require_relative "device"
9
+
10
+ module Lupin
11
+ class Scanner
12
+ IP_ADDRESS = "239.255.255.250"
13
+ PORT = 1900
14
+
15
+ def self.call(...)
16
+ new(...).call
17
+ end
18
+
19
+ def initialize(search_target = "ssdp:all", timeout: 2)
20
+ @search_target = search_target
21
+ @timeout = timeout
22
+ end
23
+
24
+ def call
25
+ socket.send packet, 0, IP_ADDRESS, PORT
26
+
27
+ raw_messages
28
+ .collect { |message| response_for_message(message) }
29
+ .collect { |response| URI.parse(response["LOCATION"]) }
30
+ .uniq
31
+ .collect { |location| Device.new(location) }
32
+ end
33
+
34
+ private
35
+
36
+ attr_reader :search_target, :timeout
37
+
38
+ def packet
39
+ <<~PACKET
40
+ M-SEARCH * HTTP/1.1
41
+ HOST: #{IP_ADDRESS}:#{PORT}
42
+ MAN: "ssdp:discover"
43
+ MX: 1
44
+ ST: #{search_target}
45
+ PACKET
46
+ end
47
+
48
+ def raw_messages
49
+ messages = []
50
+
51
+ Timeout.timeout(timeout) do
52
+ loop do
53
+ messages.push(socket.recv(4196))
54
+ end
55
+ end
56
+ rescue Timeout::Error
57
+ # This is expected, as we're not going to wait forever.
58
+ messages
59
+ ensure
60
+ socket.close
61
+ end
62
+
63
+ # This wrangling is required to transform a string into a HTTP response
64
+ # object.
65
+ #
66
+ # Via https://stelfox.net/blog/2018/05/parsing-http-responses-in-ruby/
67
+ def response_for_message(message)
68
+ io = StringIO.new(message)
69
+ buffer = Net::BufferedIO.new(io)
70
+
71
+ response = Net::HTTPResponse.read_new(buffer)
72
+ response.reading_body(buffer, true) { yield res if block_given? }
73
+ response.uri = URI.parse("http://example.tld")
74
+ response
75
+ end
76
+
77
+ def socket
78
+ @socket ||= UDPSocket.open.tap do |udp_socket|
79
+ udp_socket.do_not_reverse_lookup = true
80
+
81
+ udp_socket.setsockopt(:IPPROTO_IP, :IP_MULTICAST_TTL, true)
82
+ udp_socket.setsockopt(:SOL_SOCKET, :SO_REUSEADDR, true)
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "nokogiri"
5
+
6
+ require_relative "action"
7
+
8
+ module Lupin
9
+ class Service
10
+ attr_reader :id
11
+
12
+ def initialize(host, node)
13
+ @host = host
14
+ @type = node.css("serviceType").text
15
+ @id = node.css("serviceId").text
16
+ @path = node.css("controlURL").text
17
+ @subscriptions = node.css("eventSubURL").text
18
+ @protocol_document = node.css("SCPDURL").text
19
+ end
20
+
21
+ def actions
22
+ @actions ||= document.css("actionList action").collect do |node|
23
+ Action.new(host.merge(path), type, node)
24
+ end
25
+ end
26
+
27
+ def action(name)
28
+ actions.detect { |action| action.name == name }
29
+ end
30
+
31
+ def short_id
32
+ id[/:serviceId:(.+)$/, 1]
33
+ end
34
+
35
+ private
36
+
37
+ attr_reader :host, :type, :path, :protocol_document
38
+
39
+ def document
40
+ @document ||= Nokogiri::XML(
41
+ Net::HTTP.get(host.merge(protocol_document))
42
+ )
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lupin
4
+ VERSION = "0.1.0"
5
+ end
data/lib/lupin.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lupin/device"
4
+ require_relative "lupin/scanner"
5
+ require_relative "lupin/version"
6
+
7
+ module Lupin
8
+ end
data/sig/lupin.rbs ADDED
@@ -0,0 +1,45 @@
1
+ module Lupin
2
+ VERSION: String
3
+
4
+ class Action
5
+ attr_reader inputs: Array[String]
6
+ attr_reader outputs: Array[String]
7
+
8
+ def initialize: (::URI host, String namespace, ::Nokogiri::XML::Node node) -> void
9
+ def call: (?::Hash[String, untyped] arguments) -> Hash[String, untyped]
10
+ def name: () -> String
11
+ end
12
+
13
+ class Device
14
+ NAMESPACE: "urn:schemas-upnp-org:device-1-0"
15
+
16
+ attr_reader description_uri: untyped
17
+
18
+ def initialize: (::URI description_uri, ?String? raw_document) -> void
19
+ def attribute: (String key) -> String
20
+ def devices: () -> Array[Lupin::Device]
21
+ def device_type: () -> String
22
+ def friendly_name: () -> String
23
+ def udn: () -> String
24
+ def services: () -> Array[Lupin::Service]
25
+ def service: (String id) -> Lupin::Service
26
+ end
27
+
28
+ class Scanner
29
+ IP_ADDRESS: "239.255.255.250"
30
+ PORT: 1900
31
+
32
+ def self.call: (?::String search_target, ?timeout: ::Numeric) -> Array[Lupin::Device]
33
+ def initialize: (?::String search_target, ?timeout: ::Numeric) -> void
34
+ def call: () -> Array[Lupin::Device]
35
+ end
36
+
37
+ class Service
38
+ attr_reader id: String
39
+
40
+ def initialize: (::URI host, ::Nokogiri::XML::Node node) -> void
41
+ def actions: () -> Array[Lupin::Action]
42
+ def action: (String name) -> untyped
43
+ def short_id: () -> String
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lupin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Pat Allan
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: nokogiri
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.17'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.17'
26
+ description: A light UPnP interface that offers interrogation of devices, services,
27
+ and actions.
28
+ email:
29
+ - pat@freelancing-gods.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - CHANGELOG.md
35
+ - CODE_OF_CONDUCT.md
36
+ - LICENSE.txt
37
+ - README.md
38
+ - lib/lupin.rb
39
+ - lib/lupin/action.rb
40
+ - lib/lupin/action_error.rb
41
+ - lib/lupin/device.rb
42
+ - lib/lupin/error.rb
43
+ - lib/lupin/scanner.rb
44
+ - lib/lupin/service.rb
45
+ - lib/lupin/version.rb
46
+ - sig/lupin.rbs
47
+ homepage: https://codeberg.org/patallan/lupin
48
+ licenses:
49
+ - MIT
50
+ metadata:
51
+ homepage_uri: https://codeberg.org/patallan/lupin
52
+ source_code_uri: https://codeberg.org/patallan/lupin
53
+ changelog_uri: https://codeberg.org/patallan/lupin/src/branch/main/CHANGELOG.md
54
+ rubygems_mfa_required: 'true'
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 3.2.0
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubygems_version: 3.7.2
70
+ specification_version: 4
71
+ summary: A light UPnP interface
72
+ test_files: []