skyfall 0.4.1 → 0.5.0
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 +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +182 -29
- data/example/block_tracker.rb +1 -1
- data/example/{monitor_phrases.rb → jet_monitor_phrases.rb} +3 -2
- data/example/print_all_posts.rb +1 -1
- data/example/push_notifications.rb +1 -1
- data/lib/skyfall/collection.rb +26 -0
- data/lib/skyfall/{messages → firehose}/account_message.rb +3 -1
- data/lib/skyfall/{messages → firehose}/commit_message.rb +9 -3
- data/lib/skyfall/firehose/handle_message.rb +14 -0
- data/lib/skyfall/firehose/identity_message.rb +9 -0
- data/lib/skyfall/{messages → firehose}/info_message.rb +3 -1
- data/lib/skyfall/{messages → firehose}/labels_message.rb +2 -2
- data/lib/skyfall/{messages/websocket_message.rb → firehose/message.rb} +13 -11
- data/lib/skyfall/firehose/operation.rb +58 -0
- data/lib/skyfall/firehose/tombstone_message.rb +11 -0
- data/lib/skyfall/firehose/unknown_message.rb +6 -0
- data/lib/skyfall/firehose.rb +79 -0
- data/lib/skyfall/jetstream/account_message.rb +19 -0
- data/lib/skyfall/jetstream/commit_message.rb +16 -0
- data/lib/skyfall/jetstream/identity_message.rb +15 -0
- data/lib/skyfall/jetstream/message.rb +50 -0
- data/lib/skyfall/jetstream/operation.rb +58 -0
- data/lib/skyfall/jetstream/unknown_message.rb +6 -0
- data/lib/skyfall/jetstream.rb +121 -0
- data/lib/skyfall/stream.rb +39 -59
- data/lib/skyfall/version.rb +1 -1
- data/lib/skyfall.rb +4 -2
- metadata +21 -14
- data/example/follower_tracker.rb +0 -84
- data/lib/skyfall/messages/handle_message.rb +0 -12
- data/lib/skyfall/messages/identity_message.rb +0 -7
- data/lib/skyfall/messages/tombstone_message.rb +0 -9
- data/lib/skyfall/messages/unknown_message.rb +0 -4
- data/lib/skyfall/operation.rb +0 -74
data/lib/skyfall/operation.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
require_relative 'collection'
|
2
|
-
|
3
|
-
module Skyfall
|
4
|
-
class Operation
|
5
|
-
def initialize(message, json)
|
6
|
-
@message = message
|
7
|
-
@json = json
|
8
|
-
end
|
9
|
-
|
10
|
-
def repo
|
11
|
-
@message.repo
|
12
|
-
end
|
13
|
-
|
14
|
-
alias did repo
|
15
|
-
|
16
|
-
def path
|
17
|
-
@json['path']
|
18
|
-
end
|
19
|
-
|
20
|
-
def action
|
21
|
-
@json['action'].to_sym
|
22
|
-
end
|
23
|
-
|
24
|
-
def collection
|
25
|
-
@json['path'].split('/')[0]
|
26
|
-
end
|
27
|
-
|
28
|
-
def rkey
|
29
|
-
@json['path'].split('/')[1]
|
30
|
-
end
|
31
|
-
|
32
|
-
def uri
|
33
|
-
"at://#{repo}/#{path}"
|
34
|
-
end
|
35
|
-
|
36
|
-
def cid
|
37
|
-
@cid ||= @json['cid'] && CID.from_cbor_tag(@json['cid'])
|
38
|
-
end
|
39
|
-
|
40
|
-
def raw_record
|
41
|
-
@raw_record ||= cid && @message.blocks.section_with_cid(cid)
|
42
|
-
end
|
43
|
-
|
44
|
-
def type
|
45
|
-
case collection
|
46
|
-
when Collection::BSKY_BLOCK then :bsky_block
|
47
|
-
when Collection::BSKY_FEED then :bsky_feed
|
48
|
-
when Collection::BSKY_FOLLOW then :bsky_follow
|
49
|
-
when Collection::BSKY_LABELER then :bsky_labeler
|
50
|
-
when Collection::BSKY_LIKE then :bsky_like
|
51
|
-
when Collection::BSKY_LIST then :bsky_list
|
52
|
-
when Collection::BSKY_LISTBLOCK then :bsky_listblock
|
53
|
-
when Collection::BSKY_LISTITEM then :bsky_listitem
|
54
|
-
when Collection::BSKY_POST then :bsky_post
|
55
|
-
when Collection::BSKY_POSTGATE then :bsky_postgate
|
56
|
-
when Collection::BSKY_PROFILE then :bsky_profile
|
57
|
-
when Collection::BSKY_REPOST then :bsky_repost
|
58
|
-
when Collection::BSKY_STARTERPACK then :bsky_starterpack
|
59
|
-
when Collection::BSKY_THREADGATE then :bsky_threadgate
|
60
|
-
when Collection::BSKY_CHAT_DECLARATION then :bsky_chat_declaration
|
61
|
-
else :unknown
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def inspectable_variables
|
66
|
-
instance_variables - [:@message]
|
67
|
-
end
|
68
|
-
|
69
|
-
def inspect
|
70
|
-
vars = inspectable_variables.map { |v| "#{v}=#{instance_variable_get(v).inspect}" }.join(", ")
|
71
|
-
"#<#{self.class}:0x#{object_id} #{vars}>"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|