Valley man shoots dog during attack in Gilbert