Module: BSV::Wallet::Fetchable
- Defined in:
- lib/bsv/wallet/fetchable.rb
Overview
Mixin contract for entities that can fetch state from the network.
Include this module in any model that needs to poll a network service for updated state (e.g. checking transaction status, retrieving merkle proofs).
The including class must override every method — the defaults raise NotImplementedError to enforce the contract.
Designed to work alongside Pushable. When a class includes both, only one write! method exists — the class must provide its own override that handles both push and fetch response shapes.
Instance Method Summary collapse
-
#fetch_args ⇒ Hash
The arguments to pass to the protocol command.
-
#fetch_command ⇒ Symbol
The protocol command to invoke (e.g.
:get_tx_status). -
#needs_fetch? ⇒ Boolean
Whether this entity currently needs fetching.
-
#write!(response) ⇒ Object
Update self from the network response after a successful fetch.
Instance Method Details
#fetch_args ⇒ Hash
The arguments to pass to the protocol command.
28 29 30 |
# File 'lib/bsv/wallet/fetchable.rb', line 28 def fetch_args raise NotImplementedError, "#{self.class}#fetch_args not implemented" end |
#fetch_command ⇒ Symbol
The protocol command to invoke (e.g. :get_tx_status).
21 22 23 |
# File 'lib/bsv/wallet/fetchable.rb', line 21 def fetch_command raise NotImplementedError, "#{self.class}#fetch_command not implemented" end |
#needs_fetch? ⇒ Boolean
Whether this entity currently needs fetching.
42 43 44 |
# File 'lib/bsv/wallet/fetchable.rb', line 42 def needs_fetch? raise NotImplementedError, "#{self.class}#needs_fetch? not implemented" end |
#write!(response) ⇒ Object
Update self from the network response after a successful fetch.
35 36 37 |
# File 'lib/bsv/wallet/fetchable.rb', line 35 def write!(response) raise NotImplementedError, "#{self.class}#write! not implemented" end |