activitypub 0.3.1 → 0.3.4
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 +4 -4
- data/lib/activitypub/base.rb +16 -2
- data/lib/activitypub/types.rb +12 -0
- data/lib/activitypub/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17f43a4f939aa54391fce983f65b2599fce783d3c1f5cb1fbeadf92bc56bf63f
|
4
|
+
data.tar.gz: 1f527109c8f80bb80fa6c4b6af988dc1672219757c2177b2bcdff6e6c529ce8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee5dab8ee0ed11b02aa08e878b0e35844244a7894248da373c8441cd3aebede599e66fdcc175b2b7d3f172ed6f79ba6e2edc0d0bedb3f6bb32a5589822a59bc6
|
7
|
+
data.tar.gz: 5090b6f6dc1b4fc61219f542a28ca5415387270354912c5f2a8c967fcd8404f2044aac6f91424d5e10359550881b2649edc20cdc93878c618bbe2f61055f37f8
|
data/lib/activitypub/base.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require 'json'
|
3
4
|
|
@@ -10,17 +11,30 @@ module ActivityPub
|
|
10
11
|
|
11
12
|
raise Error, "'type' attribute is required" if !type
|
12
13
|
raise NameError, "'type' attribute with '::' is not allowed" if !type.index("::").nil?
|
14
|
+
|
15
|
+
# FIXME: May need a way to override/handle custom namespaces.
|
13
16
|
|
14
17
|
klass = ActivityPub.const_get(type)
|
15
18
|
|
16
|
-
klass ? klass.new : nil
|
19
|
+
ob = klass ? klass.new : nil
|
20
|
+
|
21
|
+
if ob
|
22
|
+
context = h.dig("@context")
|
23
|
+
ob.instance_variable_set("@_context", context) if context
|
24
|
+
|
25
|
+
klass.ap_attributes.each do |attr|
|
26
|
+
ob.instance_variable_set("@#{attr}", h.dig(attr.to_s))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
ob
|
17
31
|
end
|
18
32
|
|
19
33
|
# This is not part of ActivityPub, but provides basic mechanisms
|
20
34
|
# for serialization and dezerialisation.
|
21
35
|
#
|
22
36
|
class Base
|
23
|
-
def _context = "https://www.w3.org/ns/activitystreams"
|
37
|
+
def _context = @_context || "https://www.w3.org/ns/activitystreams"
|
24
38
|
def _type = self.class.name.split("::").last
|
25
39
|
|
26
40
|
|
data/lib/activitypub/types.rb
CHANGED
@@ -10,6 +10,7 @@ module ActivityPub
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class Object < Base
|
13
|
+
ap_attr :id
|
13
14
|
ap_attr :attachment, :attributedTo, :audience, :content, :context,
|
14
15
|
:name, :endTime, :generator, :icon, :image, :inReplyTo, :location,
|
15
16
|
:preview, :published, :replies, :startTime, :summary, :tag, :updated,
|
@@ -30,6 +31,13 @@ module ActivityPub
|
|
30
31
|
end
|
31
32
|
|
32
33
|
class OrderedCollection < Collection
|
34
|
+
# "orderedItems" is not part of
|
35
|
+
# https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection,
|
36
|
+
# however it is part of at least some Mastodon exports, and so we include
|
37
|
+
# it here
|
38
|
+
#
|
39
|
+
# FIXME: Review/consider whether to marge orderedItems/items internally.
|
40
|
+
ap_attr :orderedItems
|
33
41
|
end
|
34
42
|
|
35
43
|
class CollectionPage < Collection
|
@@ -161,6 +169,10 @@ module ActivityPub
|
|
161
169
|
end
|
162
170
|
|
163
171
|
class Person < Actor
|
172
|
+
|
173
|
+
# Mastodon extension per
|
174
|
+
# https://docs-p.joinmastodon.org/spec/activitypub/#extensions
|
175
|
+
ap_attr :likes, :bookmarks, :manuallyApprovesFollowers
|
164
176
|
end
|
165
177
|
|
166
178
|
class Service < Actor
|
data/lib/activitypub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activitypub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vidar Hokstad
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|