A North Yorkshire man who attacked his puppy has been banned from keeping animals.