Class: LaunchDarkly::Impl::DataSystem::ProtocolV2::PutObject Private

Inherits:
Object
  • Object
show all
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.

Since:

  • 5.5.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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.

Parameters:

Since:

  • 5.5.0



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

#keySymbol (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.

Returns:

  • (Symbol)

    The key

Since:

  • 5.5.0



93
94
95
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 93

def key
  @key
end

#kindString (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).

Returns:

Since:

  • 5.5.0



90
91
92
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 90

def kind
  @kind
end

#objectHash (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.

Returns:

  • (Hash)

    The object data

Since:

  • 5.5.0



96
97
98
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 96

def object
  @object
end

#versionInteger (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.

Returns:

  • (Integer)

    The version

Since:

  • 5.5.0



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.

Parameters:

  • data (Hash)

    The hash representation

Returns:

Raises:

  • (ArgumentError)

    if required fields are missing

Since:

  • 5.5.0



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

#nameSymbol

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.

Returns:

  • (Symbol)

Since:

  • 5.5.0



116
117
118
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 116

def name
  LaunchDarkly::Interfaces::DataSystem::EventName::PUT_OBJECT
end

#to_hHash

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.

Returns:

  • (Hash)

Since:

  • 5.5.0



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