Class: LaunchDarkly::Impl::DataSystem::ProtocolV2::Error Private
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::DataSystem::ProtocolV2::Error
- 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.
Instance Attribute Summary collapse
-
#payload_id ⇒ String
readonly
private
The payload ID.
-
#reason ⇒ String
readonly
private
The reason for the error.
Class Method Summary collapse
-
.from_h(data) ⇒ Error
private
Deserializes an Error from a JSON-compatible hash.
Instance Method Summary collapse
-
#initialize(payload_id:, reason:) ⇒ Error
constructor
private
A new instance of Error.
-
#to_h ⇒ Hash
private
Serializes the Error to a JSON-compatible hash.
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.
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_id ⇒ String (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.
219 220 221 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 219 def payload_id @payload_id end |
#reason ⇒ String (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.
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.
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_h ⇒ Hash
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.
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 |