Class: ATProto::Repo
- Inherits:
-
Object
- Object
- ATProto::Repo
- Extended by:
- T::Sig
- Includes:
- RequestUtils
- Defined in:
- lib/at_protocol/repo.rb,
lib/at_protocol/collection.rb
Overview
typed: true
Defined Under Namespace
Classes: Collection
Instance Attribute Summary collapse
-
#did ⇒ Object
readonly
Returns the value of attribute did.
-
#pds ⇒ Object
readonly
Returns the value of attribute pds.
-
#record_list ⇒ Object
readonly
Returns the value of attribute record_list.
-
#xrpc ⇒ Object
readonly
Returns the value of attribute xrpc.
Instance Method Summary collapse
- #[](collection) ⇒ Object
- #describe_repo ⇒ Object
- #did_document ⇒ Object
-
#initialize(username, pds = "https://bsky.social", open: true, authenticate: nil) ⇒ Repo
constructor
A new instance of Repo.
- #inspect ⇒ Object
- #open! ⇒ Object
- #to_s ⇒ Object
- #to_uri ⇒ Object
Methods included from RequestUtils
at_uri, #create_session_uri, #default_authenticated_headers, #default_headers, #delete_record_uri, #delete_session_uri, #get_paginated_data, #get_post_thread_uri, #get_session_uri, #mute_actor_uri, #query_obj_to_query_params, #refresh_session_uri, #refresh_token_headers, #resolve_handle, #upload_blob_uri
Constructor Details
#initialize(username, pds = "https://bsky.social", open: true, authenticate: nil) ⇒ Repo
Returns a new instance of Repo.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/at_protocol/repo.rb', line 14 def initialize(username, pds = "https://bsky.social", open: true, authenticate: nil) @pds = T.let pds, String @xrpc = T.let(XRPC::Client.new(pds), XRPC::Client) if username.start_with?("did:") @did = T.let(username, String) else @did = T.let(resolve_handle(username, pds), String) end @record_list = [] if open == true open! end end |
Instance Attribute Details
#did ⇒ Object (readonly)
Returns the value of attribute did.
66 67 68 |
# File 'lib/at_protocol/repo.rb', line 66 def did @did end |
#pds ⇒ Object (readonly)
Returns the value of attribute pds.
66 67 68 |
# File 'lib/at_protocol/repo.rb', line 66 def pds @pds end |
#record_list ⇒ Object (readonly)
Returns the value of attribute record_list.
66 67 68 |
# File 'lib/at_protocol/repo.rb', line 66 def record_list @record_list end |
#xrpc ⇒ Object (readonly)
Returns the value of attribute xrpc.
66 67 68 |
# File 'lib/at_protocol/repo.rb', line 66 def xrpc @xrpc end |
Instance Method Details
#[](collection) ⇒ Object
58 59 60 |
# File 'lib/at_protocol/repo.rb', line 58 def [](collection) Collection.new(repo: self, collection: collection) end |
#describe_repo ⇒ Object
46 47 48 |
# File 'lib/at_protocol/repo.rb', line 46 def describe_repo @xrpc.get.com_atproto_repo_describeRepo(repo: @did) end |
#did_document ⇒ Object
52 53 54 |
# File 'lib/at_protocol/repo.rb', line 52 def did_document describe_repo()["didDoc"] end |
#inspect ⇒ Object
62 63 64 |
# File 'lib/at_protocol/repo.rb', line 62 def inspect "Repo(#{@did})" end |
#open! ⇒ Object
28 29 30 |
# File 'lib/at_protocol/repo.rb', line 28 def open! @collections = describe_repo["collections"] end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/at_protocol/repo.rb', line 40 def to_s @did end |
#to_uri ⇒ Object
34 35 36 |
# File 'lib/at_protocol/repo.rb', line 34 def to_uri "at://#{@did}/" end |