Class: Bridgetown::Webfinger::Builder::StaticFile

Inherits:
GeneratedPage
  • Object
show all
Defined in:
lib/bridgetown/webfinger/builder.rb

Overview

The static Webfinger file to serve

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site, account:, data:, host:) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes a new static Webfinger file

Parameters:

  • site (Bridgetown::Site)

    the site object

  • account (String)

    the account for the URI::Acct

  • data (HashWithDotAccess::Hash)

    the data for the Webfinger JRD

  • host (String)

    the host for the URI::Acct

Since:

  • 0.1.0



106
107
108
109
110
111
112
113
# File 'lib/bridgetown/webfinger/builder.rb', line 106

def initialize(site, account:, data:, host:)
  super(site, __dir__, "/.well-known", "webfinger", from_plugin: true)

  @subject = URI::Acct.build({account: , host: host}).to_s
  @jrd = JRD.parse(@subject, data.webfinger)

  self.content = JSON.pretty_generate(@jrd.to_h)
end

Instance Attribute Details

#jrdJRD (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The JRD forming the data model for the static Webfinger page

Returns:

  • (JRD)

    the JSON Resource Descriptor to serve for Webfinger

Since:

  • 0.1.0



121
122
123
# File 'lib/bridgetown/webfinger/builder.rb', line 121

def jrd
  @jrd
end

#subjectString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The subject of the JRD

Returns:

  • (String)

    the subject for the JRD to serve

Since:

  • 0.1.0



129
130
131
# File 'lib/bridgetown/webfinger/builder.rb', line 129

def subject
  @subject
end