Class: LaunchDarkly::Impl::DataSystem::ProtocolV2::Goodbye Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ldclient-rb/impl/data_system/protocolv2.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.

Goodbye represents a goodbye event.

This type is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is not suitable for production usage.

Since:

  • 5.5.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason:, silent:, catastrophe:) ⇒ Goodbye

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 Goodbye.

Parameters:

  • reason (String)

    The reason for goodbye

  • silent (Boolean)

    Whether the goodbye is silent

  • catastrophe (Boolean)

    Whether this represents a catastrophic failure

Since:

  • 5.5.0



174
175
176
177
178
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 174

def initialize(reason:, silent:, catastrophe:)
  @reason = reason
  @silent = silent
  @catastrophe = catastrophe
end

Instance Attribute Details

#catastropheBoolean (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 Whether this represents a catastrophic failure.

Returns:

  • (Boolean)

    Whether this represents a catastrophic failure

Since:

  • 5.5.0



167
168
169
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 167

def catastrophe
  @catastrophe
end

#reasonString (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 The reason for goodbye.

Returns:

  • (String)

    The reason for goodbye

Since:

  • 5.5.0



161
162
163
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 161

def reason
  @reason
end

#silentBoolean (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 Whether the goodbye is silent.

Returns:

  • (Boolean)

    Whether the goodbye is silent

Since:

  • 5.5.0



164
165
166
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 164

def silent
  @silent
end

Class Method Details

.from_h(data) ⇒ Goodbye

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.

Deserializes a Goodbye event from a JSON-compatible hash.

Parameters:

  • data (Hash)

    The hash representation

Returns:

Raises:

  • (ArgumentError)

    if required fields are missing

Since:

  • 5.5.0



200
201
202
203
204
205
206
207
208
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 200

def self.from_h(data)
  reason = data[:reason]
  silent = data[:silent]
  catastrophe = data[:catastrophe]

  raise ArgumentError, "Missing required fields in Goodbye" if reason.nil? || silent.nil? || catastrophe.nil?

  new(reason: reason, silent: silent, catastrophe: catastrophe)
end

Instance Method Details

#to_hHash

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.

Serializes the Goodbye to a JSON-compatible hash.

Returns:

  • (Hash)

Since:

  • 5.5.0



185
186
187
188
189
190
191
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 185

def to_h
  {
    reason: @reason,
    silent: @silent,
    catastrophe: @catastrophe,
  }
end