Class: Skyfall::Jetstream::AccountMessage
- Defined in:
- lib/skyfall/jetstream/account_message.rb
Overview
Jetstream message sent when the status of an account changes. This can be:
-
an account being created, sending its initial state (should be active)
-
an account being deactivated or suspended
-
an account being restored back to an active state from deactivation/suspension
-
an account being deleted (the status returning
:deleted)
Instance Attribute Summary
Attributes inherited from Message
Instance Method Summary collapse
-
#active? ⇒ Boolean
True if the account is active, false if it’s deactivated/suspended etc.
-
#initialize(json) ⇒ AccountMessage
constructor
A new instance of AccountMessage.
-
#status ⇒ Symbol?
For inactive accounts, specifies the exact state; nil for active accounts.
Methods inherited from Message
new, #operation, #operations, #time, #unknown?
Constructor Details
#initialize(json) ⇒ AccountMessage
Returns a new instance of AccountMessage.
24 25 26 27 |
# File 'lib/skyfall/jetstream/account_message.rb', line 24 def initialize(json) raise DecodeError.new("Missing event details (account)") if json['account'].nil? || json['account']['active'].nil? super end |
Instance Method Details
#active? ⇒ Boolean
Returns true if the account is active, false if it’s deactivated/suspended etc.
30 31 32 |
# File 'lib/skyfall/jetstream/account_message.rb', line 30 def active? @json['account']['active'] end |
#status ⇒ Symbol?
Returns for inactive accounts, specifies the exact state; nil for active accounts.
35 36 37 |
# File 'lib/skyfall/jetstream/account_message.rb', line 35 def status @json['account']['status']&.to_sym end |