blue_factory 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/README.md +1 -1
- data/lib/blue_factory/errors.rb +3 -0
- data/lib/blue_factory/modules/feeds.rb +15 -1
- data/lib/blue_factory/server.rb +1 -1
- data/lib/blue_factory/version.rb +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41390cf32bc0c614a9cec3414ce6b5f4c2b325d81c59655089efe4e732356bd0
|
4
|
+
data.tar.gz: 24f49ed933396117be07381b43ae1878022a687b5a88d3b1e0dd1feb0582b972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94accb55c086ea2302e479f6f7e5f5cf83631c47a165d429349207dbeb654c48970a78b095fe6b2f9a3686674869f7fbfe382841d49bad84dd67b391585d05f5
|
7
|
+
data.tar.gz: c2b1d4590f546ee2c1c8d98b4c7a776974ca2c9dd1a94cce517a7021cb9e9f295d39b4f986fc41dd058bee00af1942113ab770d91cadbc135bc7ca4c9e27cfcb
|
data/CHANGELOG.md
CHANGED
@@ -1 +1,12 @@
|
|
1
|
-
## [
|
1
|
+
## [0.1.2] - 2023-06-15
|
2
|
+
|
3
|
+
- added validation for feed rkey
|
4
|
+
- renamed `all_feeds` to `feed_keys`, `all_feeds` now returns an array of feeds
|
5
|
+
|
6
|
+
## [0.1.1] - 2023-06-13
|
7
|
+
|
8
|
+
- added a rake task for publishing the feed to Bluesky
|
9
|
+
|
10
|
+
## [0.1.0] - 2023-06-12
|
11
|
+
|
12
|
+
Initial release: working version that serves all required endpoints for the feed.
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ The server is configured through the `BlueFactory` module. The two required sett
|
|
22
22
|
- `publisher_did` - DID identifier of the account that you will publish the feed on (the string that starts with `did:plc:...`)
|
23
23
|
- `hostname` - the hostname on which the feed service will be run
|
24
24
|
|
25
|
-
You also need to configure at least one feed by passing a feed key and a feed object. The key is the identifier that will appear at the end of the feed URI -
|
25
|
+
You also need to configure at least one feed by passing a feed key and a feed object. The key is the identifier that will appear at the end of the feed URI - it must only contain characters that are valid in URLs (preferably all lowercase) and it can't be longer than 15 characters. The object is anything that implements the single required method `get_posts` (could be a class, a module or an instance).
|
26
26
|
|
27
27
|
So a simple setup could look like this:
|
28
28
|
|
data/lib/blue_factory/errors.rb
CHANGED
@@ -5,15 +5,29 @@ module BlueFactory
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def add_feed(key, feed_class)
|
8
|
+
validate_key(key)
|
8
9
|
@feeds[key.to_s] = feed_class
|
9
10
|
end
|
10
11
|
|
11
|
-
def
|
12
|
+
def feed_keys
|
12
13
|
@feeds.keys
|
13
14
|
end
|
14
15
|
|
15
16
|
def get_feed(key)
|
16
17
|
@feeds[key.to_s]
|
17
18
|
end
|
19
|
+
|
20
|
+
def all_feeds
|
21
|
+
@feeds.values
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def validate_key(key)
|
27
|
+
raise InvalidKeyError, "Key must be a string" unless key.is_a?(String)
|
28
|
+
raise InvalidKeyError, "Key must not be empty" if key == ''
|
29
|
+
raise InvalidKeyError, "Key must not contain a slash" if key.include?('/')
|
30
|
+
raise InvalidKeyError, "Key must not be longer than 15 characters" if key.length > 15
|
31
|
+
end
|
18
32
|
end
|
19
33
|
end
|
data/lib/blue_factory/server.rb
CHANGED
data/lib/blue_factory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blue_factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kuba Suder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -24,7 +24,11 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
|
-
description:
|
27
|
+
description: "\n BlueFactory is a Ruby library which helps you build a web service
|
28
|
+
that hosts custom feeds a.k.a. feed generators\n for the Bluesky social network.
|
29
|
+
It implements a simple HTTP server based on Sinatra which provides the required\n
|
30
|
+
\ endpoints for the feed generator interface. You need to provide the content
|
31
|
+
for the feed by making a query to your\n preferred local database.\n "
|
28
32
|
email:
|
29
33
|
- jakub.suder@gmail.com
|
30
34
|
executables: []
|
@@ -70,5 +74,5 @@ requirements: []
|
|
70
74
|
rubygems_version: 3.4.10
|
71
75
|
signing_key:
|
72
76
|
specification_version: 4
|
73
|
-
summary:
|
77
|
+
summary: A Ruby gem for hosting custom feeds for Bluesky
|
74
78
|
test_files: []
|