Class: AtprotoAuth::ServerMetadata::ResourceServer

Inherits:
Object
  • Object
show all
Defined in:
lib/atproto_auth/server_metadata/resource_server.rb

Overview

This class represents a Resource Server (PDS) and is responsible for validating and managing its metadata. It ensures that the authorization server URLs provided are valid and compliant with expected standards. The class also includes functionality to fetch and parse metadata from a remote URL, raising specific errors for invalid or malformed metadata.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata) ⇒ ResourceServer

Returns a new instance of ResourceServer.



13
14
15
# File 'lib/atproto_auth/server_metadata/resource_server.rb', line 13

def initialize()
  @authorization_servers = validate_authorization_servers!(["authorization_servers"])
end

Instance Attribute Details

#authorization_serversObject (readonly)

Returns the value of attribute authorization_servers.



11
12
13
# File 'lib/atproto_auth/server_metadata/resource_server.rb', line 11

def authorization_servers
  @authorization_servers
end

Class Method Details

.from_url(url) ⇒ ResourceServer

Fetches and validates Resource Server metadata from a URL

Parameters:

  • url (String)

    PDS URL to fetch metadata from

Returns:

Raises:



21
22
23
24
# File 'lib/atproto_auth/server_metadata/resource_server.rb', line 21

def self.from_url(url)
  response = (url)
  new((response[:body]))
end