activitypub 0.3.4 → 0.3.5
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 +15 -2
- data/lib/activitypub/types.rb +9 -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: 8c0e1247ee89de99f86956188ce6bd17a3a5360b9abb222badc18b2671cca5b9
|
4
|
+
data.tar.gz: eeede65bac6dd07a3ba9acdb9569d764448d2ff06816e59741431f9a8f3fdbff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62a13084316cbf4c333ab333f41639a1a41ec29e72d53c5a9ab61a82b13396a08eb553e2c147d9c2a35dc197756859f2c11d5c6dccfd8525573a2c1f9a74bbe3
|
7
|
+
data.tar.gz: acdb52191d7b1fc1ca31178dc8becbeaeac3c97e4a4c14e2fba27fee3ca22722edb3c766cc3d98a9188181541a8b6384643ee3d241953558fd44360d36418c95
|
data/lib/activitypub/base.rb
CHANGED
@@ -4,9 +4,13 @@ require 'json'
|
|
4
4
|
|
5
5
|
module ActivityPub
|
6
6
|
class Error < StandardError; end
|
7
|
+
|
7
8
|
|
8
9
|
def self.from_json(json)
|
9
|
-
|
10
|
+
from_hash(JSON.parse(json))
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.from_hash(h)
|
10
14
|
type = h&.dig("type")
|
11
15
|
|
12
16
|
raise Error, "'type' attribute is required" if !type
|
@@ -23,7 +27,16 @@ module ActivityPub
|
|
23
27
|
ob.instance_variable_set("@_context", context) if context
|
24
28
|
|
25
29
|
klass.ap_attributes.each do |attr|
|
26
|
-
|
30
|
+
v = h.dig(attr.to_s)
|
31
|
+
|
32
|
+
if v.is_a?(Hash) && v["type"]
|
33
|
+
v = from_hash(v)
|
34
|
+
elsif v.is_a?(Array)
|
35
|
+
v = v.map do |av|
|
36
|
+
av.is_a?(Hash) && av["type"] ? from_hash(av) : av
|
37
|
+
end
|
38
|
+
end
|
39
|
+
ob.instance_variable_set("@#{attr}", v)
|
27
40
|
end
|
28
41
|
end
|
29
42
|
|
data/lib/activitypub/types.rb
CHANGED
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.5
|
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-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|