activitypub 0.3.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/activitypub/base.rb +7 -1
- data/lib/activitypub/types.rb +7 -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,12 +11,17 @@ 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
19
|
ob = klass ? klass.new : nil
|
17
20
|
|
18
21
|
if ob
|
22
|
+
context = h.dig("@context")
|
23
|
+
ob.instance_variable_set("@_context", context) if context
|
24
|
+
|
19
25
|
klass.ap_attributes.each do |attr|
|
20
26
|
ob.instance_variable_set("@#{attr}", h.dig(attr.to_s))
|
21
27
|
end
|
@@ -28,7 +34,7 @@ module ActivityPub
|
|
28
34
|
# for serialization and dezerialisation.
|
29
35
|
#
|
30
36
|
class Base
|
31
|
-
def _context = "https://www.w3.org/ns/activitystreams"
|
37
|
+
def _context = @_context || "https://www.w3.org/ns/activitystreams"
|
32
38
|
def _type = self.class.name.split("::").last
|
33
39
|
|
34
40
|
|
data/lib/activitypub/types.rb
CHANGED
@@ -31,6 +31,13 @@ module ActivityPub
|
|
31
31
|
end
|
32
32
|
|
33
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
|
34
41
|
end
|
35
42
|
|
36
43
|
class CollectionPage < Collection
|
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:
|