summaryrefslogtreecommitdiff
path: root/users/lib/webfinger
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-01-23 15:52:38 +0100
committerAzul <azul@leap.se>2013-01-23 16:17:51 +0100
commitefb9f511f426b9d6f3af63608e77f80c4b823fb0 (patch)
tree20329dfae6e6182ded56174c2bad21e114ae4583 /users/lib/webfinger
parent30f406de954bac1da5fef7cdd753c0af16f11051 (diff)
added a small test for HostMetaPresenter and using links hash in xml view
Diffstat (limited to 'users/lib/webfinger')
-rw-r--r--users/lib/webfinger/host_meta_presenter.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/users/lib/webfinger/host_meta_presenter.rb b/users/lib/webfinger/host_meta_presenter.rb
index 6a6235f..84ab7a9 100644
--- a/users/lib/webfinger/host_meta_presenter.rb
+++ b/users/lib/webfinger/host_meta_presenter.rb
@@ -5,22 +5,26 @@ class Webfinger::HostMetaPresenter
@request = request
end
+ def to_json(options = {})
+ {
+ subject: subject,
+ links: links
+ }.to_json(options)
+ end
+
def subject
url = URI.parse(@request.url)
url.path = ''
url.to_s
end
- def webfinger_template(path = 'webfinger', query_param='q')
- "#{subject}/#{path}?#{query_param}={uri}"
+ def links
+ { lrdd: { type: 'application/xrd+xml', template: webfinger_template } }
end
- def to_json(options = {})
- {
- subject: subject,
- links: {
- lrdd: { type: 'application/xrd+xml', template: webfinger_template }
- }
- }.to_json(options)
+ protected
+
+ def webfinger_template(path = 'webfinger', query_param='q')
+ "#{subject}/#{path}?#{query_param}={uri}"
end
end