bskyrb 0.5 → 0.5.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: 0446dc11827c6a05fef76c05c2e6a8352c0d22aca38596b38829a992905f3724
4
- data.tar.gz: bb1388b216c99ec84219439b087b74f43d39bb27bc7b6a8bb40c2cc73791c11e
3
+ metadata.gz: 3ae64c99f896f5ec3366f9c4e028d61c9006563351c34be989881ccb4fac52d9
4
+ data.tar.gz: 57903df97da314a87e257fad02d8536ad783ea88511c2f5b7efbf774ad36b4b4
5
5
  SHA512:
6
- metadata.gz: f0c77673776705697470560d6142ba51f0f88d0cfd81d536af44cba856bd82ad271c9a7ab5446af463dd1f930e1f54b0a49354bd9f8fae208a8df65a71b2adb3
7
- data.tar.gz: 38939c101cc5f0eee20f9ddf52ef1da5ded8bef79654ef7a6f04f45f311c7771c27322e2c2137869c2202f3899ba22fc52ec64e0524d896821394e2e34dd102d
6
+ metadata.gz: 447074d457ecb73774ce6e355f3cd18820b13e508c58f144361105b8bb1bf6fe7547ac994d62c5a2fbdec49b3d56b96fd8fdcadfeb6d967cc521e983c7a84f26
7
+ data.tar.gz: f3440ccc3800260c21481da110ea68aa40e4d48ca70ab1e6292d80435820f389f0f59f3f02c31029812d2d9335d42cbddcefc3f40c1e667d0a21e139642e5d7c
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  require "json"
2
3
  require "erb"
3
4
 
@@ -0,0 +1,10 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Bskyrb
5
+ class Error < StandardError; end
6
+
7
+ class HTTPError < Error; end
8
+
9
+ class UnauthorizedError < HTTPError; end
10
+ end
@@ -1,39 +1,37 @@
1
- require 'faye/websocket'
2
- require 'eventmachine'
3
- require 'cbor'
4
- require 'json'
1
+ # typed: false
2
+ require "faye/websocket"
3
+ require "eventmachine"
4
+ require "cbor"
5
+ require "json"
5
6
 
6
7
  EM.run {
7
- ws = Faye::WebSocket::Client.new('wss://bsky.social/xrpc/com.atproto.sync.subscribeRepos')
8
+ ws = Faye::WebSocket::Client.new("wss://bsky.social/xrpc/com.atproto.sync.subscribeRepos")
8
9
 
9
10
  ws.on :open do |event|
10
11
  p [:open]
11
- ws.send('Hello, world!')
12
+ ws.send("Hello, world!")
12
13
  end
13
14
 
14
15
  ws.on :message do |event|
15
16
  msg_bytes = event.data
16
- unpacker = CBOR::Unpacker.new(StringIO.new(msg_bytes.pack('C*')))
17
- header, payload = unpacker.each.to_a
18
-
17
+ unpacker = CBOR::Unpacker.new(StringIO.new(msg_bytes.pack("C*")))
18
+ header, payload = unpacker.each.to_a
19
+
19
20
  # decoder = CBOR::Decoding.new(StringIO.new(msg_bytes.pack('C*')))
20
21
  # while item = decoder.read
21
22
  # puts item
22
23
  # end
23
24
 
24
- begin
25
- if payload["ops"].first["path"].include? "app.bsky.feed.post"
26
- #payload#["blocks"].length
27
- decoded = CBOR.decode(payload)
25
+ if payload["ops"].first["path"].include? "app.bsky.feed.post"
26
+ # payload#["blocks"].length
27
+ decoded = CBOR.decode(payload)
28
28
 
29
- # Convert the decoded object to JSON
30
- json = decoded.to_json
31
-
32
- # Print the JSON object
33
- puts json
34
- end
35
- end
29
+ # Convert the decoded object to JSON
30
+ json = decoded.to_json
36
31
 
32
+ # Print the JSON object
33
+ puts json
34
+ end
37
35
  end
38
- }
36
+ }
39
37
  # end