class EventStoreClient::DeserializedEvent
Attributes
data[R]
id[R]
metadata[R]
title[R]
type[R]
Public Class Methods
new(args = {})
click to toggle source
# File lib/event_store_client/deserialized_event.rb, line 18 def initialize(args = {}) validation = schema.call(args[:data] || {}) unless args[:skip_validation] @data = args.fetch(:data) { {} } @metadata = args.fetch(:metadata) { {} }.merge( 'type' => self.class.name, 'content-type' => content_type ) if !args[:skip_validation] && validation.errors.any? @metadata.merge!('validation-errors' => validation.errors.to_h) end @type = args[:type] || self.class.name @title = args[:title] @id = args[:id] end
Public Instance Methods
content_type()
click to toggle source
# File lib/event_store_client/deserialized_event.rb, line 33 def content_type return 'application/json' if EventStoreClient.config.adapter == :grpc 'application/vnd.eventstore.events+json' end
schema()
click to toggle source
# File lib/event_store_client/deserialized_event.rb, line 13 def schema Dry::Schema.Params do end end