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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +182 -29
  4. data/example/block_tracker.rb +1 -1
  5. data/example/{monitor_phrases.rb → jet_monitor_phrases.rb} +3 -2
  6. data/example/print_all_posts.rb +1 -1
  7. data/example/push_notifications.rb +1 -1
  8. data/lib/skyfall/collection.rb +26 -0
  9. data/lib/skyfall/{messages → firehose}/account_message.rb +3 -1
  10. data/lib/skyfall/{messages → firehose}/commit_message.rb +9 -3
  11. data/lib/skyfall/firehose/handle_message.rb +14 -0
  12. data/lib/skyfall/firehose/identity_message.rb +9 -0
  13. data/lib/skyfall/{messages → firehose}/info_message.rb +3 -1
  14. data/lib/skyfall/{messages → firehose}/labels_message.rb +2 -2
  15. data/lib/skyfall/{messages/websocket_message.rb → firehose/message.rb} +13 -11
  16. data/lib/skyfall/firehose/operation.rb +58 -0
  17. data/lib/skyfall/firehose/tombstone_message.rb +11 -0
  18. data/lib/skyfall/firehose/unknown_message.rb +6 -0
  19. data/lib/skyfall/firehose.rb +79 -0
  20. data/lib/skyfall/jetstream/account_message.rb +19 -0
  21. data/lib/skyfall/jetstream/commit_message.rb +16 -0
  22. data/lib/skyfall/jetstream/identity_message.rb +15 -0
  23. data/lib/skyfall/jetstream/message.rb +50 -0
  24. data/lib/skyfall/jetstream/operation.rb +58 -0
  25. data/lib/skyfall/jetstream/unknown_message.rb +6 -0
  26. data/lib/skyfall/jetstream.rb +121 -0
  27. data/lib/skyfall/stream.rb +39 -59
  28. data/lib/skyfall/version.rb +1 -1
  29. data/lib/skyfall.rb +4 -2
  30. metadata +21 -14
  31. data/example/follower_tracker.rb +0 -84
  32. data/lib/skyfall/messages/handle_message.rb +0 -12
  33. data/lib/skyfall/messages/identity_message.rb +0 -7
  34. data/lib/skyfall/messages/tombstone_message.rb +0 -9
  35. data/lib/skyfall/messages/unknown_message.rb +0 -4
  36. data/lib/skyfall/operation.rb +0 -74
@@ -1,7 +0,0 @@
1
- module Skyfall
2
- class IdentityMessage < WebsocketMessage
3
- def handle
4
- @data_object['handle']
5
- end
6
- end
7
- end
@@ -1,9 +0,0 @@
1
- module Skyfall
2
-
3
- #
4
- # Note: this event type is deprecated and will stop being emitted at some point.
5
- # You should instead listen for 'account' events (Skyfall::AccountMessage).
6
- #
7
- class TombstoneMessage < WebsocketMessage
8
- end
9
- end
@@ -1,4 +0,0 @@
1
- module Skyfall
2
- class UnknownMessage < WebsocketMessage
3
- end
4
- end
@@ -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