Class: DIDKit::ServiceRecord
- Inherits:
-
Object
- Object
- DIDKit::ServiceRecord
- Defined in:
- lib/didkit/service_record.rb
Overview
A parsed service record from either a DID document’s service field or a PLC directory operation’s services field.
Instance Attribute Summary collapse
-
#endpoint ⇒ String
readonly
Service’s endpoint URL.
-
#key ⇒ String
readonly
Returns the service’s identifier (without ‘#`), like “atproto_pds”.
-
#type ⇒ String
readonly
Returns the service’s type field, like “AtprotoPersonalDataServer”.
Instance Method Summary collapse
-
#initialize(key, type, endpoint) ⇒ ServiceRecord
constructor
Create a service record from DID document fields.
Constructor Details
#initialize(key, type, endpoint) ⇒ ServiceRecord
Create a service record from DID document fields.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/didkit/service_record.rb', line 31 def initialize(key, type, endpoint) begin uri = URI(endpoint) rescue URI::Error raise FormatError, "Invalid service endpoint: #{endpoint.inspect}" end @key = key @type = type @endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ String (readonly)
Returns service’s endpoint URL.
22 23 24 |
# File 'lib/didkit/service_record.rb', line 22 def endpoint @endpoint end |
#key ⇒ String (readonly)
Returns the service’s identifier (without ‘#`), like “atproto_pds”.
15 16 17 |
# File 'lib/didkit/service_record.rb', line 15 def key @key end |
#type ⇒ String (readonly)
Returns the service’s type field, like “AtprotoPersonalDataServer”.
19 20 21 |
# File 'lib/didkit/service_record.rb', line 19 def type @type end |