add private_class_method again

This commit is contained in:
Benjamin Neff 2015-06-19 04:15:06 +02:00
parent efd5a89d1b
commit 46295b9c0c
3 changed files with 8 additions and 4 deletions

View file

@ -19,7 +19,7 @@ module DiasporaFederation
end end
## ##
# this is the pre RFC 7033 webfinger # @deprecated this is the pre RFC 7033 webfinger
# #
# GET /webfinger?q=<uri> # GET /webfinger?q=<uri>
def legacy_webfinger def legacy_webfinger

View file

@ -77,8 +77,6 @@ module DiasporaFederation
hm hm
end end
private
## ##
# Applies some basic sanity-checking to the given URL # Applies some basic sanity-checking to the given URL
# @param [String] url validation subject # @param [String] url validation subject
@ -86,6 +84,7 @@ module DiasporaFederation
def self.webfinger_url_valid?(url) def self.webfinger_url_valid?(url)
!url.nil? && url.instance_of?(String) && url =~ %r{^https?:\/\/.*\{uri\}}i !url.nil? && url.instance_of?(String) && url =~ %r{^https?:\/\/.*\{uri\}}i
end end
private_class_method :webfinger_url_valid?
## ##
# Gets the webfinger url from an XRD data structure # Gets the webfinger url from an XRD data structure
@ -95,6 +94,7 @@ module DiasporaFederation
link = data[:links].find {|l| (l[:rel] == "lrdd" && l[:type] == "application/xrd+xml") } link = data[:links].find {|l| (l[:rel] == "lrdd" && l[:type] == "application/xrd+xml") }
return link[:template] unless link.nil? return link[:template] unless link.nil?
end end
private_class_method :webfinger_url_from_xrd
end end
end end
end end

View file

@ -15,7 +15,7 @@ module DiasporaFederation
# @example Creating a XrdDocument # @example Creating a XrdDocument
# doc = XrdDocument.new # doc = XrdDocument.new
# doc.expires = DateTime.new(2020, 1, 15, 0, 0, 1) # doc.expires = DateTime.new(2020, 1, 15, 0, 0, 1)
# doc.subject = "http://example.tld/articles/11"" # doc.subject = "http://example.tld/articles/11"
# doc.aliases << "http://example.tld/cool_article" # doc.aliases << "http://example.tld/cool_article"
# doc.aliases << "http://example.tld/authors/2/articles/3" # doc.aliases << "http://example.tld/authors/2/articles/3"
# doc.properties["http://x.example.tld/ns/version"] = "1.3" # doc.properties["http://x.example.tld/ns/version"] = "1.3"
@ -137,6 +137,7 @@ module DiasporaFederation
raise InvalidDocument, "Not an XRD document" if !doc.root || doc.root.name != "XRD" raise InvalidDocument, "Not an XRD document" if !doc.root || doc.root.name != "XRD"
doc doc
end end
private_class_method :parse_xrd_document
def self.parse_aliases_from_xml_doc(doc, data) def self.parse_aliases_from_xml_doc(doc, data)
aliases = [] aliases = []
@ -145,6 +146,7 @@ module DiasporaFederation
end end
data[:aliases] = aliases unless aliases.empty? data[:aliases] = aliases unless aliases.empty?
end end
private_class_method :parse_aliases_from_xml_doc
def self.parse_properties_from_xml_doc(doc, data) def self.parse_properties_from_xml_doc(doc, data)
properties = {} properties = {}
@ -153,6 +155,7 @@ module DiasporaFederation
end end
data[:properties] = properties unless properties.empty? data[:properties] = properties unless properties.empty?
end end
private_class_method :parse_properties_from_xml_doc
def self.parse_links_from_xml_doc(doc, data) def self.parse_links_from_xml_doc(doc, data)
links = [] links = []
@ -165,6 +168,7 @@ module DiasporaFederation
end end
data[:links] = links unless links.empty? data[:links] = links unless links.empty?
end end
private_class_method :parse_links_from_xml_doc
end end
end end
end end