Sha256: 9e03135243a0881589cd10d71fa6d0353490761bd2ea6b429a1d1610cd4a3ff5

Contents?: true

Size: 970 Bytes

Versions: 5

Compression:

Stored size: 970 Bytes

Contents

# frozen_string_literal: true

require 'cyclone_lariat/repo/mappers/base'

module CycloneLariat
  module Repo
    module Mappers
      class InboxMessages < Base
        class << self
          def from_row(row)
            return if row.nil?

            row[:data] = hash_from_json_column(row[:data])
            row[:client_error_details] = hash_from_json_column(row[:client_error_details]) if row[:client_error_details]
            row
          end

          def to_row(input)
            {
              uuid: input.uuid,
              kind: input.kind,
              type: input.type,
              publisher: input.publisher,
              data: JSON.generate(input.data),
              client_error_message: input.client_error&.message,
              client_error_details: JSON.generate(input.client_error&.details),
              version: input.version,
              sent_at: input.sent_at
            }
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cyclone_lariat-1.0.0 lib/cyclone_lariat/repo/mappers/inbox_messages.rb
cyclone_lariat-1.0.0.rc9 lib/cyclone_lariat/repo/mappers/inbox_messages.rb
cyclone_lariat-1.0.0.rc8 lib/cyclone_lariat/repo/mappers/inbox_messages.rb
cyclone_lariat-1.0.0.rc7 lib/cyclone_lariat/repo/mappers/inbox_messages.rb
cyclone_lariat-1.0.0.rc6 lib/cyclone_lariat/repo/mappers/inbox_messages.rb