Class: BlueFactory::FeedHandler Abstract
- Inherits:
-
Object
- Object
- BlueFactory::FeedHandler
- Defined in:
- lib/blue_factory/feed_handler.rb
Overview
This is not a real class, but it shows what your feed class should look like.
Abstract interface describing the API that the feed class that will be handling the requests
sent to getFeedSkeleton, which you pass to BlueFactory::Feeds#add_feed, is expected to have.
All methods except #get_posts are only used briefly when submitting the feed as a record
using the bluesky:publish rake task, so only #get_posts is really required during normal
day to day operation.
Instance Method Summary collapse
-
#accepts_interactions ⇒ Boolean
(optional) Return true to opt-in to receiving interactions from users viewing the feed.
-
#avatar_file ⇒ String?
(optional) Path of the image file which will be used as the feed's avatar (PNG or JPG).
-
#content_mode ⇒ String?
(optional) Special feed type - return
:videofor video feeds. -
#description ⇒ String?
(optional) Longer description of the feed, which explains how the feed works and what kind of content it serves.
-
#display_name ⇒ String
Returns the name of the feed that will be shown to the user in the app.
-
#get_posts(params, context = nil) ⇒ Object
The main method required to serve a feed.
Instance Method Details
#accepts_interactions ⇒ Boolean
(optional) Return true to opt-in to receiving interactions from users viewing the feed.
148 149 |
# File 'lib/blue_factory/feed_handler.rb', line 148 def accepts_interactions end |
#avatar_file ⇒ String?
(optional) Path of the image file which will be used as the feed's avatar (PNG or JPG).
133 134 |
# File 'lib/blue_factory/feed_handler.rb', line 133 def avatar_file end |
#content_mode ⇒ String?
(optional) Special feed type - return :video for video feeds.
140 141 |
# File 'lib/blue_factory/feed_handler.rb', line 140 def content_mode end |
#description ⇒ String?
(optional) Longer description of the feed, which explains how the feed works and what kind of content it serves.
126 127 |
# File 'lib/blue_factory/feed_handler.rb', line 126 def description end |
#display_name ⇒ String
Returns the name of the feed that will be shown to the user in the app.
This name is displayed not only in the header and in link cards, but also in the pinned feeds tabs and the right sidebar on the desktop, so it should not be too long, ideally 1-3 words.
118 119 |
# File 'lib/blue_factory/feed_handler.rb', line 118 def display_name end |
#get_posts(params) ⇒ Hash #get_posts(params, context) ⇒ Hash
The main method required to serve a feed. It accepts a hash of query params and optionally a request context object, and is expected to return a hash of data with URIs of posts to be displayed.
The response hash should include:
:posts(Array<String, Hash>) — an array of posts (see below):cursor(String) — optionally, a cursor to be passed when loading the next page:req_id(String) — optionally, a request ID that will be passed with "interactions"
A post in :posts can be either a string with the AT URI of the post, or a hash with fields:
:post(String) — the AT URI of the post:context(String) — optionally, a context string that will be passed with "interactions"-
:reason(Hash) — optionally, a reason why a post appears in the feed:- `{ :repost => repost_uri }` — the post is displayed because someone reposted it (the uri points to a repost record) - `{ :pin => true }` — the post is pinned at the top of the feed
108 109 |
# File 'lib/blue_factory/feed_handler.rb', line 108 def get_posts(params, context = nil) end |