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.
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.
98 99 100 101 102 103 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 98 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.
87 88 89 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 87 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).
84 85 86 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 84 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.
90 91 92 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 90 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.
81 82 83 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 81 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.
135 136 137 138 139 140 141 142 143 144 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 135 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.
110 111 112 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 110 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.
119 120 121 122 123 124 125 126 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 119 def to_h { version: @version, kind: @kind, key: @key, object: @object, } end |