Module: Federails::ActorEntity

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/federails/actor_entity.rb

Overview

Concern to include in models that acts as actors.

Actors can be anything; they authors content via their outbox and receive content in their inbox. Actors can follow and be followed by each other

By default, when an entry is created on models using this concern, a local ‘Federails::Actor` will be created.

See also:

- https://www.w3.org/TR/activitypub/#actor-objects

## Usage

Include the concern in an existing model:

“‘rb class User < ApplicationRecord

include Federails::ActorEntity
acts_as_federails_actor options

end “‘

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#to_activitypub_objectObject

Add custom data to actor responses.

Override in your own model to add extra data, which will be merged into the actor response generated by Federails. You can include extra ‘@context` for activitypub extensions and it will be merged with the main response context.

Examples:

def to_activitypub_object
  {
    "@context": {
      toot: "http://joinmastodon.org/ns#",
      attributionDomains: {
        "@id": "toot:attributionDomains",
        "@type": "@id"
      }
    },
    attributionDomains: [
      "example.com"
    ]
  }
end


141
142
143
# File 'app/models/concerns/federails/actor_entity.rb', line 141

def to_activitypub_object
  {}
end