activitypub 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c0e1247ee89de99f86956188ce6bd17a3a5360b9abb222badc18b2671cca5b9
4
- data.tar.gz: eeede65bac6dd07a3ba9acdb9569d764448d2ff06816e59741431f9a8f3fdbff
3
+ metadata.gz: ed038947b69b69a8e0571743cbf28fdfaf7131c4922bc26b1e0d47a532dd6002
4
+ data.tar.gz: fdda56411f0ebc9d50365eea7bb028eb8b6f718947c10a57f4a838b8201e7d50
5
5
  SHA512:
6
- metadata.gz: 62a13084316cbf4c333ab333f41639a1a41ec29e72d53c5a9ab61a82b13396a08eb553e2c147d9c2a35dc197756859f2c11d5c6dccfd8525573a2c1f9a74bbe3
7
- data.tar.gz: acdb52191d7b1fc1ca31178dc8becbeaeac3c97e4a4c14e2fba27fee3ca22722edb3c766cc3d98a9188181541a8b6384643ee3d241953558fd44360d36418c95
6
+ metadata.gz: a1339e651c59ec7d18c9b82a48b15e15c7591821276c2d8934f9c8ecd5a014bbfed57e56cc20d95627bca5ac5182d6e6ba6e10e14c36f673948fa555f3cd76b8
7
+ data.tar.gz: dba788189a64fff38c808db2734bd567bb25bae0ffd0db6503242f56e1edf52b299474eeab4a11bdd40fd994782ee255cada4fa68fc4fbbe23b3056ef8cd28a7
data/examples/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "webfinger"
6
+ gem "faraday"
@@ -0,0 +1,48 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (7.1.3.4)
5
+ base64
6
+ bigdecimal
7
+ concurrent-ruby (~> 1.0, >= 1.0.2)
8
+ connection_pool (>= 2.2.5)
9
+ drb
10
+ i18n (>= 1.6, < 2)
11
+ minitest (>= 5.1)
12
+ mutex_m
13
+ tzinfo (~> 2.0)
14
+ base64 (0.2.0)
15
+ bigdecimal (3.1.8)
16
+ concurrent-ruby (1.3.3)
17
+ connection_pool (2.4.1)
18
+ drb (2.2.1)
19
+ faraday (2.10.0)
20
+ faraday-net_http (>= 2.0, < 3.2)
21
+ logger
22
+ faraday-follow_redirects (0.3.0)
23
+ faraday (>= 1, < 3)
24
+ faraday-net_http (3.1.0)
25
+ net-http
26
+ i18n (1.14.5)
27
+ concurrent-ruby (~> 1.0)
28
+ logger (1.6.0)
29
+ minitest (5.24.1)
30
+ mutex_m (0.2.0)
31
+ net-http (0.4.1)
32
+ uri
33
+ tzinfo (2.0.6)
34
+ concurrent-ruby (~> 1.0)
35
+ uri (0.13.0)
36
+ webfinger (2.1.3)
37
+ activesupport
38
+ faraday (~> 2.0)
39
+ faraday-follow_redirects
40
+
41
+ PLATFORMS
42
+ x86_64-linux
43
+
44
+ DEPENDENCIES
45
+ webfinger
46
+
47
+ BUNDLED WITH
48
+ 2.4.19
@@ -0,0 +1,56 @@
1
+
2
+ require 'webfinger'
3
+ require 'faraday'
4
+ require 'pp'
5
+ $: << File.expand_path(__FILE__ + "/../../lib")
6
+ require 'activitypub/types'
7
+ require 'activitypub/base'
8
+
9
+ acct = ARGV.shift || "vidar@galaxybound.com"
10
+
11
+ puts "Trying webfinger for #{acct} (to choose your own account, provide it as an argument)"
12
+ puts
13
+
14
+ wf = WebFinger.discover!(acct)
15
+ if !wf
16
+ puts "Unable to find #{acct}"
17
+ exit(1)
18
+ end
19
+
20
+ PP.pp wf
21
+ puts
22
+ puts "Enter to continue"
23
+ gets
24
+
25
+ link = wf["links"].find{ _1["rel"] == "self" && _1["type"] == "application/activity+json" }
26
+ if !link || !link["href"]
27
+ puts "Unable to find a link to the actor"
28
+ exit(2)
29
+ end
30
+
31
+ href = link["href"]
32
+
33
+ puts "Trying to retrieve the Actor from #{href}"
34
+ puts
35
+
36
+ response = Faraday.get(href,{}, {"Accept": "application/activity+json"})
37
+ if response.status != 200
38
+ PP.pp response
39
+ exit(3)
40
+ end
41
+
42
+ ob = ActivityPub.from_json(response.body)
43
+ PP.pp(ob)
44
+ puts
45
+ puts "Enter to continue"
46
+ gets
47
+
48
+ puts "Trying to retrieve outbox"
49
+ response = Faraday.get(ob.outbox, {}, {"Accept": "application/activity+json"})
50
+ if response.status != 200
51
+ PP.pp response
52
+ exit(4)
53
+ end
54
+
55
+ ob = ActivityPub.from_json(response.body)
56
+ PP.pp(ob)
@@ -36,7 +36,7 @@ module ActivityPub
36
36
  av.is_a?(Hash) && av["type"] ? from_hash(av) : av
37
37
  end
38
38
  end
39
- ob.instance_variable_set("@#{attr}", v)
39
+ ob.instance_variable_set("@#{attr}", v) if !v.nil?
40
40
  end
41
41
  end
42
42
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActivityPub
4
- VERSION = "0.3.5"
4
+ VERSION = "0.3.6"
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.5
4
+ version: 0.3.6
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-06 00:00:00.000000000 Z
11
+ date: 2024-07-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -21,6 +21,9 @@ files:
21
21
  - LICENSE.txt
22
22
  - README.md
23
23
  - Rakefile
24
+ - examples/Gemfile
25
+ - examples/Gemfile.lock
26
+ - examples/get_actor.rb
24
27
  - lib/activitypub.rb
25
28
  - lib/activitypub/base.rb
26
29
  - lib/activitypub/types.rb