activitypub 0.3.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 112ee8d199c09e5d9ff788e2bdf02b80e745513a8812d01cfbf377fb56daac3b
4
- data.tar.gz: 7132a7c5d296315c29dad6672a511841a0557640d2b43139d1d4399c71e10487
3
+ metadata.gz: 17f43a4f939aa54391fce983f65b2599fce783d3c1f5cb1fbeadf92bc56bf63f
4
+ data.tar.gz: 1f527109c8f80bb80fa6c4b6af988dc1672219757c2177b2bcdff6e6c529ce8a
5
5
  SHA512:
6
- metadata.gz: b3f3d2e3788239c080ac7354fa5a02e27ac242911374d86b579473c0ae451f1d46eff8033b7ae91abb8cda24e865cf9c58ebfd2fbc2c86257b4ed01e3856f0a4
7
- data.tar.gz: 8c7b248e72822ca739272b4315fc3256aefe96a333b81ca0676a5717162fd345a6ff2e3eef2ff3d989172abbad8124a652c5aa6cf105c1a7880643aa20c03c53
6
+ metadata.gz: ee5dab8ee0ed11b02aa08e878b0e35844244a7894248da373c8441cd3aebede599e66fdcc175b2b7d3f172ed6f79ba6e2edc0d0bedb3f6bb32a5589822a59bc6
7
+ data.tar.gz: 5090b6f6dc1b4fc61219f542a28ca5415387270354912c5f2a8c967fcd8404f2044aac6f91424d5e10359550881b2649edc20cdc93878c618bbe2f61055f37f8
@@ -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".freeze
37
+ def _context = @_context || "https://www.w3.org/ns/activitystreams"
32
38
  def _type = self.class.name.split("::").last
33
39
 
34
40
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActivityPub
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.4"
5
5
  end
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.2
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-03 00:00:00.000000000 Z
11
+ date: 2024-07-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: