Sha256: 87b0ba68aa55fe4435105d834b764efbecc72a1562ca380979b9e7af6555bdfb

Contents?: true

Size: 538 Bytes

Versions: 2

Compression:

Stored size: 538 Bytes

Contents

# frozen_string_literal: true

module Metatron
  # Used for "normal" sync requests
  class SyncController < Controller
    options "/" do
      headers "Access-Control-Allow-Methods" => ["POST"]
      halt 200
    end

    post "/" do
      if (provided_etag = calculate_etag)
        etag provided_etag
      end

      data = sync
      data[:children] = data[:children]&.map { |c| c.respond_to?(:render) ? c.render : c }
      halt(data.to_json)
    end

    def calculate_etag = nil
    def sync = raise NotImplementedError
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metatron-0.4.2 lib/metatron/sync_controller.rb
metatron-0.4.1 lib/metatron/sync_controller.rb