Class: Mara::Persistence::DestroyRequest

Inherits:
Struct
  • Object
show all
Defined in:
lib/mara/persistence.rb

Overview

A wrapper for a destroy request.

Author:

  • Maddie Schipper

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#recordHash

The record hash to be destroyed.

Returns:

  • (Hash)


56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/mara/persistence.rb', line 56

DestroyRequest = Struct.new(:record) do
  ##
  # Converts the DestroyRequest to JSON
  #
  # @return [Hash]
  def as_json
    {
      delete_request: {
        key: record
      }
    }
  end
end

Instance Method Details

#as_jsonHash

Converts the DestroyRequest to JSON

Returns:

  • (Hash)

Since:

  • 1.0.0



61
62
63
64
65
66
67
# File 'lib/mara/persistence.rb', line 61

def as_json
  {
    delete_request: {
      key: record
    }
  }
end