Class: Mara::Persistence::CreateRequest

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

Overview

A wrapper for a create 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 created.

Returns:

  • (Hash)


30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/mara/persistence.rb', line 30

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

Instance Method Details

#as_jsonHash

Converts the CreateRequest to JSON

Returns:

  • (Hash)

Since:

  • 1.0.0



35
36
37
38
39
40
41
# File 'lib/mara/persistence.rb', line 35

def as_json
  {
    put_request: {
      item: record
    }
  }
end