Class: EvilEvents::Core::Events::Serializers::Base::EventSerializationState Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evil_events/core/events/serializers/base/event_serialization_state.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.4.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, type:, payload:, metadata:) ⇒ EventSerializationState

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of EventSerializationState.

Parameters:

  • id (Hash)

    a customizable set of options

  • type (Hash)

    a customizable set of options

  • payload (Hash)

    a customizable set of options

  • metadata (Hash)

    a customizable set of options

Options Hash (id:):

  • (String, Integer, Object)

Options Hash (type:):

  • (String)

Options Hash (payload:):

  • (::Hash)

Options Hash (metadata:):

  • (::Hash)

Since:

  • 0.4.0



61
62
63
64
65
66
# File 'lib/evil_events/core/events/serializers/base/event_serialization_state.rb', line 61

def initialize(id:, type:, payload:, metadata:)
  @id       = id
  @type     = type
  @payload  = payload
   = 
end

Instance Attribute Details

#idString, ... (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String, Integer, Object)

Since:

  • 0.4.0



34
35
36
# File 'lib/evil_events/core/events/serializers/base/event_serialization_state.rb', line 34

def id
  @id
end

#metadata::Hash (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (::Hash)

Since:

  • 0.4.0



52
53
54
# File 'lib/evil_events/core/events/serializers/base/event_serialization_state.rb', line 52

def 
  
end

#payload::Hash (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (::Hash)

Since:

  • 0.4.0



46
47
48
# File 'lib/evil_events/core/events/serializers/base/event_serialization_state.rb', line 46

def payload
  @payload
end

#typeString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)

Since:

  • 0.4.0



40
41
42
# File 'lib/evil_events/core/events/serializers/base/event_serialization_state.rb', line 40

def type
  @type
end

Class Method Details

.build_from_event(event) ⇒ EventSerializationState

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • event (EvilEvents::Core::Event::AbstractEvent)

Returns:

Since:

  • 0.4.0



13
14
15
# File 'lib/evil_events/core/events/serializers/base/event_serialization_state.rb', line 13

def build_from_event(event)
  new(id: event.id, type: event.type, payload: event.payload, metadata: event.)
end

.build_from_options(**options) ⇒ EventSerializationState

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • id (Hash)

    a customizable set of options

  • type (Hash)

    a customizable set of options

  • payload (Hash)

    a customizable set of options

  • metadata (Hash)

    a customizable set of options

Returns:

Since:

  • 0.4.0



25
26
27
# File 'lib/evil_events/core/events/serializers/base/event_serialization_state.rb', line 25

def build_from_options(**options)
  new(**options)
end

Instance Method Details

#valid?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

Since:

  • 0.4.0



72
73
74
75
76
77
78
# File 'lib/evil_events/core/events/serializers/base/event_serialization_state.rb', line 72

def valid?
  return false unless type && payload && 
  return false unless payload.is_a?(::Hash)
  return false unless .is_a?(::Hash)
  return false unless type.is_a?(String)
  true
end