Class: LaunchDarkly::Impl::DataSystem::ProtocolV2::PutObject Private
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::DataSystem::ProtocolV2::PutObject
- 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.
PutObject specifies the addition of a particular object with upsert semantics.
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
-
#key ⇒ Symbol
readonly
private
The key.
-
#kind ⇒ String
readonly
private
The object kind (LaunchDarkly::Interfaces::DataSystem::ObjectKind).
-
#object ⇒ Hash
readonly
private
The object data.
-
#version ⇒ Integer
readonly
private
The version.
Class Method Summary collapse
-
.from_h(data) ⇒ PutObject
private
Deserializes a PutObject from a JSON-compatible hash.
Instance Method Summary collapse
-
#initialize(version:, kind:, key:, object:) ⇒ PutObject
constructor
private
A new instance of PutObject.
-
#name ⇒ Symbol
private
Returns the event name.
-
#to_h ⇒ Hash
private
Serializes the PutObject to a JSON-compatible hash.
Constructor Details
#initialize(version:, kind:, key:, object:) ⇒ PutObject
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 PutObject.
104 105 106 107 108 109 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 104 def initialize(version:, kind:, key:, object:) @version = version @kind = kind @key = key @object = object end |
Instance Attribute Details
#key ⇒ Symbol (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 key.
93 94 95 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 93 def key @key end |
#kind ⇒ 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 object kind (LaunchDarkly::Interfaces::DataSystem::ObjectKind).
90 91 92 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 90 def kind @kind end |
#object ⇒ Hash (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 object data.
96 97 98 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 96 def object @object end |
#version ⇒ Integer (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 version.
87 88 89 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 87 def version @version end |
Class Method Details
.from_h(data) ⇒ PutObject
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 PutObject from a JSON-compatible hash.
141 142 143 144 145 146 147 148 149 150 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 141 def self.from_h(data) version = data[:version] kind = data[:kind] key = data[:key] object_data = data[:object] raise ArgumentError, "Missing required fields in PutObject" if version.nil? || kind.nil? || key.nil? || object_data.nil? new(version: version, kind: kind, key: key.to_sym, object: object_data) end |
Instance Method Details
#name ⇒ Symbol
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 event name.
116 117 118 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 116 def name LaunchDarkly::Interfaces::DataSystem::EventName::PUT_OBJECT end |
#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 PutObject to a JSON-compatible hash.
125 126 127 128 129 130 131 132 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 125 def to_h { version: @version, kind: @kind, key: @key, object: @object, } end |