Holds information about a M-SEARCH response
Date response was created or received
true if MAN header was understood
URI where this device or service is described
Maximum age this advertisement is valid for
Unique Service Name
Server version string
Search target
Creates a new Response
# File lib/UPnP/SSDP.rb, line 254 def initialize(date, max_age, location, server, target, name, ext) @date = date @max_age = max_age @location = location @server = server @target = target @name = name @ext = ext end
Creates a new Response by parsing the text in
response
# File lib/UPnP/SSDP.rb, line 227 def self.parse(response) response =~ %r^cache-control:\s*max-age\s*=\s*(\d+)/ max_age = Integer $1 response =~ %r^date:\s*(.*)/ date = $1 ? Time.parse($1) : Time.now ext = !!(response =~ %r^ext:/) response =~ %r^location:\s*(\S*)/ location = URI.parse $1.strip response =~ %r^server:\s*(.*)/ server = $1.strip response =~ %r^st:\s*(\S*)/ target = $1.strip response =~ %r^usn:\s*(\S*)/ name = $1.strip new date, max_age, location, server, target, name, ext end
A friendlier inspect
# File lib/UPnP/SSDP.rb, line 267 def inspect "#<#{self.class}:0x#{object_id.to_s 16} #{target} #{location}>" end