Sha256: 300549efbeebd3014b327cfaba68b82f68a53524ed5b84b8a6296013226b0fe4

Contents?: true

Size: 806 Bytes

Versions: 1

Compression:

Stored size: 806 Bytes

Contents

class EventOptionsBuilder
  MAX_PROPERTIES_SIZE = 10

  def initialize(event_type, user_id, user_traits, user_name, email, created_at, context, properties, timestamp)
    @event_options = EventOptions(event_type)
    @event_options.user_id = user_id
    @event_options.user_traits = user_traits if user_traits
    @event_options.user_traits = UserTraits(name, email, created_at) if user_name && email && created_at
    @event_options.context = context
    @event_options.properties = properties
    @event_options.timestamp = timestamp
  end

  def build
    if !@event_options.properties.nil? && @event_options.properties.length > MAX_PROPERTIES_SIZE
      raise SecureNativeInvalidOptionsException('You can have only up to {} custom properties', MAX_PROPERTIES_SIZE)
    end

    @event_options
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
securenative-0.1.16 lib/securenative/event_options_builder.rb