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.

Since:

  • 5.5.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason:) ⇒ 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

Since:

  • 5.5.0



157
158
159
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 157

def initialize(reason:)
  @reason = reason
end

Instance Attribute Details

#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



152
153
154
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 152

def reason
  @reason
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



179
180
181
182
183
184
185
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 179

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

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

  new(reason: reason)
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



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

def to_h
  {
    reason: @reason,
  }
end