module AplIdPrefixBuilder

Public Instance Methods

get_apl_entity_prefix(params) click to toggle source

Using hash for params as tomorrow if this is used by some other service which has other params than type, bu, we wouldn't need to change method signature, just accomodate that param in method body and existing usage won't break

# File lib/apl-library/apl_id_prefix_builder.rb, line 7
def get_apl_entity_prefix(params)

  #TODO currently no enforcement on any param to be present
  #we simply use empty string if not present, we can add the enforcement later based on use case
  type_acronym   = params[:type_acronym] || ""
  bu_id          = params[:bu_id] || ""
  time_format    = params[:time_format] || '%Y%m%d'
  time           = params[:time] || Time.now()

  id_prefix = bu_id + type_acronym + time.strftime(time_format)
  id_prefix
end