at_protocol 0.0.4 → 0.0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/at_protocol/record/strongref.rb +22 -0
- data/lib/at_protocol/record.rb +4 -4
- data/lib/at_protocol/version.rb +1 -1
- data/lib/at_protocol.rb +5 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9079f38f8b754c7aab1c556dd3b79e98a5f95ffa5091ce0a36f3f3da483b69d
|
4
|
+
data.tar.gz: b3423fa8c0a4595f7afb81cbb823c38a58a6d5e609dff38ebe297b85dfd4c84b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 066a7e0ba5ea613209e4b180be05c25c82251968fad5e7b611fa3200ae820ceb41268c1759d0ec77eb733aa410c8878cbd6890c61e7bf47ebd1171c364ca84ed
|
7
|
+
data.tar.gz: b106124acf97f5d6443aae45adcf65eac04319d923f92e08e3404bb87c8912ab59ff7feb739ef9b0a377c9b23e83fa0789bed8ba8128dd5e8ad9be4d4a7c0dad
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# typed: true
|
2
|
+
module ATProto
|
3
|
+
class Record
|
4
|
+
class StrongRef < T::Struct
|
5
|
+
include RequestUtils
|
6
|
+
extend T::Sig
|
7
|
+
const :uri, ATProto::AtUri
|
8
|
+
prop :cid, Skyfall::CID
|
9
|
+
|
10
|
+
def to_json
|
11
|
+
{
|
12
|
+
"uri" => uri.to_s,
|
13
|
+
"cid" => cid.to_s,
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def inspect
|
18
|
+
self.to_json.to_json
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/at_protocol/record.rb
CHANGED
@@ -46,7 +46,7 @@ module ATProto
|
|
46
46
|
record: content_hash,
|
47
47
|
}
|
48
48
|
params[:rkey] = rkey unless rkey.nil?
|
49
|
-
from_uri(at_uri(session.xrpc.post.com_atproto_repo_createRecord(params)["uri"]))
|
49
|
+
from_uri(at_uri(session.xrpc.post.com_atproto_repo_createRecord(**params)["uri"]))
|
50
50
|
end
|
51
51
|
end
|
52
52
|
dynamic_attr_reader(:to_uri) { "at://#{self.uri.repo}/#{self.uri.collection}/#{self.uri.rkey}" }
|
@@ -72,19 +72,19 @@ module ATProto
|
|
72
72
|
|
73
73
|
def to_write(type = :delete)
|
74
74
|
ATProto::Writes::Write.new(
|
75
|
-
{
|
75
|
+
**({
|
76
76
|
action: Writes::Write::Action.deserialize(type),
|
77
77
|
value: (self.content if type == :update),
|
78
78
|
collection: self.uri.collection,
|
79
79
|
rkey: self.uri.rkey,
|
80
|
-
}.compact
|
80
|
+
}.compact),
|
81
81
|
)
|
82
82
|
end
|
83
83
|
|
84
84
|
sig { params(other: ATProto::Record).returns(T::Boolean) }
|
85
85
|
|
86
86
|
def ==(other)
|
87
|
-
self.cid.to_s == other.cid.to_s
|
87
|
+
self.cid.to_s == other.cid.to_s && self.uri.to_s == other.uri.to_s
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
data/lib/at_protocol/version.rb
CHANGED
data/lib/at_protocol.rb
CHANGED
@@ -15,13 +15,9 @@ class Class
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
require
|
18
|
+
require "skyfall/cid"
|
19
19
|
require "xrpc"
|
20
|
-
|
21
|
-
|
22
|
-
require "at_protocol
|
23
|
-
|
24
|
-
require "at_protocol/at_uri"
|
25
|
-
require "at_protocol/writes"
|
26
|
-
require "at_protocol/record"
|
27
|
-
require "at_protocol/helpers/strongref"
|
20
|
+
|
21
|
+
%w(requests session repo collection at_uri writes record record/strongref).each do |name|
|
22
|
+
require "at_protocol/#{name}"
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: at_protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4
|
4
|
+
version: 0.0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shreyan Jain
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xrpc
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- "./lib/at_protocol/at_uri.rb"
|
37
37
|
- "./lib/at_protocol/collection.rb"
|
38
38
|
- "./lib/at_protocol/record.rb"
|
39
|
+
- "./lib/at_protocol/record/strongref.rb"
|
39
40
|
- "./lib/at_protocol/repo.rb"
|
40
41
|
- "./lib/at_protocol/requests.rb"
|
41
42
|
- "./lib/at_protocol/session.rb"
|