Class: LaunchDarkly::Impl::DataSystem::ProtocolV2::Error 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.

Error represents an error 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(payload_id:, reason:) ⇒ Error

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

Parameters:

  • payload_id (String)

    The payload ID

  • reason (String)

    The reason for the error

Since:

  • 5.5.0



228
229
230
231
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 228

def initialize(payload_id:, reason:)
  @payload_id = payload_id
  @reason = reason
end

Instance Attribute Details

#payload_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 The payload ID.

Returns:

  • (String)

    The payload ID

Since:

  • 5.5.0



219
220
221
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 219

def payload_id
  @payload_id
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 the error.

Returns:

  • (String)

    The reason for the error

Since:

  • 5.5.0



222
223
224
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 222

def reason
  @reason
end

Class Method Details

.from_h(data) ⇒ Error

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 an Error from a JSON-compatible hash.

Parameters:

  • data (Hash)

    The hash representation

Returns:

Raises:

  • (ArgumentError)

    if required fields are missing

Since:

  • 5.5.0



252
253
254
255
256
257
258
259
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 252

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

  raise ArgumentError, "Missing required fields in Error" if payload_id.nil? || reason.nil?

  new(payload_id: payload_id, 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 Error to a JSON-compatible hash.

Returns:

  • (Hash)

Since:

  • 5.5.0



238
239
240
241
242
243
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 238

def to_h
  {
    payloadId: @payload_id,
    reason: @reason,
  }
end