mirror of https://github.com/mastodon/goldfinger
parent
75f1b1faf9
commit
f127a1f30f
@ -0,0 +1,53 @@
|
||||
module Goldfinger
|
||||
# @!attribute [r] href
|
||||
# @return [String] The href the link points to
|
||||
# @!attribute [r] type
|
||||
# @return [String] The mime type of the link
|
||||
# @!attribute [r] rel
|
||||
# @return [String] The relation descriptor of the link
|
||||
class Link
|
||||
attr_reader :href, :type, :rel
|
||||
|
||||
def initialize(a)
|
||||
@href = a[:href]
|
||||
@type = a[:type]
|
||||
@rel = a[:rel]
|
||||
@titles = a[:titles]
|
||||
@properties = a[:properties]
|
||||
end
|
||||
|
||||
# The "titles" object comprises zero or more name/value pairs whose
|
||||
# names are a language tag or the string "und". The string is
|
||||
# human-readable and describes the link relation.
|
||||
# @see #title
|
||||
# @return [Array] Array form of the hash
|
||||
def titles
|
||||
@titles.to_a
|
||||
end
|
||||
|
||||
# The "properties" object within the link relation object comprises
|
||||
# zero or more name/value pairs whose names are URIs (referred to as
|
||||
# "property identifiers") and whose values are strings or nil.
|
||||
# Properties are used to convey additional information about the link
|
||||
# relation.
|
||||
# @see #property
|
||||
# @return [Array] Array form of the hash
|
||||
def properties
|
||||
@properties.to_a
|
||||
end
|
||||
|
||||
# Returns a title for a language
|
||||
# @param lang [String]
|
||||
# @return [String]
|
||||
def title(lang)
|
||||
@titles[lang]
|
||||
end
|
||||
|
||||
# Returns a property for a key
|
||||
# @param key [String]
|
||||
# @return [String]
|
||||
def property(key)
|
||||
@properties[key]
|
||||
end
|
||||
end
|
||||
end
|
@ -1 +1,77 @@
|
||||
{"subject":"acct:gargron@quitter.no","aliases":["https:\/\/quitter.no\/user\/7477","https:\/\/quitter.no\/gargron"],"links":[{"rel":"http:\/\/webfinger.net\/rel\/profile-page","type":"text\/html","href":"https:\/\/quitter.no\/gargron"},{"rel":"http:\/\/gmpg.org\/xfn\/11","type":"text\/html","href":"https:\/\/quitter.no\/gargron"},{"rel":"describedby","type":"application\/rdf+xml","href":"https:\/\/quitter.no\/gargron\/foaf"},{"rel":"http:\/\/apinamespace.org\/atom","type":"application\/atomsvc+xml","href":"https:\/\/quitter.no\/api\/statusnet\/app\/service\/gargron.xml"},{"rel":"http:\/\/apinamespace.org\/twitter","href":"https:\/\/quitter.no\/api\/"},{"rel":"http:\/\/specs.openid.net\/auth\/2.0\/provider","href":"https:\/\/quitter.no\/gargron"},{"rel":"http:\/\/schemas.google.com\/g\/2010#updates-from","type":"application\/atom+xml","href":"https:\/\/quitter.no\/api\/statuses\/user_timeline\/7477.atom"},{"rel":"magic-public-key","href":"data:application\/magic-public-key,RSA.1ZBkHTavLvxH3FzlKv4O6WtlILKRFfNami3_Rcu8EuogtXSYiS-bB6hElZfUCSHbC4uLemOA34PEhz__CDMozax1iI_t8dzjDnh1x0iFSup7pSfW9iXk_WU3Dm74yWWW2jildY41vWgrEstuQ1dJ8vVFfSJ9T_tO4c-T9y8vDI8=.AQAB"},{"rel":"salmon","href":"https:\/\/quitter.no\/main\/salmon\/user\/7477"},{"rel":"http:\/\/salmon-protocol.org\/ns\/salmon-replies","href":"https:\/\/quitter.no\/main\/salmon\/user\/7477"},{"rel":"http:\/\/salmon-protocol.org\/ns\/salmon-mention","href":"https:\/\/quitter.no\/main\/salmon\/user\/7477"},{"rel":"http:\/\/ostatus.org\/schema\/1.0\/subscribe","template":"https:\/\/quitter.no\/main\/ostatussub?profile={uri}"}]}
|
||||
{
|
||||
"subject": "acct:gargron@quitter.no",
|
||||
"aliases": [
|
||||
"https://quitter.no/user/7477",
|
||||
"https://quitter.no/gargron"
|
||||
],
|
||||
"properties": {
|
||||
"http://webfinger.example/ns/name": "Bob Smith"
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"rel": "http://webfinger.net/rel/profile-page",
|
||||
"type": "text/html",
|
||||
"href": "https://quitter.no/gargron"
|
||||
},
|
||||
{
|
||||
"rel": "http://gmpg.org/xfn/11",
|
||||
"type": "text/html",
|
||||
"href": "https://quitter.no/gargron"
|
||||
},
|
||||
{
|
||||
"rel": "describedby",
|
||||
"type": "application/rdf+xml",
|
||||
"href": "https://quitter.no/gargron/foaf"
|
||||
},
|
||||
{
|
||||
"rel": "http://apinamespace.org/atom",
|
||||
"type": "application/atomsvc+xml",
|
||||
"href": "https://quitter.no/api/statusnet/app/service/gargron.xml"
|
||||
},
|
||||
{
|
||||
"rel": "http://apinamespace.org/twitter",
|
||||
"href": "https://quitter.no/api/"
|
||||
},
|
||||
{
|
||||
"rel": "http://specs.openid.net/auth/2.0/provider",
|
||||
"href": "https://quitter.no/gargron"
|
||||
},
|
||||
{
|
||||
"rel": "http://schemas.google.com/g/2010#updates-from",
|
||||
"type": "application/atom+xml",
|
||||
"href": "https://quitter.no/api/statuses/user_timeline/7477.atom"
|
||||
},
|
||||
{
|
||||
"rel": "magic-public-key",
|
||||
"href": "data:application/magic-public-key,RSA.1ZBkHTavLvxH3FzlKv4O6WtlILKRFfNami3_Rcu8EuogtXSYiS-bB6hElZfUCSHbC4uLemOA34PEhz__CDMozax1iI_t8dzjDnh1x0iFSup7pSfW9iXk_WU3Dm74yWWW2jildY41vWgrEstuQ1dJ8vVFfSJ9T_tO4c-T9y8vDI8=.AQAB"
|
||||
},
|
||||
{
|
||||
"rel": "salmon",
|
||||
"href": "https://quitter.no/main/salmon/user/7477"
|
||||
},
|
||||
{
|
||||
"rel": "http://salmon-protocol.org/ns/salmon-replies",
|
||||
"href": "https://quitter.no/main/salmon/user/7477"
|
||||
},
|
||||
{
|
||||
"rel": "http://salmon-protocol.org/ns/salmon-mention",
|
||||
"href": "https://quitter.no/main/salmon/user/7477"
|
||||
},
|
||||
{
|
||||
"rel": "http://ostatus.org/schema/1.0/subscribe",
|
||||
"template": "https://quitter.no/main/ostatussub?profile={uri}"
|
||||
},
|
||||
{
|
||||
"rel": "http://spec.example.net/photo/1.0",
|
||||
"type": "image/jpeg",
|
||||
"href": "http://photos.example.com/gpburdell.jpg",
|
||||
"titles": {
|
||||
"en": "User Photo",
|
||||
"de": "Benutzerfoto"
|
||||
},
|
||||
"properties": {
|
||||
"http://spec.example.net/created/1.0": "1970-01-01"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,18 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||
<Subject>acct:gargron@quitter.no</Subject>
|
||||
<Alias>https://quitter.no/user/7477</Alias>
|
||||
<Alias>https://quitter.no/gargron</Alias>
|
||||
<Link rel="http://webfinger.net/rel/profile-page" type="text/html" href="https://quitter.no/gargron"/>
|
||||
<Link rel="http://gmpg.org/xfn/11" type="text/html" href="https://quitter.no/gargron"/>
|
||||
<Link rel="describedby" type="application/rdf+xml" href="https://quitter.no/gargron/foaf"/>
|
||||
<Link rel="http://apinamespace.org/atom" type="application/atomsvc+xml" href="https://quitter.no/api/statusnet/app/service/gargron.xml"/>
|
||||
<Link rel="http://apinamespace.org/twitter" href="https://quitter.no/api/"/>
|
||||
<Link rel="http://specs.openid.net/auth/2.0/provider" href="https://quitter.no/gargron"/>
|
||||
<Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="https://quitter.no/api/statuses/user_timeline/7477.atom"/>
|
||||
<Link rel="magic-public-key" href="data:application/magic-public-key,RSA.1ZBkHTavLvxH3FzlKv4O6WtlILKRFfNami3_Rcu8EuogtXSYiS-bB6hElZfUCSHbC4uLemOA34PEhz__CDMozax1iI_t8dzjDnh1x0iFSup7pSfW9iXk_WU3Dm74yWWW2jildY41vWgrEstuQ1dJ8vVFfSJ9T_tO4c-T9y8vDI8=.AQAB"/>
|
||||
<Link rel="salmon" href="https://quitter.no/main/salmon/user/7477"/>
|
||||
<Link rel="http://salmon-protocol.org/ns/salmon-replies" href="https://quitter.no/main/salmon/user/7477"/>
|
||||
<Link rel="http://salmon-protocol.org/ns/salmon-mention" href="https://quitter.no/main/salmon/user/7477"/>
|
||||
<Link rel="http://ostatus.org/schema/1.0/subscribe" template="https://quitter.no/main/ostatussub?profile={uri}"/>
|
||||
<Subject>acct:gargron@quitter.no</Subject>
|
||||
<Alias>https://quitter.no/user/7477</Alias>
|
||||
<Alias>https://quitter.no/gargron</Alias>
|
||||
<Property type="http://webfinger.example/ns/name">Bob Smith</Property>
|
||||
<Link rel="http://webfinger.net/rel/profile-page" type="text/html" href="https://quitter.no/gargron" />
|
||||
<Link rel="http://gmpg.org/xfn/11" type="text/html" href="https://quitter.no/gargron" />
|
||||
<Link rel="describedby" type="application/rdf+xml" href="https://quitter.no/gargron/foaf" />
|
||||
<Link rel="http://apinamespace.org/atom" type="application/atomsvc+xml" href="https://quitter.no/api/statusnet/app/service/gargron.xml" />
|
||||
<Link rel="http://apinamespace.org/twitter" href="https://quitter.no/api/" />
|
||||
<Link rel="http://specs.openid.net/auth/2.0/provider" href="https://quitter.no/gargron" />
|
||||
<Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="https://quitter.no/api/statuses/user_timeline/7477.atom" />
|
||||
<Link rel="magic-public-key" href="data:application/magic-public-key,RSA.1ZBkHTavLvxH3FzlKv4O6WtlILKRFfNami3_Rcu8EuogtXSYiS-bB6hElZfUCSHbC4uLemOA34PEhz__CDMozax1iI_t8dzjDnh1x0iFSup7pSfW9iXk_WU3Dm74yWWW2jildY41vWgrEstuQ1dJ8vVFfSJ9T_tO4c-T9y8vDI8=.AQAB" />
|
||||
<Link rel="salmon" href="https://quitter.no/main/salmon/user/7477" />
|
||||
<Link rel="http://salmon-protocol.org/ns/salmon-replies" href="https://quitter.no/main/salmon/user/7477" />
|
||||
<Link rel="http://salmon-protocol.org/ns/salmon-mention" href="https://quitter.no/main/salmon/user/7477" />
|
||||
<Link rel="http://ostatus.org/schema/1.0/subscribe" template="https://quitter.no/main/ostatussub?profile={uri}" />
|
||||
<Link rel="http://spec.example.net/photo/1.0" type="image/jpeg" href="http://photos.example.com/gpburdell.jpg">
|
||||
<Title xml:lang="en">User Photo</Title>
|
||||
<Title xml:lang="de">Benutzerfoto</Title>
|
||||
<Property type="http://spec.example.net/created/1.0">1970-01-01</Property>
|
||||
</Link>
|
||||
</XRD>
|
||||
|
Loading…
Reference in new issue