As long as you downloaded it from the App Store when it was available, you should be able to use the AppleID used to download it and re-download the installer from App Store / Purchases tab.
For any Mac that came preinstalled with Yosemite, a factory reset using Internet Recovery will download/install version 10.10.5 and NOT the original version that shipped (e.g. 10.10-10.10.4).
So that I don't have to go through the install process, I have a partition on an external drive (30GB) that contains a 10.10.5 install without going through Setup. So, whenever I want to install "clean", I boot to that external drive's Recovery HD, erase the drive I want to install to and use Disk Utility / Restore to block-copy from the external to where ever. This "resets back to factory" without having to download/reinstall the OS.
Once you redownload 10.10.5 from the App Store, you can run the installer from /Applications against an external drive (30GB) and Shutdown when you get to the Setup screen. Disconnect the external drive and you have what I mentioned in the above paragraph.