bskyrb 0.5 → 0.5.2

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: 0446dc11827c6a05fef76c05c2e6a8352c0d22aca38596b38829a992905f3724
4
- data.tar.gz: bb1388b216c99ec84219439b087b74f43d39bb27bc7b6a8bb40c2cc73791c11e
3
+ metadata.gz: acb1d587977217b5e0e2e373c422fe69702364524c29d96ddf6b3cf5c537eed5
4
+ data.tar.gz: 7094841141b05f7b24024c6ebd5df494486f125202ce2ceb79e06ef29b9512dc
5
5
  SHA512:
6
- metadata.gz: f0c77673776705697470560d6142ba51f0f88d0cfd81d536af44cba856bd82ad271c9a7ab5446af463dd1f930e1f54b0a49354bd9f8fae208a8df65a71b2adb3
7
- data.tar.gz: 38939c101cc5f0eee20f9ddf52ef1da5ded8bef79654ef7a6f04f45f311c7771c27322e2c2137869c2202f3899ba22fc52ec64e0524d896821394e2e34dd102d
6
+ metadata.gz: 012464fcc4bf3c84ada9a11b0f9bc7b13d7bcbff3378cc9724822474daa11eeb37b718589498f15885b9efc4694b0e46b8884d00af3e2a7126dcead4ff3d2fd0
7
+ data.tar.gz: 26cea956181b0d593a7e164de63b8d48293c94308d2bba3c53461add0d5254f229bb9072198fa661f4f6c2df526ab9429bf7804b3c1672512f11419a1ccea279
@@ -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