activitypub 0.4.0 → 0.4.1
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/examples/get_actor.rb +15 -1
- data/lib/activitypub/base.rb +4 -1
- data/lib/activitypub/types.rb +21 -10
- 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: 422c4769d3efddf0251d5cb9f64f92b6f4c9c72c054bed80bd2e2e4d74fb6870
|
4
|
+
data.tar.gz: 8d503eed716a1a54d62e654ba647415c6d9b89cfeb060bedc6dbc52a1735aaf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 487e02cb6426a2ac76d3ccedcea22f9fe1693b697aea51969b16d0164a1e9fdbc8233c355182e2e695b04177a4bd2e81f05cb4e25090f972a36938f6cc4260b1
|
7
|
+
data.tar.gz: 6ca2c9ca57226499972c51b6d9017a96ace046964d754e0a8eaa46ae5b0d6441d900c473cd16d6ed670eed3838b0181e1f7b31fb7b29d757b0324cb2d2ed066a
|
data/examples/get_actor.rb
CHANGED
@@ -30,7 +30,7 @@ puts
|
|
30
30
|
|
31
31
|
ob = href.get
|
32
32
|
PP.pp(ob)
|
33
|
-
puts ob.to_json
|
33
|
+
#puts ob.to_json
|
34
34
|
puts
|
35
35
|
puts "Enter to continue"
|
36
36
|
gets
|
@@ -38,3 +38,17 @@ gets
|
|
38
38
|
puts "Trying to retrieve outbox"
|
39
39
|
ob = ob.outbox.get
|
40
40
|
PP.pp(ob)
|
41
|
+
puts
|
42
|
+
puts "Enter to continue"
|
43
|
+
gets
|
44
|
+
|
45
|
+
puts
|
46
|
+
puts "PAGE: #{ob.first}"
|
47
|
+
ob = ob.first.get
|
48
|
+
PP.pp(ob)
|
49
|
+
|
50
|
+
# For now, this will let you iterate through the collection.
|
51
|
+
# while ob && ob.orderedItems.length > 0
|
52
|
+
# PP.pp ob.id
|
53
|
+
# ob = ob.next&.get
|
54
|
+
# end
|
data/lib/activitypub/base.rb
CHANGED
@@ -22,6 +22,9 @@ module ActivityPub
|
|
22
22
|
|
23
23
|
ob = klass ? klass.new : nil
|
24
24
|
|
25
|
+
# FIXME: Useful for debug. Add flag to allow enabling.
|
26
|
+
# ob.instance_variable_set("@_raw",h)
|
27
|
+
|
25
28
|
if ob
|
26
29
|
context = h.dig("@context")
|
27
30
|
ob.instance_variable_set("@_context", context) if context
|
@@ -38,7 +41,7 @@ module ActivityPub
|
|
38
41
|
end
|
39
42
|
|
40
43
|
if t = klass.ap_types[attr]
|
41
|
-
v = t.new(v)
|
44
|
+
v = t.new(v) if v
|
42
45
|
end
|
43
46
|
ob.instance_variable_set("@#{attr}", v) if !v.nil?
|
44
47
|
end
|
data/lib/activitypub/types.rb
CHANGED
@@ -7,8 +7,13 @@ require_relative 'uri'
|
|
7
7
|
module ActivityPub
|
8
8
|
|
9
9
|
class Link < Base
|
10
|
-
ap_attr :href
|
10
|
+
ap_attr :href, URI
|
11
|
+
|
12
|
+
# We don't mark "rel" as a URI as it's effectively
|
13
|
+
# used as an identifier for comparison rather than to
|
14
|
+
# dereference
|
11
15
|
ap_attr :rel
|
16
|
+
|
12
17
|
ap_attr :mediaType
|
13
18
|
ap_attr :name
|
14
19
|
ap_attr :hreflang
|
@@ -29,7 +34,7 @@ module ActivityPub
|
|
29
34
|
ap_attr :generator
|
30
35
|
ap_attr :icon
|
31
36
|
ap_attr :image
|
32
|
-
ap_attr :inReplyTo
|
37
|
+
ap_attr :inReplyTo, URI
|
33
38
|
ap_attr :location
|
34
39
|
ap_attr :preview
|
35
40
|
ap_attr :published
|
@@ -38,7 +43,7 @@ module ActivityPub
|
|
38
43
|
ap_attr :summary
|
39
44
|
ap_attr :tag
|
40
45
|
ap_attr :updated
|
41
|
-
ap_attr :url
|
46
|
+
ap_attr :url, URI
|
42
47
|
ap_attr :to
|
43
48
|
ap_attr :bto
|
44
49
|
ap_attr :cc
|
@@ -63,8 +68,8 @@ module ActivityPub
|
|
63
68
|
class Collection < Object
|
64
69
|
ap_attr :totalItems
|
65
70
|
ap_attr :current
|
66
|
-
ap_attr :first
|
67
|
-
ap_attr :last
|
71
|
+
ap_attr :first, URI
|
72
|
+
ap_attr :last, URI
|
68
73
|
ap_attr :items
|
69
74
|
end
|
70
75
|
|
@@ -79,12 +84,18 @@ module ActivityPub
|
|
79
84
|
end
|
80
85
|
|
81
86
|
class CollectionPage < Collection
|
82
|
-
ap_attr :partOf
|
83
|
-
ap_attr :next
|
84
|
-
ap_attr :prev
|
87
|
+
ap_attr :partOf, URI
|
88
|
+
ap_attr :next, URI
|
89
|
+
ap_attr :prev, URI
|
85
90
|
end
|
86
|
-
|
87
|
-
|
91
|
+
|
92
|
+
# FIXME: OrderedCollectionPage inherits both CollectionPage and
|
93
|
+
# OrderedCollection.
|
94
|
+
#
|
95
|
+
class OrderedCollectionPage < OrderedCollection
|
96
|
+
ap_attr :partOf, URI
|
97
|
+
ap_attr :next, URI
|
98
|
+
ap_attr :prev, URI
|
88
99
|
ap_attr :startIndex
|
89
100
|
end
|
90
101
|
|
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.4.
|
4
|
+
version: 0.4.1
|
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-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webfinger
|