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.

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



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

#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



87
88
89
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 87

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



84
85
86
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 84

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



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

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



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.

Parameters:

  • data (Hash)

    The hash representation

Returns:

Raises:

  • (ArgumentError)

    if required fields are missing

Since:

  • 5.5.0



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

#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



110
111
112
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 110

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



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