Module: Skyfall::Collection
- Defined in:
- lib/skyfall/collection.rb
Overview
This module defines constants for known Bluesky record collection types, and a mapping of those names to symbol short codes which can be used as shorthand when processing events or in Jetstream filters.
Constant Summary collapse
- BSKY_PROFILE =
"app.bsky.actor.profile"- BSKY_ACTOR_STATUS =
"app.bsky.actor.status"- BSKY_FEED =
"app.bsky.feed.generator"- BSKY_LIKE =
"app.bsky.feed.like"- BSKY_POST =
"app.bsky.feed.post"- BSKY_POSTGATE =
"app.bsky.feed.postgate"- BSKY_REPOST =
"app.bsky.feed.repost"- BSKY_THREADGATE =
"app.bsky.feed.threadgate"- BSKY_BLOCK =
"app.bsky.graph.block"- BSKY_FOLLOW =
"app.bsky.graph.follow"- BSKY_LIST =
"app.bsky.graph.list"- BSKY_LISTBLOCK =
"app.bsky.graph.listblock"- BSKY_LISTITEM =
"app.bsky.graph.listitem"- BSKY_STARTERPACK =
"app.bsky.graph.starterpack"- BSKY_VERIFICATION =
"app.bsky.graph.verification"- BSKY_LABELER =
"app.bsky.labeler.service"- BSKY_NOTIF_DECLARATION =
"app.bsky.notification.declaration"- BSKY_CHAT_DECLARATION =
"chat.bsky.actor.declaration"- SHORT_CODES =
Mapping of NSID collection names to symbol short codes
{ BSKY_ACTOR_STATUS => :bsky_actor_status, BSKY_BLOCK => :bsky_block, BSKY_FEED => :bsky_feed, BSKY_FOLLOW => :bsky_follow, BSKY_LABELER => :bsky_labeler, BSKY_LIKE => :bsky_like, BSKY_LIST => :bsky_list, BSKY_LISTBLOCK => :bsky_listblock, BSKY_LISTITEM => :bsky_listitem, BSKY_POST => :bsky_post, BSKY_POSTGATE => :bsky_postgate, BSKY_PROFILE => :bsky_profile, BSKY_REPOST => :bsky_repost, BSKY_STARTERPACK => :bsky_starterpack, BSKY_THREADGATE => :bsky_threadgate, BSKY_VERIFICATION => :bsky_verification, BSKY_CHAT_DECLARATION => :bsky_chat_declaration, BSKY_NOTIF_DECLARATION => :bsky_notif_declaration }
Class Method Summary collapse
-
.from_short_code(code) ⇒ String?
Returns a collection NSID assigned to a given short code symbol, if one is defined.
-
.short_code(collection) ⇒ Symbol
Returns a symbol short code for a given collection NSID, or
:unknownif NSID is not on the list.
Class Method Details
.from_short_code(code) ⇒ String?
Returns a collection NSID assigned to a given short code symbol, if one is defined.
68 69 70 |
# File 'lib/skyfall/collection.rb', line 68 def self.from_short_code(code) SHORT_CODES.detect { |k, v| v == code }&.first end |
.short_code(collection) ⇒ Symbol
Returns a symbol short code for a given collection NSID, or :unknown if NSID is not on the list.
60 61 62 |
# File 'lib/skyfall/collection.rb', line 60 def self.short_code(collection) SHORT_CODES[collection] || :unknown end |