diff --git a/CHANGELOG.md b/CHANGELOG.md index ed54178..46aa37a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Unreleased - un-deprecated `#path` in both `Operation` classes (marked deprecated in 0.7.0) +- added `#ops` as alias for `#operations` in all message classes - fixed `CommitMessage#prev_data` throwing an error if `prevData` is nil - updated Firehose message constructors to verify that required fields aren't nil (not only that they're present), and for `LabelsMessage` that `labels` is an array diff --git a/lib/skyfall/firehose/commit_message.rb b/lib/skyfall/firehose/commit_message.rb index 551ac29..767b71b 100644 --- a/lib/skyfall/firehose/commit_message.rb +++ b/lib/skyfall/firehose/commit_message.rb @@ -60,6 +60,8 @@ module Skyfall @operations ||= @data_object['ops'].map { |op| Firehose::Operation.new(self, op) } end + alias ops operations + # Looks up record data assigned to a given operation in the commit's CAR archive. # @param op [Firehose::Operation] # @return [Hash, nil] diff --git a/lib/skyfall/firehose/message.rb b/lib/skyfall/firehose/message.rb index 3a9468d..b2bd0bb 100644 --- a/lib/skyfall/firehose/message.rb +++ b/lib/skyfall/firehose/message.rb @@ -109,6 +109,8 @@ module Skyfall [] end + alias ops operations + # # @return [Boolean] true if the message is {Firehose::UnknownMessage} (of unrecognized type) # diff --git a/lib/skyfall/jetstream/commit_message.rb b/lib/skyfall/jetstream/commit_message.rb index cdae651..dce7125 100644 --- a/lib/skyfall/jetstream/commit_message.rb +++ b/lib/skyfall/jetstream/commit_message.rb @@ -45,5 +45,7 @@ module Skyfall def operations [operation] end + + alias ops operations end end diff --git a/lib/skyfall/jetstream/message.rb b/lib/skyfall/jetstream/message.rb index 9a7ec6b..5203234 100644 --- a/lib/skyfall/jetstream/message.rb +++ b/lib/skyfall/jetstream/message.rb @@ -114,6 +114,8 @@ module Skyfall [] end + alias ops operations + # # Timestamp decoded from the message. # diff --git a/spec/firehose/account_message_spec.rb b/spec/firehose/account_message_spec.rb index 63b0f19..fbc628d 100644 --- a/spec/firehose/account_message_spec.rb +++ b/spec/firehose/account_message_spec.rb @@ -68,6 +68,7 @@ describe Skyfall::Firehose::AccountMessage do it 'should have an operations field that returns []' do message = build_message(cbor) message.operations.should == [] + message.ops.should == [] end context 'for an active account' do diff --git a/spec/firehose/commit_message_spec.rb b/spec/firehose/commit_message_spec.rb index e64f7a7..08f279c 100644 --- a/spec/firehose/commit_message_spec.rb +++ b/spec/firehose/commit_message_spec.rb @@ -90,6 +90,8 @@ describe Skyfall::Firehose::CommitMessage do message.operations[0].collection.should == "app.bsky.feed.post" message.operations[0].rkey.should == "3mt37ifa2ev2f" message.operations[0].action.should == :create + + message.ops.should equal(message.operations) end it 'should parse blocks' do diff --git a/spec/firehose/identity_message_spec.rb b/spec/firehose/identity_message_spec.rb index 974e2b1..93e7bbd 100644 --- a/spec/firehose/identity_message_spec.rb +++ b/spec/firehose/identity_message_spec.rb @@ -68,6 +68,7 @@ describe Skyfall::Firehose::IdentityMessage do it 'should have an operations field that returns []' do message = build_message(cbor) message.operations.should == [] + message.ops.should == [] end end diff --git a/spec/firehose/info_message_spec.rb b/spec/firehose/info_message_spec.rb index 7ae8ed9..5b0daa9 100644 --- a/spec/firehose/info_message_spec.rb +++ b/spec/firehose/info_message_spec.rb @@ -67,6 +67,7 @@ describe Skyfall::Firehose::InfoMessage do it 'should have an operations field that returns []' do message = build_message(cbor) message.operations.should == [] + message.ops.should == [] end end diff --git a/spec/firehose/labels_message_spec.rb b/spec/firehose/labels_message_spec.rb index a3c6adf..a37e52d 100644 --- a/spec/firehose/labels_message_spec.rb +++ b/spec/firehose/labels_message_spec.rb @@ -84,6 +84,7 @@ describe Skyfall::Firehose::LabelsMessage do it 'should have an operations field that returns []' do message = build_message(cbor) message.operations.should == [] + message.ops.should == [] end end diff --git a/spec/firehose/sync_message_spec.rb b/spec/firehose/sync_message_spec.rb index 3624cc7..72cea94 100644 --- a/spec/firehose/sync_message_spec.rb +++ b/spec/firehose/sync_message_spec.rb @@ -79,6 +79,7 @@ describe Skyfall::Firehose::SyncMessage do it 'should have an operations field that returns []' do message = build_message(cbor) message.operations.should == [] + message.ops.should == [] end end end diff --git a/spec/firehose/unknown_message_spec.rb b/spec/firehose/unknown_message_spec.rb index a1811b7..07e598c 100644 --- a/spec/firehose/unknown_message_spec.rb +++ b/spec/firehose/unknown_message_spec.rb @@ -44,6 +44,7 @@ describe Skyfall::Firehose::UnknownMessage do it 'should have an operations field that returns []' do message = build_message(cbor) message.operations.should == [] + message.ops.should == [] end end end