Sha256: 846c123878e26ad9dbcb0dc50a2a9de0b0f6de32b59d8301f5295915ed92c379

Contents?: true

Size: 894 Bytes

Versions: 16

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

require 'securerandom'

module Meibo
  class Builder
    module UserBuilder
      extend BaseBuilder

      def self.builder_attribute_names
        [:builder, :agents, :primary_organization]
      end

      def initialize(builder:, sourced_id: SecureRandom.uuid, agents: nil, primary_organization: nil, **kw)
        super(
          sourced_id: sourced_id,
          agent_sourced_ids: agents&.map(&:sourced_id),
          primary_org_sourced_id: primary_organization&.sourced_id,
          **kw
        )
        @builder = builder
        @agents = agents
        @primary_organization = primary_organization
        builder.users << self
      end

      def build_demographic(**kw)
        builder.build_demographic(user: self, **kw)
      end

      def build_profile(**kw)
        builder.build_user_profile(user: self, **kw)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
meibo-0.16.0 lib/meibo/builder/user_builder.rb
meibo-0.15.0 lib/meibo/builder/user_builder.rb
meibo-0.14.0 lib/meibo/builder/user_builder.rb
meibo-0.13.0 lib/meibo/builder/user_builder.rb
meibo-0.12.0 lib/meibo/builder/user_builder.rb
meibo-0.11.0 lib/meibo/builder/user_builder.rb
meibo-0.10.0 lib/meibo/builder/user_builder.rb
meibo-0.9.0 lib/meibo/builder/user_builder.rb
meibo-0.8.0 lib/meibo/builder/user_builder.rb
meibo-0.7.0 lib/meibo/builder/user_builder.rb
meibo-0.6.0 lib/meibo/builder/user_builder.rb
meibo-0.5.0 lib/meibo/builder/user_builder.rb
meibo-0.4.0 lib/meibo/builder/user_builder.rb
meibo-0.3.0 lib/meibo/builder/user_builder.rb
meibo-0.2.0 lib/meibo/builder/user_builder.rb
meibo-0.1.0 lib/meibo/builder/user_builder.rb