Class: Skyfall::Firehose::AccountMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/skyfall/firehose/account_message.rb

Overview

Firehose 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 collapse

Attributes inherited from Message

#data_object, #did, #seq, #type, #type_object

Instance Method Summary collapse

Methods inherited from Message

#inspect, new, #operations, #time, #unknown?

Constructor Details

#initialize(type_object, data_object) ⇒ AccountMessage

Returns a new instance of AccountMessage.

Parameters:

  • first decoded CBOR frame with metadata

  • second decoded CBOR frame with payload

Raises:

  • if the message doesn’t include required data



25
26
27
28
29
30
31
# File 'lib/skyfall/firehose/account_message.rb', line 25

def initialize(type_object, data_object)
  super
  check_if_not_nil 'seq', 'did', 'time', 'active'

  @active = @data_object['active']
  @status = @data_object['status']&.to_sym
end

Instance Attribute Details

#statusSymbol? (readonly)

Returns for inactive accounts, specifies the exact state; nil for active accounts.

Returns:

  • for inactive accounts, specifies the exact state; nil for active accounts



39
40
41
# File 'lib/skyfall/firehose/account_message.rb', line 39

def status
  @status
end

Instance Method Details

#active?Boolean

Returns true if the account is active, false if it’s deactivated/suspended etc.

Returns:

  • true if the account is active, false if it’s deactivated/suspended etc.



34
35
36
# File 'lib/skyfall/firehose/account_message.rb', line 34

def active?
  @active
end