# frozen_string_literal: true require "securerandom" module NeetoCommonsBackend module SampleData module Common class OrganizationBase < Common::Base attr_reader :organization_name, :organization def initialize @organization_name = self.class::ORGANIZATION_NAME end def process! create_organization! end private def create_organization! auth_app = app_secrets.auth_app @organization = Organization.create! \ name: organization_name, subdomain: organization_name.parameterize, auth_app_url: auth_app[:url], auth_app_id: auth_app[:id], auth_app_secret: auth_app[:secret], api_key: SecureRandom.alphanumeric, widget_api_key: SecureRandom.alphanumeric end end end end end