module DataHelpers
  class UserConfig < DataHelpers::Data
    # Given an array of keys, returns the value of this nested key series within users.yml
    #
    # Example:
    #
    # args = [:workstation, :frontline, :user]
    # DataHelpers::UserConfig.lookup(args)
    # => 9808
    #
    # Example 2:
    #
    # DataHelpers::UserConfig.lookup([:oa, :default])
    # => { username: 'automation_qa', password: 'secret' }
    #
    # Raises a KeyError if there is no user corresponding to the keys requested.
    def self.lookup(*args)
      args = args.map { |e| e.downcase.to_sym } # Downcase and symbolize all args

      all_data.lookup(*args)
    end
  end
end
