Effect of Size, Shape and Environment on the Optical Response of Metallic Nanoparticles