Module: DIDKit::Services Private
- Included in:
- Document, PLCOperation
- Defined in:
- lib/didkit/services.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#get_service(key, type) ⇒ ServiceRecord?
Finds a service entry matching the given key and type.
-
#labeler_endpoint ⇒ String?
(also: #labeller_endpoint)
Returns the labeler service endpoint, if present.
-
#labeler_host ⇒ String?
(also: #labeller_host)
Returns the hostname of the labeler service, if present.
-
#pds_endpoint ⇒ String?
Returns the PDS service endpoint, if present.
-
#pds_host ⇒ String?
Returns the hostname of the PDS service, if present.
Instance Method Details
#get_service(key, type) ⇒ ServiceRecord?
Finds a service entry matching the given key and type.
20 21 22 |
# File 'lib/didkit/services.rb', line 20 def get_service(key, type) @services&.detect { |s| s.key == key && s.type == type } end |
#labeler_endpoint ⇒ String? Also known as: labeller_endpoint
Returns the labeler service endpoint, if present.
If the DID has an #atproto_labeler service declared in its service section, returns the URL in its serviceEndpoint field.
45 46 47 |
# File 'lib/didkit/services.rb', line 45 def labeler_endpoint @labeler_endpoint ||= get_service('atproto_labeler', 'AtprotoLabeler')&.endpoint end |
#labeler_host ⇒ String? Also known as: labeller_host
Returns the hostname of the labeler service, if present.
63 64 65 |
# File 'lib/didkit/services.rb', line 63 def labeler_host labeler_endpoint&.then { |x| URI(x).host } end |
#pds_endpoint ⇒ String?
Returns the PDS service endpoint, if present.
If the DID has an #atproto_pds service declared in its service section, returns the URL in its serviceEndpoint field. In other words, this is the URL of the PDS assigned to a given user, which stores the user’s account and repo.
33 34 35 |
# File 'lib/didkit/services.rb', line 33 def pds_endpoint @pds_endpoint ||= get_service('atproto_pds', 'AtprotoPersonalDataServer')&.endpoint end |
#pds_host ⇒ String?
Returns the hostname of the PDS service, if present.
54 55 56 |
# File 'lib/didkit/services.rb', line 54 def pds_host pds_endpoint&.then { |x| URI(x).host } end |