Class: LaunchDarkly::Interfaces::DataSystem::ServerIntent
- Inherits:
-
Object
- Object
- LaunchDarkly::Interfaces::DataSystem::ServerIntent
- Defined in:
- lib/ldclient-rb/interfaces/data_system.rb
Overview
ServerIntent represents the type of change associated with the payload.
This type is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is in early access. If you want access to this feature please join the EAP. launchdarkly.com/docs/sdk/features/data-saving-mode
Instance Attribute Summary collapse
-
#payload ⇒ Payload
readonly
The payload.
Class Method Summary collapse
-
.from_h(data) ⇒ ServerIntent
Deserializes a ServerIntent from a Hash.
Instance Method Summary collapse
-
#initialize(payload:) ⇒ ServerIntent
constructor
A new instance of ServerIntent.
-
#to_h ⇒ Hash
Serializes the ServerIntent to a Hash.
Constructor Details
#initialize(payload:) ⇒ ServerIntent
Returns a new instance of ServerIntent.
370 371 372 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 370 def initialize(payload:) @payload = payload end |
Instance Attribute Details
#payload ⇒ Payload (readonly)
Returns The payload.
365 366 367 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 365 def payload @payload end |
Class Method Details
.from_h(data) ⇒ ServerIntent
Deserializes a ServerIntent from a Hash.
392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 392 def self.from_h(data) payloads = data['payloads'] || data[:payloads] raise ArgumentError, "Invalid data for ServerIntent: 'payloads' key is missing or not an array" unless payloads.is_a?(Array) raise ArgumentError, "Invalid data for ServerIntent: expected exactly one payload" unless payloads.length == 1 payload = payloads[0] raise ArgumentError, "Invalid payload in ServerIntent: expected a hash" unless payload.is_a?(Hash) ServerIntent.new(payload: Payload.from_h(payload)) end |
Instance Method Details
#to_h ⇒ Hash
Serializes the ServerIntent to a Hash.
379 380 381 382 383 |
# File 'lib/ldclient-rb/interfaces/data_system.rb', line 379 def to_h { payloads: [@payload.to_h], } end |