at_protocol 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88028815424d12616955d54125fb23ad627812290c2c52a8d491bb108ebd54fa
4
- data.tar.gz: d68b5af3850c75174ef573809f2d87a4012c707d82079601cdd3351da5c317ed
3
+ metadata.gz: b9079f38f8b754c7aab1c556dd3b79e98a5f95ffa5091ce0a36f3f3da483b69d
4
+ data.tar.gz: b3423fa8c0a4595f7afb81cbb823c38a58a6d5e609dff38ebe297b85dfd4c84b
5
5
  SHA512:
6
- metadata.gz: 37cdd260697f6461ed9215f4d06b932988a292a5fc53afde8d555a1dc04c5355819026742528997d5c2d476a9618ddf396a972f794c73cab11784e6fff39c520
7
- data.tar.gz: 5cd9f10e044b3edfdc37ce71abd01ae53fd66bfe4fa9669157d0a2f507e5d6190f3ed4b89490fb012dc9868ac2c7e2722fa35967428934cf1efec697c6def618
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
@@ -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
@@ -1,4 +1,4 @@
1
1
  # typed: strict
2
2
  module ATProto
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.4.1"
4
4
  end
data/lib/at_protocol.rb CHANGED
@@ -15,13 +15,9 @@ class Class
15
15
  end
16
16
  end
17
17
 
18
- require :"skyfall/cid".to_s
18
+ require "skyfall/cid"
19
19
  require "xrpc"
20
- require "at_protocol/requests"
21
- require "at_protocol/session"
22
- require "at_protocol/repo"
23
- require "at_protocol/collection"
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-08-16 00:00:00.000000000 Z
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"