fasp_client 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79b0748608e7c9b2fc0c9cb096954fa37b8270b8467c839175d0799ce809afec
4
- data.tar.gz: 7f0c2a9d5d9cef162b00edde1711d52d175ce726725db8e79ddea15aa5ace00c
3
+ metadata.gz: e6d2a21090a6ee8decdf73c9c714f966cf640029d88884f6696f8bb20ec484f2
4
+ data.tar.gz: c65370c42c1ecc1486421ff83d53180bf57508ac106f5c42963c03b4f89ef622
5
5
  SHA512:
6
- metadata.gz: 3c93b8087b5fb053fde2c40cfab4e8fe212c10416a80791aa1bb74935f3e2a689aa0368847f20f06f28bec1d1ea6abd65e316757f4d37b25d6064c0f67293f53
7
- data.tar.gz: 5261bfcaf33617dc941f57e07f8bf0689be42d48bfcbbb382aa6d50523797e555dad3765c2407907f0d1e72192542e0caca796ddbb0c6bc07aae60c37f0d5646
6
+ metadata.gz: bc5794864054490c1e3424e0e54b801251cf4ff624cf21f3e7ec0f8d04d72d735d9616b8b11a942f41af0ace7b79ffd57bd16bd820ecb8a77d33394fb318a59c
7
+ data.tar.gz: af7ff8217f5f53ae66c175c635c0cf5910c09017e5a8971fae5be7c49326398021beb0a3eccd7f314c6b0fd25bf71b9370a00c0a5edd5e45e7fe5755605edf9b
data/README.md CHANGED
@@ -10,7 +10,11 @@ A Rails engine that implements the non-provider side of the [Fediverse Auxiliary
10
10
  * [Accepting registration requests](https://github.com/mastodon/fediverse_auxiliary_service_provider_specifications/blob/main/general/v0.1/registration.md) ✅
11
11
  * [Selecting capabilities](https://github.com/mastodon/fediverse_auxiliary_service_provider_specifications/blob/main/general/v0.1/registration.md#selecting-capabilities) ✅
12
12
  * [Fetching FASP information](https://github.com/mastodon/fediverse_auxiliary_service_provider_specifications/blob/main/general/v0.1/provider_info.md) ✅
13
- * [Capability APIs](https://github.com/mastodon/fediverse_auxiliary_service_provider_specifications/blob/main/general/v0.1/provider_specifications.md)
13
+ * [Discovery APIs](https://github.com/mastodon/fediverse_auxiliary_service_provider_specifications/blob/main/discovery/README.md)
14
+ * [account_search](https://github.com/mastodon/fediverse_auxiliary_service_provider_specifications/blob/main/discovery/account_search/v0.1/account_search.md) ✅
15
+ * [follow_recomendation](https://github.com/mastodon/fediverse_auxiliary_service_provider_specifications/blob/main/discovery/follow_recommendation/v0.1/follow_recommendation.md) ✅
16
+ * [data_sharing](https://github.com/mastodon/fediverse_auxiliary_service_provider_specifications/blob/main/discovery/data_sharing/v0.1/data_sharing.md) ✅ + ⏳ (no backfill yet)
17
+ * [trends](https://github.com/mastodon/fediverse_auxiliary_service_provider_specifications/blob/main/discovery/trends/v0.1/trends.md) ⏳
14
18
 
15
19
  ## Installation
16
20
 
@@ -94,6 +98,12 @@ The actual announcements are then sent to all subscribed providers by a backgrou
94
98
  fasp_share_lifecycle category: "account", uri_method: :my_canonical_uri, queue: "fasp_broadcasts"
95
99
  ```
96
100
 
101
+ You can also add an `only_if` argument to point to a method that returns true if an item should be shared, allowing you to only share certain items:
102
+
103
+ ```ruby
104
+ fasp_share_lifecycle category: "account", uri_method: :my_canonical_uri, only_if: :public?
105
+ ```
106
+
97
107
  Only new lifecycle events are currently sent. Whilst backfill requests can be made, they aren't serviced yet (see https://github.com/manyfold3d/fasp_client/issues/25).
98
108
 
99
109
  #### follow_recommendation
@@ -4,10 +4,11 @@ module FaspClient
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  class_methods do
7
- def fasp_share_lifecycle(category:, uri_method:, queue: "default")
7
+ def fasp_share_lifecycle(category:, uri_method:, queue: "default", only_if: :present?)
8
8
  self.fasp_uri_method = uri_method
9
9
  self.fasp_category = category
10
10
  self.fasp_job_queue = queue
11
+ self.fasp_only_if_method = only_if
11
12
  end
12
13
  end
13
14
 
@@ -15,6 +16,7 @@ module FaspClient
15
16
  cattr_accessor :fasp_category
16
17
  cattr_accessor :fasp_uri_method
17
18
  cattr_accessor :fasp_job_queue
19
+ cattr_accessor :fasp_only_if_method
18
20
 
19
21
  after_commit -> { fasp_emit_lifecycle_announcement "new" }, on: :create
20
22
  after_commit -> { fasp_emit_lifecycle_announcement "update" }, on: :update
@@ -29,6 +31,7 @@ module FaspClient
29
31
  end
30
32
 
31
33
  def fasp_emit_lifecycle_announcement(event_type)
34
+ return unless send(fasp_only_if_method)
32
35
  LifecycleAnnouncementJob.set(queue: fasp_job_queue).perform_later(event_type: event_type, category: fasp_category, uri: fasp_object_uri)
33
36
  end
34
37
  end
@@ -1,3 +1,3 @@
1
1
  module FaspClient
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fasp_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith