Sha256: 7a69b18429ec2bcedc3d256df21923cbc9f62e76ade957cffcf5bb0af4547242

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

module AplIdPrefixBuilder


  #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
  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

end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
apl-library-0.0.90 lib/apl-library/apl_id_prefix_builder.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/lib/apl-library/apl_id_prefix_builder.rb