Class: ActivityPub::WebFingerResult

Inherits:
Object
  • Object
show all
Defined in:
lib/activitypub/webfinger.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ WebFingerResult

Returns a new instance of WebFingerResult.



6
7
8
9
10
11
12
13
14
15
# File 'lib/activitypub/webfinger.rb', line 6

def initialize(hash)
  @h = hash

  @h["aliases"] = @h["aliases"].map{ ActivityPub::URI.new(_1) }
  @h["links"].each do |v|
    if v["href"]
      v["href"] = ActivityPub::URI.new(v["href"])
    end
  end
end

Instance Method Details

#[](i) ⇒ Object



17
# File 'lib/activitypub/webfinger.rb', line 17

def[](i) = @h[i]

#activitypubObject



19
20
21
# File 'lib/activitypub/webfinger.rb', line 19

def activitypub
  @activitypub ||= self["links"].find{ _1["rel"] == "self" && _1["type"] == "application/activity+json" }&.dig("href")
end