activitypub 0.3.7 → 0.4.0
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 +2 -1
- data/lib/activitypub/base.rb +13 -5
- data/lib/activitypub/types.rb +73 -19
- data/lib/activitypub/uri.rb +1 -1
- 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: 1c8cae4b7204912811e11efa38d689ee0cb418c480a7e3240a70a8d4dcafd699
|
4
|
+
data.tar.gz: 4c732f4669c8ed60428d75b45bda5aac7ffa24e439d9fc4f8c733e51241438f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f5e26e20e624d3c9ae77f66832e8ed6bee1516c84ec4cc1ef2d24f47b468c2e473ee15e4ecab7e000e910adef998870df26650aa7060753d5430dfb699c8717
|
7
|
+
data.tar.gz: 40cfe87f071e5b8be1e6848f86232523f206e90b8b78c25ad9be0b7aa29c7b72f3da6c64da669edc384424c1e7ea9b4b5f813a15c0b1816ee3360568ec5d40cf
|
data/examples/get_actor.rb
CHANGED
data/lib/activitypub/base.rb
CHANGED
@@ -36,8 +36,9 @@ module ActivityPub
|
|
36
36
|
av.is_a?(Hash) && av["type"] ? from_hash(av) : av
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
40
|
-
|
39
|
+
|
40
|
+
if t = klass.ap_types[attr]
|
41
|
+
v = t.new(v)
|
41
42
|
end
|
42
43
|
ob.instance_variable_set("@#{attr}", v) if !v.nil?
|
43
44
|
end
|
@@ -55,12 +56,19 @@ module ActivityPub
|
|
55
56
|
|
56
57
|
|
57
58
|
# FIXME: Allow specifying a type (e.g. URI)
|
58
|
-
def self.ap_attr(
|
59
|
+
def self.ap_attr(name, type=nil)
|
59
60
|
@ap_attributes ||= []
|
60
|
-
@ap_attributes
|
61
|
-
|
61
|
+
@ap_attributes << name
|
62
|
+
@ap_types ||= {}
|
63
|
+
@ap_types[name] = type
|
64
|
+
attr_accessor name
|
62
65
|
end
|
63
66
|
|
67
|
+
def self.ap_types
|
68
|
+
parent = superclass.respond_to?(:ap_types) ? superclass.ap_types : {}
|
69
|
+
parent.merge(@ap_types || {})
|
70
|
+
end
|
71
|
+
|
64
72
|
def self.ap_attributes
|
65
73
|
parent = superclass.respond_to?(:ap_attributes) ? superclass.ap_attributes : []
|
66
74
|
parent.concat(@ap_attributes||[])
|
data/lib/activitypub/types.rb
CHANGED
@@ -7,19 +7,52 @@ require_relative 'uri'
|
|
7
7
|
module ActivityPub
|
8
8
|
|
9
9
|
class Link < Base
|
10
|
-
ap_attr :href
|
10
|
+
ap_attr :href
|
11
|
+
ap_attr :rel
|
12
|
+
ap_attr :mediaType
|
13
|
+
ap_attr :name
|
14
|
+
ap_attr :hreflang
|
15
|
+
ap_attr :height
|
16
|
+
ap_attr :width
|
17
|
+
ap_attr :preview
|
11
18
|
end
|
12
19
|
|
13
20
|
class Object < Base
|
14
21
|
ap_attr :id
|
15
|
-
ap_attr :attachment
|
16
|
-
|
17
|
-
|
18
|
-
|
22
|
+
ap_attr :attachment
|
23
|
+
ap_attr :attributedTo
|
24
|
+
ap_attr :audience
|
25
|
+
ap_attr :content
|
26
|
+
ap_attr :context
|
27
|
+
ap_attr :name
|
28
|
+
ap_attr :endTime
|
29
|
+
ap_attr :generator
|
30
|
+
ap_attr :icon
|
31
|
+
ap_attr :image
|
32
|
+
ap_attr :inReplyTo
|
33
|
+
ap_attr :location
|
34
|
+
ap_attr :preview
|
35
|
+
ap_attr :published
|
36
|
+
ap_attr :replies
|
37
|
+
ap_attr :startTime
|
38
|
+
ap_attr :summary
|
39
|
+
ap_attr :tag
|
40
|
+
ap_attr :updated
|
41
|
+
ap_attr :url
|
42
|
+
ap_attr :to
|
43
|
+
ap_attr :bto
|
44
|
+
ap_attr :cc
|
45
|
+
ap_attr :mediaType
|
46
|
+
ap_attr :duration
|
19
47
|
end
|
20
48
|
|
21
49
|
class Activity < Object
|
22
|
-
ap_attr :actor
|
50
|
+
ap_attr :actor
|
51
|
+
ap_attr :object
|
52
|
+
ap_attr :target
|
53
|
+
ap_attr :result
|
54
|
+
ap_attr :origin
|
55
|
+
ap_attr :instrument
|
23
56
|
end
|
24
57
|
|
25
58
|
# @FIXME
|
@@ -28,7 +61,11 @@ module ActivityPub
|
|
28
61
|
end
|
29
62
|
|
30
63
|
class Collection < Object
|
31
|
-
ap_attr :totalItems
|
64
|
+
ap_attr :totalItems
|
65
|
+
ap_attr :current
|
66
|
+
ap_attr :first
|
67
|
+
ap_attr :last
|
68
|
+
ap_attr :items
|
32
69
|
end
|
33
70
|
|
34
71
|
class OrderedCollection < Collection
|
@@ -42,7 +79,9 @@ module ActivityPub
|
|
42
79
|
end
|
43
80
|
|
44
81
|
class CollectionPage < Collection
|
45
|
-
ap_attr :partOf
|
82
|
+
ap_attr :partOf
|
83
|
+
ap_attr :next
|
84
|
+
ap_attr :prev
|
46
85
|
end
|
47
86
|
|
48
87
|
class OrderedCollectionPage < CollectionPage
|
@@ -130,7 +169,9 @@ module ActivityPub
|
|
130
169
|
end
|
131
170
|
|
132
171
|
class Question < IntransitiveActivity
|
133
|
-
ap_attr :oneOf
|
172
|
+
ap_attr :oneOf
|
173
|
+
ap_attr :anyOf
|
174
|
+
ap_attr :closed
|
134
175
|
end
|
135
176
|
|
136
177
|
# ## Actor Types
|
@@ -144,20 +185,27 @@ module ActivityPub
|
|
144
185
|
# Section 4.1
|
145
186
|
|
146
187
|
# MUST have:
|
147
|
-
ap_attr :inbox,
|
188
|
+
ap_attr :inbox, URI
|
189
|
+
ap_attr :outbox, URI
|
148
190
|
|
149
191
|
# SHOULD have:
|
150
|
-
ap_attr :following
|
192
|
+
ap_attr :following
|
193
|
+
ap_attr :followers
|
151
194
|
|
152
195
|
# MAY have:
|
153
|
-
ap_attr :liked
|
154
|
-
|
196
|
+
ap_attr :liked
|
197
|
+
ap_attr :streams
|
198
|
+
ap_attr :preferredUsername
|
199
|
+
ap_attr :endpoints
|
155
200
|
|
156
201
|
|
157
202
|
# Per https://docs-p.joinmastodon.org/spec/activitypub/#extensions
|
158
203
|
# These are extensions used by Mastodon for Actor types
|
159
|
-
ap_attr :publicKey
|
160
|
-
|
204
|
+
ap_attr :publicKey
|
205
|
+
ap_attr :featured
|
206
|
+
ap_attr :featuredTags
|
207
|
+
ap_attr :discoverable
|
208
|
+
ap_attr :suspended
|
161
209
|
end
|
162
210
|
|
163
211
|
# FIXME: Add "toot:Emoji
|
@@ -173,7 +221,9 @@ module ActivityPub
|
|
173
221
|
|
174
222
|
# Mastodon extension per
|
175
223
|
# https://docs-p.joinmastodon.org/spec/activitypub/#extensions
|
176
|
-
ap_attr :likes
|
224
|
+
ap_attr :likes
|
225
|
+
ap_attr :bookmarks
|
226
|
+
ap_attr :manuallyApprovesFollowers
|
177
227
|
end
|
178
228
|
|
179
229
|
class Service < Actor
|
@@ -183,7 +233,9 @@ module ActivityPub
|
|
183
233
|
# ## Object types
|
184
234
|
|
185
235
|
class Relationship < Object
|
186
|
-
ap_attr :subject
|
236
|
+
ap_attr :subject
|
237
|
+
ap_attr :object
|
238
|
+
ap_attr :relationship
|
187
239
|
end
|
188
240
|
|
189
241
|
class Article < Object
|
@@ -199,7 +251,8 @@ module ActivityPub
|
|
199
251
|
|
200
252
|
# Mastodon extension per
|
201
253
|
# https://docs-p.joinmastodon.org/spec/activitypub/#extensions
|
202
|
-
ap_attr :focalPoint
|
254
|
+
ap_attr :focalPoint
|
255
|
+
ap_attr :blurhash
|
203
256
|
end
|
204
257
|
|
205
258
|
class Video < Document
|
@@ -224,7 +277,8 @@ module ActivityPub
|
|
224
277
|
end
|
225
278
|
|
226
279
|
class Tombstone < Object
|
227
|
-
ap_attr :formerType
|
280
|
+
ap_attr :formerType
|
281
|
+
ap_attr :deleted
|
228
282
|
end
|
229
283
|
|
230
284
|
# Mastodon extensions
|
data/lib/activitypub/uri.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.
|
4
|
+
version: 0.4.0
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webfinger
|