Class: Imperium::KVPair

Inherits:
APIObject show all
Defined in:
lib/imperium/kv_pair.rb

Overview

KVPair provides a more OO/Rubyish interface to the objects returned from the KV API on a GET request.

Instance Attribute Summary collapse

Method Summary

Methods inherited from APIObject

#==, #attribute_map, #initialize, #ruby_attribute_names, #to_h

Constructor Details

This class inherits a constructor from Imperium::APIObject

Instance Attribute Details

#create_indexInteger

Returns The internal index value representing when the entry was created.

Returns:

  • (Integer)

    The internal index value representing when the entry was created.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/imperium/kv_pair.rb', line 28

class KVPair < APIObject
  self.attribute_map = {
    'LockIndex' => :lock_index,
    'Session' => :session,
    'Key' => :key,
    'Flags' => :flags,
    'Value' => :value,
    'CreateIndex' => :create_index,
    'ModifyIndex' => :modify_index,
  }.freeze

  # Capture and base64 decode a value from the api.
  #
  # @param value [String] The base64 encoded value from the response.
  def value=(value)
    return @value = nil if value.nil?
    @value = Base64.decode64 value
  end
end

#flagsInteger

Returns An opaque unsigned integer for use by the client application.

Returns:

  • (Integer)

    An opaque unsigned integer for use by the client application.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/imperium/kv_pair.rb', line 28

class KVPair < APIObject
  self.attribute_map = {
    'LockIndex' => :lock_index,
    'Session' => :session,
    'Key' => :key,
    'Flags' => :flags,
    'Value' => :value,
    'CreateIndex' => :create_index,
    'ModifyIndex' => :modify_index,
  }.freeze

  # Capture and base64 decode a value from the api.
  #
  # @param value [String] The base64 encoded value from the response.
  def value=(value)
    return @value = nil if value.nil?
    @value = Base64.decode64 value
  end
end

#keyString

Returns The full path for the entry.

Returns:

  • (String)

    The full path for the entry.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/imperium/kv_pair.rb', line 28

class KVPair < APIObject
  self.attribute_map = {
    'LockIndex' => :lock_index,
    'Session' => :session,
    'Key' => :key,
    'Flags' => :flags,
    'Value' => :value,
    'CreateIndex' => :create_index,
    'ModifyIndex' => :modify_index,
  }.freeze

  # Capture and base64 decode a value from the api.
  #
  # @param value [String] The base64 encoded value from the response.
  def value=(value)
    return @value = nil if value.nil?
    @value = Base64.decode64 value
  end
end

#lock_indexInteger

Returns The number of times this key has successfully been locked, the #session attribute indicates which session owns the lock.

Returns:

  • (Integer)

    The number of times this key has successfully been locked, the #session attribute indicates which session owns the lock.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/imperium/kv_pair.rb', line 28

class KVPair < APIObject
  self.attribute_map = {
    'LockIndex' => :lock_index,
    'Session' => :session,
    'Key' => :key,
    'Flags' => :flags,
    'Value' => :value,
    'CreateIndex' => :create_index,
    'ModifyIndex' => :modify_index,
  }.freeze

  # Capture and base64 decode a value from the api.
  #
  # @param value [String] The base64 encoded value from the response.
  def value=(value)
    return @value = nil if value.nil?
    @value = Base64.decode64 value
  end
end

#modify_indexInteger

Returns The internal index value representing when the entry was last updated.

Returns:

  • (Integer)

    The internal index value representing when the entry was last updated.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/imperium/kv_pair.rb', line 28

class KVPair < APIObject
  self.attribute_map = {
    'LockIndex' => :lock_index,
    'Session' => :session,
    'Key' => :key,
    'Flags' => :flags,
    'Value' => :value,
    'CreateIndex' => :create_index,
    'ModifyIndex' => :modify_index,
  }.freeze

  # Capture and base64 decode a value from the api.
  #
  # @param value [String] The base64 encoded value from the response.
  def value=(value)
    return @value = nil if value.nil?
    @value = Base64.decode64 value
  end
end

#sessionString

Returns The identifier for the session that owns the lock.

Returns:

  • (String)

    The identifier for the session that owns the lock.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/imperium/kv_pair.rb', line 28

class KVPair < APIObject
  self.attribute_map = {
    'LockIndex' => :lock_index,
    'Session' => :session,
    'Key' => :key,
    'Flags' => :flags,
    'Value' => :value,
    'CreateIndex' => :create_index,
    'ModifyIndex' => :modify_index,
  }.freeze

  # Capture and base64 decode a value from the api.
  #
  # @param value [String] The base64 encoded value from the response.
  def value=(value)
    return @value = nil if value.nil?
    @value = Base64.decode64 value
  end
end

#valueString

Returns The stored value (returned already base64 decoded).

Returns:

  • (String)

    The stored value (returned already base64 decoded)



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/imperium/kv_pair.rb', line 28

class KVPair < APIObject
  self.attribute_map = {
    'LockIndex' => :lock_index,
    'Session' => :session,
    'Key' => :key,
    'Flags' => :flags,
    'Value' => :value,
    'CreateIndex' => :create_index,
    'ModifyIndex' => :modify_index,
  }.freeze

  # Capture and base64 decode a value from the api.
  #
  # @param value [String] The base64 encoded value from the response.
  def value=(value)
    return @value = nil if value.nil?
    @value = Base64.decode64 value
  end
end