Sha256: 4652db5ba86b0110d2fc96b06296fb165e1492099de588ac7a169b42e38e9b7d

Contents?: true

Size: 728 Bytes

Versions: 7

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true

module TableSync::Publishing::Data
  class Raw
    attr_reader :model_name, :attributes_for_sync, :event

    def initialize(model_name:, attributes_for_sync:, event:)
      @model_name = model_name
      @attributes_for_sync = attributes_for_sync
      @event = TableSync::Event.new(event)
    end

    def construct
      {
        model: model_name,
        attributes: wrapped_attributes_for_sync,
        version: version,
        event: event.resolve,
        metadata: event.metadata,
      }
    end

    def wrapped_attributes_for_sync
      attributes_for_sync.is_a?(Array) ? attributes_for_sync : [attributes_for_sync]
    end

    def version
      Time.current.to_f
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
table_sync-6.5.1 lib/table_sync/publishing/data/raw.rb
table_sync-6.5.0 lib/table_sync/publishing/data/raw.rb
table_sync-6.4.2 lib/table_sync/publishing/data/raw.rb
table_sync-6.4.1 lib/table_sync/publishing/data/raw.rb
table_sync-6.4.0 lib/table_sync/publishing/data/raw.rb
table_sync-6.3.0 lib/table_sync/publishing/data/raw.rb
table_sync-6.1.0 lib/table_sync/publishing/data/raw.rb