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.
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.
202 203 204 205 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 202 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.
193 194 195 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 193 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.
196 197 198 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 196 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.
226 227 228 229 230 231 232 233 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 226 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.
212 213 214 215 216 217 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 212 def to_h { payloadId: @payload_id, reason: @reason, } end |